Trying to construct a Hazelcast 4.1 client configuration from XML throws IllegalArgumentException if the application is running in Apache TomEE-Plus 8.0.0.
If executed in a standalone Java VM (AdoptOpenJDK 11.0.5), the problem does not occur.
Standalone test and TomEE use identical JDK.
Part of the stack trace:
java.lang.IllegalArgumentException: Nicht unterstützt: http://javax.xml.XMLConstants/property/accessExternalDTD
at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:571)
at com.hazelcast.config.AbstractXmlConfigHelper.schemaValidation(AbstractXmlConfigHelper.java:109)
at com.hazelcast.client.config.XmlClientConfigBuilder.parseAndBuildConfig(XmlClientConfigBuilder.java:175)
at com.hazelcast.client.config.XmlClientConfigBuilder.build(XmlClientConfigBuilder.java:157)
at com.hazelcast.client.config.XmlClientConfigBuilder.build(XmlClientConfigBuilder.java:150)
at com.hazelcast.client.config.XmlClientConfigBuilder.build(XmlClientConfigBuilder.java:145)
...
I found a post on StackOverflow that seems to be related to my problem:
Set feature accessExternalDTD in TransformerFactory
Unfortunately, I have no idea if the suggested solution in answer no. 1 really matches my problem.
And even if so, I do not know how to apply the suggested solution in application code or configurations only, without changes inside Hazelcast code.
Any ideas how to fix this?
Hazelcast Client-Config XML:
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast-client xsi:schemaLocation="http://www.hazelcast.com/schema/client-config hazelcast-client-config-4.1.xsd"
xmlns="http://www.hazelcast.com/schema/client-config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</hazelcast-client>
TomEE version:
apache-tomee-plus-8.0.0 (Apache Tomcat Version 9.0.22)
Java version:
AdoptOpenJDK 11.0.5
IMPLEMENTOR="AdoptOpenJDK"
IMPLEMENTOR_VERSION="AdoptOpenJDK"
JAVA_VERSION="11.0.5"
JAVA_VERSION_DATE="2019-10-15"
MODULES="java.base java.compiler java.datatransfer java.xml java.prefs java.desktop java.instrument java.logging java.management java.security.sasl java.naming java.rmi java.management.rmi java.net.http java.scripting java.security.jgss java.transaction.xa java.sql java.sql.rowset java.xml.crypto java.se java.smartcardio jdk.accessibility jdk.internal.vm.ci jdk.management jdk.unsupported jdk.internal.vm.compiler jdk.aot jdk.charsets jdk.crypto.ec jdk.crypto.cryptoki jdk.dynalink jdk.httpserver jdk.internal.ed jdk.internal.le jdk.internal.vm.compiler.management jdk.jdwp.agent jdk.jfr jdk.jsobject jdk.localedata jdk.management.agent jdk.management.jfr jdk.naming.dns jdk.naming.rmi jdk.net jdk.pack jdk.scripting.nashorn jdk.scripting.nashorn.shell jdk.sctp jdk.security.auth jdk.security.jgss jdk.xml.dom jdk.zipfs"
OS_ARCH="x86_64"
OS_NAME="Linux"
SOURCE=".:git:7d14fe4b6f30"
This looks like this issue which is due to the presence of an old JAXP implementation in the classpath. This is fixed in Hazelcast 4.1.1 (fix pull request) by supplying a system property switch to avoid failing when XXE protection cannot be turned on.
You should be able to start your Hazelcast client in Apache TomEE by upgrading to Hazelcast 4.1.1 and setting system property hazelcast.ignoreXxeProtectionFailures=true (for example by supplying -Dhazelcast.ignoreXxeProtectionFailures=true to Apache TomEE's java startup command line).
This seems to be an issue with XML / DTD . Please check with the following config file
https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/resources/hazelcast-client-default.xml
and code
public ClientConfig clientConfig() throws Exception {
return new XmlClientConfigBuilder("hazelcast-client.xml").build();
}
Related
When org.apache.myfaces.CACHE_EL_EXPRESSIONS with value alwaysRecompile is in web.xml, WAR starts but when trying to go to any JSF view, this exception is thrown:
java.lang.NoSuchMethodException: org.apache.myfaces.view.facelets.AbstractFaceletCache.setMemberFactories(javax.faces.view.facelets.FaceletCache$MemberFactory, javax.faces.view.facelets.FaceletCache$MemberFactory)
Any ideas? WebSphere 9 is using MyFaces 2.2. Are there some limitations as compared to "usual" MyFaces 2.2 implementation?
I tested on 9.0.5.6 and also encountered the same error.
java.lang.NoSuchMethodException: org.apache.myfaces.view.facelets.AbstractFaceletCache.setMemberFactories(javax.faces.view.facelets.FaceletCache$MemberFactory, javax.faces.view.facelets.FaceletCache$MemberFactory)
at java.lang.Class.newNoSuchMethodException(Class.java:567)
at java.lang.Class.throwExceptionOrReturnNull(Class.java:1222)
at java.lang.Class.getMethodHelper(Class.java:1308)
at java.lang.Class.getDeclaredMethod(Class.java:936)
at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory.<init>(DefaultFaceletFactory.java:166)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.createFaceletFactory(FaceletViewDeclarationLanguage.java:2233)
I see the code is trying to retrieve the setMemberFactories method with 2 args rather than 3 (as the exception indicates, too).
I'll create an issue and have this issue resolve in the next WAS 9 release cycle. Thanks for discovering this!
My context :
BND (bndtools with Eclipse IDE) ;
OSGI (-runfw: org.eclipse.osgi;version='[3.16.100.v20201030-1916,3.16.200.v20210226-1447]') ;
runee: JavaSE-1.8
in bnd.launch file :
-runbundles: \
org.apache.felix.gogo.command;version='[1.1.2,1.1.3)',\
org.apache.felix.gogo.runtime;version='[1.1.4,1.1.5)',\
org.apache.felix.gogo.shell;version='[1.1.4,1.1.5)',\
org.apache.commons.commons-fileupload;version='[1.4.0,1.4.1)',\
org.apache.commons.commons-io;version='[2.8.0,2.8.1)',\
org.apache.felix.webconsole;version='[4.6.0,4.6.1)',\
org.apache.felix.http.jetty;version='[4.1.6,4.1.7)',\
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
org.apache.felix.scr;version='[2.1.24,2.1.25)',\
org.eclipse.equinox.cm;version='[1.5.0,1.5.1)',\
org.eclipse.equinox.console;version='[1.4.300,1.4.301)',\
org.eclipse.equinox.device;version='[1.1.100,1.1.101)',\
org.eclipse.osgi.services;version='[3.10.0,3.10.1)',\
org.eclipse.osgi.util;version='[3.6.0,3.6.1)',\
ch.qos.logback.classic;version='[1.2.3,1.2.4)',\
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
org.apache.felix.logback;version='[1.0.2,1.0.3)',\
slf4j.api;version='[1.7.30,1.7.31)',\
com.sun.activation.jakarta.activation;version='[2.0.1,2.0.2)',\
jakarta.xml.bind-api;version='[3.0.1,3.0.2)',\
com.sun.xml.bind.jaxb-osgi;version='[3.0.1,3.0.2)'
No use of any POM.xml file at all
When I launch the application, I get a
jakarta.xml.bind.JAXBException: Implementation of Jakarta XML Binding-API has not been found on module path or classpath.
- with linked exception:
[java.lang.ClassNotFoundException: org.glassfish.jaxb.runtime.v2.ContextFactory]
at jakarta.xml.bind.ContextFinder.newInstance(ContextFinder.java:255)
at jakarta.xml.bind.ContextFinder.newInstance(ContextFinder.java:243)
at jakarta.xml.bind.ContextFinder.find(ContextFinder.java:407)
at jakarta.xml.bind.JAXBContext.newInstance(JAXBContext.java:691)
at jakarta.xml.bind.JAXBContext.newInstance(JAXBContext.java:632)
If I add org.glassfish.jaxb.runtime;version='[3.0.1,3.0.2)'
to the runbundles list, it doesn't change anything (same exception).
Then if I add -runpath: org.glassfish.jaxb.runtime;version='[3.0.1,3.0.2)' to the bnd.launch file : it doesn't change anything either (same exception).
What did I did wrong ??
Thanks
Are you running on Java 1.9 or later? (The error message talks about module path.) The problem might be that JAXB is no longer exported from the JVM in later versions. This will the class loading of glassfish to fail without telling the underlying reason sometimes.
You can add -runvm -v:class to get more information about the class loading.
I'm trying to upgrade to Hazelcast 4.0 in our Spring Boot 2.2.1 application.
We use the #EnableHazelcastHttpSession annotation, which pulls in HazelcastHttpSessionConfiguration, which pulls in HazelcastIndexedSessionRepository from the spring-session-hazelcast jar.
However, this class won't compile because it imports Hazelcast's IMap which has moved to a different package in Hz 4.0.
Is there any way to fix this so that Spring Session works with Hazelcast 4?
I just copied the HazelcastIndexedSessionRepository into my own source code, changed the import from com.hazelcast.core.IMap to com.hazelcast.map.IMap, and swapped the sessionListenerId from String to UUID. If I keep it in the same package, then it loads my class instead of the one in the jar, and everything compiles and works fine.
Edit: We no longer get the SessionExpiredEvent, so something's not quite right, but manual testing shows us that our sessions do time out and force the user to log in again, even across multiple servers.
I found the cause of the error, you must look that the session repository is created by HazelcastHttpSessionConfiguration, in the class it checks wich version of hazelcast is in the classpath, when hazelcast4 is true then it instantiates Hazelcast4IndexedSessionRepository that doesn't use 'com.hazelcast.core.IMap' and you don't get the class not found exception.
Code of class HazelcastHttpSessionConfiguration
#Bean
public FindByIndexNameSessionRepository<?> sessionRepository() {
return (FindByIndexNameSessionRepository)(hazelcast4 ? this.createHazelcast4IndexedSessionRepository() : this.createHazelcastIndexedSessionRepository());
}
Remove the usage of HazelcastIndexedSessionRepository replace it with Hazelcast4IndexedSessionRepository or remove the code and let spring autoconfiguration do the job by HazelcastHttpSessionConfiguration
How to use omnifaces CDNResourceHandler with versioned resources?
Original url:
javax.faces.resource/jquery/jquery.js.xhtml?ln=primefaces&v=5.0
Desired url:
//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
How to map this to a specific url, omitting the version query parameter?
Mapping:
Using following mapping appends the version query parameter to the final url resulting in 404 HTTP error.
primefaces:jquery/jquery.js=//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
Results in:
//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js&v=5.0
System:
Glassfish 4
Mojarra 2.24
Primefaces 5.0
Rewrite 2.11
I reproduced it. This will happen when the PrimeFaces PrimeResourceHandler is initialized after OmniFaces CDNResourceHandler.
If you've declared the CDNResourceHandler inside /WEB-INF/faces-config.xml, then this is quite unexpected and likely a bug in GlassFish4.
But if you've declared the CDNResourceHandler inside /META-INF/faces-config.xml of a JAR which you in turn placed inside /WEB-INF/lib, then this can indeed happen if GlassFish initializes that JAR before the PrimeFaces JAR. In order to solve the problem, you need to explicitly declare your JAR's /META-INF/faces-config.xml to be initialized after the PrimeFaces one by adding the following entry to your JAR's /META-INF/faces-config.xml:
<ordering>
<after>
<name>primefaces</name>
</after>
</ordering>
Alternatively, move the CDNResourceHandler declaration to webapp's /WEB-INF/faces-config.xml.
I´ve deployed an EAR on a Websphere Application Server 7. In my code there is a part where I try to unmarshall a XML file into an object. I get this error when trying to do that:
java.lang.NoClassDefFoundError: com.ibm.xtq.bcel.util.SyntheticRepository (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
at com.ibm.xtq.bcel.classfile.JavaClass.<init>(JavaClass.java:109)
at com.ibm.xtq.bcel.classfile.JavaClass.<init>(JavaClass.java:228)
at com.ibm.xtq.bcel.generic.ClassGen.getJavaClass(ClassGen.java:174)
at com.ibm.fcg.bcel.FcgClassGenBCEL.dump2(Unknown Source)
at com.ibm.fcg.bcel.FcgClassGenBCEL.dump(Unknown Source)
at com.ibm.xml.xlxp2.jaxb.unmarshal.codegen.fcg.FCGDeserializationStubGenerator.generate(FCGDeserializationStubGenerator.java:249)
at com.ibm.xml.xlxp2.jaxb.codegen.AbstractGeneratedStubFactory.generateByteCode(AbstractGeneratedStubFactory.java:96)
at com.ibm.xml.xlxp2.jaxb.unmarshal.codegen.fcg.FCGStubFactory.generateStubByteCode(FCGStubFactory.java:46)
at com.ibm.xml.xlxp2.jaxb.codegen.AbstractGeneratedStubFactory.getStubClassConstructor(AbstractGeneratedStubFactory.java:154)
at com.ibm.xml.xlxp2.jaxb.unmarshal.codegen.AbstractGeneratedDeserializationStubFactory.createStub(AbstractGeneratedDeserializationStubFactory.java:58)
at com.ibm.xml.xlxp2.jaxb.unmarshal.impl.DeserializationContext.startComplexType(DeserializationContext.java:662)
at com.ibm.xml.xlxp2.jaxb.unmarshal.impl.DeserializationContext.handleRootElementEvent(DeserializationContext.java:303)
at com.ibm.xml.xlxp2.jaxb.unmarshal.impl.JAXBDocumentScanner.produceRootElementEvent(JAXBDocumentScanner.java:186)
at com.ibm.xml.xlxp2.scan.DocumentScanner.scanRootElement(DocumentScanner.java:2234)
at com.ibm.xml.xlxp2.scan.DocumentScanner.scanProlog(DocumentScanner.java:1726)
at com.ibm.xml.xlxp2.scan.DocumentScanner.nextEvent(DocumentScanner.java:1316)
at com.ibm.xml.xlxp2.scan.DocumentScanner.parseDocumentEntity(DocumentScanner.java:1168)
at com.ibm.xml.xlxp2.jaxb.unmarshal.impl.JAXBDocumentScanner.unmarshal(JAXBDocumentScanner.java:125)
at com.ibm.xml.xlxp2.jaxb.unmarshal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:120)
at com.inditex.lois.core.ws.utilidades.services.impl.AdaptadorServiceImpl.transformarXMLenObjeto(AdaptadorServiceImpl.java:137)
As far as I know that class is part of IBM JDK and cannot be found in runtime. Is there anything I have to modify in my ear or, as I guess, its all about configuring/modifiying WAS configuration (or even applying a patch if this is a bug).
Any help? Thanks a lot.
(Sorry for my english :) )
This exception means that the class com.ibm.xtq.bcel.util.SyntheticRepository is found, but failed static initialization. If there is no other message in the log about this, then this is the time to open a PMR with IBM. Static initializers in internal WebSphere code should never fail during normal usage course.
Same here, there is an APAR:
http://www-01.ibm.com/support/docview.wss?uid=swg1IV41639
Problem conclusion
This defect will be fixed in:
6.0.0 SR14
6.0.1 SR6
7.0.0 SR5
.
The fix resolved the AccessControlException. SyntheticRepository
class can be initialized properly, hence NoClassDefFoundError
does not occur.