I'm using MyFaces with Trinidad. The following SEVERE message keeps coming on startup:
SEVERE: Both MyFaces and the RI are on your classpath.
Please make sure to use only one of the two JSF-implementations.
I have the following in my glassfish-web.xml:
<glassfish-web-app error-url="">
<class-loader delegate="false"/>
<property name="useMyFaces" value="true"/>
</glassfish-web-app>
And the following JARs in classpath:
antlr-2.7.6.jar* hibernate3.jar*
cglib-2.2.2.jar javassist-3.9.0.GA.jar*
commons-beanutils-1.8.3.jar jta-1.1.jar*
commons-collections-3.1.jar* junit-4.9.jar
commons-collections-3.2.jar myfaces-api-2.1.2.jar
commons-digester-1.8.jar myfaces-commons-utils20-1.0.1.jar
commons-digester3-3.0.jar myfaces-components20-1.0.1.jar
commons-logging-1.1.1.jar myfaces-converters20-1.0.1.jar
commons-validator-1.3.1.jar myfaces-impl-2.1.2.jar
cssparser-0.9.5.jar myfaces-validators20-1.0.1.jar
dom4j-1.6.1.jar* mysql-connector-java-5.0.8-bin.jar
ejb3-persistence.jar* slf4j-api-1.5.10.jar*
hibernate-annotations.jar* slf4j-ext-1.5.10.jar*
hibernate-commons-annotations.jar* slf4j-simple-1.5.10.jar*
hibernate-entitymanager.jar trinidad-api-2.0.0.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar trinidad-build-2.0.0-sources.jar
hibernate-validator-4.2.0.Final.jar trinidad-impl-2.0.0.jar
I'm not quite sure how to eliminate the SEVERE message based on the configuration I've already done, any thoughts would be appreciated!
Related
I don't have any UnsupportedClassVersionError on log4j2's dependency(LMAX Disruptor) until CDI is enabled(beans.xml). The UnsupportedClassVersionError tells to run on java9 instead of java8, but this is not an optional. Please advise how to avoid this error on java8.
Weblogic 12.2
log4j 2.11.2
<May 15, 2019 10:50:00,579 AM SGT> <Error> <Class Loaders> <BEA-2162500> <Class, module-info, was compiled with an incompatible version of Java. Ensure that all the classes needed by the application have been compiled with a compatible java version. java.lang.UnsupportedClassVersionError: module-info has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
java.lang.UnsupportedClassVersionError: module-info has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at weblogic.utils.classloaders.GenericClassLoader.defineClassInternal(GenericClassLoader.java:1113)
at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:1046)
Truncated. see log file for complete stacktrace
>
<May 15, 2019 10:50:00,964 AM SGT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "6752224278283" for task "4" on [partition-name: DOMAIN]. Error is: "weblogic.management.DeploymentException: CDI deployment failure:com/lmax/disruptor/ExceptionHandler"
weblogic.management.DeploymentException: CDI deployment failure:com/lmax/disruptor/ExceptionHandler
at com.oracle.injection.integration.CDIAppDeploymentExtension.initCdi(CDIAppDeploymentExtension.java:95)
at com.oracle.injection.integration.CDIAppDeploymentExtension.activate(CDIAppDeploymentExtension.java:43)
at weblogic.application.internal.flow.AppDeploymentExtensionFlow.activate(AppDeploymentExtensionFlow.java:39)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:752)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: com.lmax.disruptor.ExceptionHandler
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1029)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:104)
at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
Truncated. see log file for complete stacktrace
Exclude log4j2 CDI scan as below:
beans.xml
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="all">
<scan>
<!-- Prevent java.lang.NoClassDefFoundError: com/lmax/disruptor -->
<exclude name="org.apache.logging.**" />
</scan>
</beans>
Whenever I deploy a war to wildfly 8 or 10 (in this case it's a jax-rs service), I see the following line
[javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 151) Initializing Mojarra 2.2.11-jbossorg-1 20150505-1501 for context
Since JSF is not used in the application, is there a way to stop mojarra from being initialized?
Add a jboss-deployment-structure.xml file to your WEB-INF folder to stop deployment for a single war
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<subsystem name="jsf" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
You can remove
<subsystem xmlns="urn:jboss:domain:jsf:1.0"/>
from your profile.
It should stop Mojarra initialization.
Installed CassandraVM-2.0.7.ova. Which version of Kundera works properly with this version of Cassandra? Facing too many issues trying to get this information. Could be my mistake in configuration. Is this information documented somewhere?
I tried with this maven dependency:
<dependency>
<groupId>com.impetus.kundera.client</groupId>
<artifactId>kundera-cassandra</artifactId>
<version>3.2</version>
</dependency>
Properties in persistence.xml is as follows:
<persistence-unit name="cassandra_pu">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<properties>
<property name="kundera.nodes" value="a.b.com" />
<property name="kundera.port" value="9042"/>
<property name="kundera.keyspace" value="KunderaExamples" />
<property name="kundera.dialect" value="cassandra" />
<property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
<property name="kundera.ddl.auto.prepare" value="create" />
</properties>
</persistence-unit>
While trying to execute the below statement,
EntityManagerFactory emf = Persistence.createEntityManagerFactory("cassandra_pu");
this exception occurred:
Exception in thread "main" com.impetus.kundera.configure.schema.SchemaGenerationException: org.apache.thrift.transport.TTransportException: Read a negative frame size (-2113929216)!
at com.impetus.client.cassandra.schemamanager.CassandraSchemaManager.create(CassandraSchemaManager.java:264)
at com.impetus.kundera.configure.schema.api.AbstractSchemaManager.handleOperations(AbstractSchemaManager.java:264)
at com.impetus.kundera.configure.schema.api.AbstractSchemaManager.exportSchema(AbstractSchemaManager.java:115)
at com.impetus.client.cassandra.schemamanager.CassandraSchemaManager.exportSchema(CassandraSchemaManager.java:166)
at com.impetus.kundera.configure.SchemaConfiguration.configure(SchemaConfiguration.java:188)
at com.impetus.kundera.configure.ClientMetadataBuilder.buildClientFactoryMetadata(ClientMetadataBuilder.java:48)
at com.impetus.kundera.persistence.EntityManagerFactoryImpl.configureClientFactories(EntityManagerFactoryImpl.java:408)
at com.impetus.kundera.persistence.EntityManagerFactoryImpl.configure(EntityManagerFactoryImpl.java:161)
at com.impetus.kundera.persistence.EntityManagerFactoryImpl.(EntityManagerFactoryImpl.java:135)
at com.impetus.kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:85)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at Main.main(Main.java:16)
I then tried with a much older release of Kundera (2.4) and faced the same issue. I guess I am missing something fundamental.
Removed the automatic schema generation option in persistence.xml and am still facing the same issue (Unable to create a new Cassandra connection. org.apache.thrift.transport.TTransportException: Read a negative frame size (-2113929216)!.)
On the server, this is the exception:
java.lang.ArrayIndexOutOfBoundsException: 47at org.apache.cassandra.transport.Message$Type.fromOpcode(Message.java:106)
at org.apache.cassandra.transport.Frame$Decoder.decode(Frame.java:168) at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:425)
Thrift clients need to used port 9160 and not 9042. Now it is working fine.
Issue: Getting resource exception at runtime attempting to connect to a websphere mq to get a jms message using spring. I just can't determine what I am missing?
Description:
Attempting to set up the example here. Spring MDP Activation Spec for Websphere MQ.
http://stackoverflow.com/questions/14523572/spring-jms-and-websphere-mq
Maven Dependencies
Note: Version numbers for the ibm jars looks odd because I created a local repo in my project to add the 3rd party libraries. I'm taking the ibm jars from my local Websphere SDP version for Websphere 7.5 . I also tried directly adding the jar dependencies on the STS spring package and had the same error.
Spring Config XML
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
xmlns:jms="http://www.springframework.org/schema/jms"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-4.1.xsd
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms-4.1.xsd
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-4.1.xsd">
<bean id="messageListener" class="myproject.spring.integration.mq.SpringMdp" />
<bean id="messageListener" class="com.rohid.samples.SpringMdp" />
<bean class="org.springframework.jms.listener.endpoint.JmsMessageEndpointManager">
<property name="activationSpec">
<bean class="com.ibm.mq.connector.inbound.ActivationSpecImpl">
<property name="destinationType" value="javax.jms.Queue"/>
<property name="destination" value="QUEUE1"/>
<property name="hostName" value="A.B.C"/>
<property name="queueManager" value="QM_"/>
<property name="port" value="1414"/>
<property name="channel" value="SYSTEM.ADMIN.SVNNN"/>
<property name="transportType" value="CLIENT"/>
<property name="userName" value="abc"/>
<property name="password" value="jabc"/>
</bean>
</property>
<property name="messageListener" ref="messageListener"/>
<property name="resourceAdapter" ref="myResourceAdapterBean"/>
</bean>
<bean id="myResourceAdapterBean" org.springframework.jca.support.ResourceAdapterFactoryBean">
<property name="resourceAdapter">
<bean class="com.ibm.mq.connector.ResourceAdapterImpl">
<property name="maxConnections" value="50"/>
</bean>
</property>
<property name="workManager">
<bean class="org.springframework.jca.work.SimpleTaskWorkManager"/>
</property>
</bean>
</beans>
Stack Trace:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jms.listener.endpoint.JmsMessageEndpointManager#0' defined in class path resource [context.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/resource/ResourceException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1101)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at myproject.spring.integration.mq.Main.main(Main.java:9)
Caused by: java.lang.NoClassDefFoundError: javax/resource/ResourceException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getDeclaredConstructor(Unknown Source)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094)
... 13 more
Caused by: java.lang.ClassNotFoundException: javax.resource.ResourceException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 19 more
Updated- Solution: Required IBM Jar dependencies required.
Generally the easiest way to get the classpath right in RAD or other IBM tools for applications that are ultimately going to be deployed to WAS is to load the server runtime library of the WAS version into your app.
It is very easy. Go to the app properties page, go to build path, libraries tab and click add Library. You will see the screen shot below. Choose server runtimes and as long as you have installed the correct WAS versions as part of RAD, you will see their runtimes.
This is generally the best way to go since it allows you to keep you WAS libraries separate from your app, but to still make them available for compilation. The worst thing you can do is embed WAS libraries as part of your app. If you do this and you deploy your app to different versions of WAS, then you will get weird classpath or weird runtime errors. On top of that, things that were working might stop working after fixpacks get applied or other software adjustments.
If you add the server runtime library, then this is what your app will look like in RAD.
Looks like you are missing some dependencies here. Can you try to add javaee-api to your pom file?
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version> <!-- or take version 7.0 if needed -->
</dependency>
I have to use version 4.0.1 of Hibernate in my enterprise application. The EAR is deployed into a JBoss 6.0 Container.
The ear file contains the following hibernate jars:
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.0.1.Final.jar
hibernate-entitymanager-4.0.1.Final.jar
hibernate-envers-4.0.1.Final.jar
hibernate-envers-4.0.1.Final.jar
hibernate-envers-4.0.1.Final.jar
hibernate-search-analyzers-4.0.0.Final.jar
hibernate-search-engine-4.0.0.Final.jar
hibernate-search-engine-4.0.0.Final.jar
hibernate-validator-4.2.0.Final.jar
According to Upgrade Hibernate version in JBOSS I've tried to configure custom classloading using the follwing jboss-app.xml and jboss-classloading.xml
<!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd">
<jboss-app>
<loader-repository>
com.acme.sample:archive=Sample
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</jboss-app>
<?xml version="1.0" encoding="UTF-8"?>
<classloading xmlns="urn:jboss:classloading:1.0"
domain="sample.ear"
export-all="NON_EMPTY"
import-all="true"
parent-first="false">
</classloading>
When starting up the JBoss 6 Container following lines occur in the log file:
09:49:55,238 INFO [org.hibernate.annotations.common.Version] HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
09:49:55,265 INFO [org.hibernate.Version] HHH000412: Hibernate Core {4.0.1.Final}
Seems as if Hibernate 4.0.1 has been detected. But then the following exception occurs:
09:49:55,388 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=sample-SNAPSHOT.ear/lib/persistence_impl-0.0.21-SNAPSHOT.jar#sample state=Create: java.lang.ClassCastException: org.jboss.as.jpa.scanner.HackTLScanner cannot be cast to org.hibernate.ejb.packaging.Scanner
at org.hibernate.ejb.Ejb3Configuration.buildScanner(Ejb3Configuration.java:415) [:3.6.0.Final]
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:582) [:3.6.0.Final]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72) [:3.6.0.Final]
at org.jboss.jpa.builder.DefaultCEMFBuilder.build(DefaultCEMFBuilder.java:47) [:1.0.2-alpha-3]
at org.jboss.as.jpa.scanner.HackCEMFBuilder.build(HackCEMFBuilder.java:49) [:6.0.0.Final]
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:275) [:1.0.2-alpha-3]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:60) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:168) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:257) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72) [jboss-kernel.jar:2.2.0.GA]
In the exception stack trace the version 3.6.0.Final of hibernate is mentioned. Seems as if the Container still tries to create the JPA Persistence Unit using the version of hibernate that ships with JBoss.
Can anybody give me a hint on what I am doing wrong and how to configure the custom classloading so that JBoss uses the Hibernate version that is packaged in the EAR file.
I have done a workaround for this problem and it works...
my ear structure is like this--->
accountEAR.ear
|
|--lib
|<all jars for hibernate 4.0.1 and mysql jdbc jar>
|
|--META-INF
| application.xml
| jboss-app.xml
| jboss-classloading.xml
| mysql-ds.xml
|
|-- account_persistence.jar
jboss version is 6.1 and mysql version 5.1
jboss-app.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD Java EE Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd" >
<jboss-app>
<loader-repository>
com.accountEAR:loader=accountEAR
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
<library-directory>lib</library-directory>
</jboss-app>
jboss-classloading.xml:
<?xml version="1.0" encoding="UTF-8"?>
<classloading
xmlns="urn:jboss:classloading:1.0"
export-all="NON_EMPTY"
import-all="true"
parent-first="false"/>