Unable to use jackson in wildfly9 - java

Running in Wildfly9, my application makes a rest call to another server.
I get the error messsage
javax.ws.rs.ProcessingException: Unable to invoke request
at org.jboss.resteasy.client.jaxrs.engines.AppacheHttpClient4Engine.invoke(AppacheHttpClient4Engine.java:287)
...
Caused by: javax.ws.rs.ProcessingException: could not find writer for content-type application/json: type java.lang.String
at org.jboss.resteasy.core.interception.ClientWriterInterceptorContext.throwWriterNotFoundException(ClientWriterInterceptorContext.java:40)
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.getWriter(AbstractWriterInterceptorContext.java:138)
If I run my code 'standalone' (not in Wildfly), the rest call works. The error is probably caused by a misconfiguration by me (and I'm a newbie when it comes to Wildfly).
Most posts that i've seen has been about Wildfly8, e.g.
https://developer.jboss.org/thread/237728?_sscc=t
and RestEASY and Jackson incompatibility - NoSuchMethodException, none about Wildfly9 :(
I've modified the META-INF/jboss-deployment-structure.xml to
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.jboss.resteasy.resteasy-jackson-provider"/>
<module name="org.jboss.resteasy.resteasy-jettison-provider"/>
</exclusions>
<dependencies>
<module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Is this neccessary? From posts, I get the impression jackson2 is default in Wildfly9.
My jackson dependencies in the pom file are:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.2</version>
</dependency>
I've also tried with version 2.3.2 of the jackson jars as well as adding
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-base</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.3.2</version>
</dependency>
In the wildfly configuration, I use the standalone-full.xml configuration file (renamed to standalone.xml).
Do I need to add an extension for jackson2 too?
I appreciate any help/link that points me into the right direction.

Related

Apache POI and Weblogic JAR conflict- POI 5 and xmlbeans

I'm currently trying to use apache POI to make excel files in java, SXSSF to be exact. When running it however, I'm getting the following error:
Caused By: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(SchemaTypeLoaderImpl.java:161)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:198)
at org.apache.xmlbeans.metadata.system.sXMLSCHEMA.TypeSystemHolder.<init>(TypeSystemHolder.java:9)
Truncated. see log file for complete stacktrace
Caused By: org.apache.xmlbeans.XmlRuntimeException: java.lang.ClassCastException: org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl cannot be cast to org.apache.xmlbeans.SchemaTypeLoader
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(SchemaTypeLoaderImpl.java:164)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:198)
at org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<init>(TypeSystemHolder.java:9)
at org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<clinit>(TypeSystemHolder.java:6)
at java.lang.Class.forName0(Native Method)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassCastException: org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl cannot be cast to org.apache.xmlbeans.SchemaTypeLoader
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(SchemaTypeLoaderImpl.java:162)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:198)
at org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<init>(TypeSystemHolder.java:9)
at org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<clinit>(TypeSystemHolder.java:6)
at java.lang.Class.forName0(Native Method)
Truncated. see log file for complete stacktrace
Now, I know the similar issues to this have come up, and the usual fix is to alter weblogic.xml, and make
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.apache.commons.collections4.*</wls:package-name>
<wls:package-name>org.apache.commons.compress.*</wls:package-name>
<wls:package-name>org.apache.poi.*</wls:package-name>
<wls:package-name>org.apache.xmlbeans.*</wls:package-name>
<wls:package-name>org.apache.xmlbeans.XmlOptions</wls:package-name>
<wls:package-name>org.openxmlformats.*</wls:package-name>
<wls:package-name>schemaorg_apache_xmlbeans.*</wls:package-name>
</wls:prefer-application-packages>
<wls:prefer-application-resources>
<wls:resource-name>schemaorg_apache_xmlbeans/system/sXMLCONFIG/TypeSystemHolder.class</wls:resource-name>
<wls:resource-name>schemaorg_apache_xmlbeans/system/sXMLLANG/TypeSystemHolder.class</wls:resource-name>
<wls:resource-name>schemaorg_apache_xmlbeans/system/sXMLSCHEMA/TypeSystemHolder.class</wls:resource-name>
<wls:resource-name>schemaorg_apache_xmlbeans/system/sXMLTOOLS/TypeSystemHolder.class</wls:resource-name>
</wls:prefer-application-resources>
</wls:container-descriptor>
However, the issue arises that setting prefer-web-inf-classes to false breaks some of the rest of the application. So my question becomes, is there a way in the file I'm creating the excel, to specify that I want it to be built from the apache xmlbeans and not the weblogic xmlbeans? I'm thinking something like Classloader/Urlloader but I haven't been able to make that work properly yet, but I may be implementing it wrong.
Lastly, I'll include my pom.xml file
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${org.apache.poi-version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.16.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${org.apache.commons-commons-codec-version}</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${org.apache.commons-commons-lang3-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.core</artifactId>
<version>${org.eclipse.persistence-core-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.14</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>2.8.2</version>
</dependency>
</dependencies>
</project>
To be more specific, in my case I had added the following code to weblogic-application.xml for fixing the exception - java.lang.ClassCastException: org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl cannot be cast to org.apache.xmlbeans.SchemaTypeLoader
<weblogic-application>
<prefer-application-packages>
<package-name>org.apache.*</package-name>
<package-name>schemaorg_apache_xmlbeans.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>schemaorg_apache_xmlbeans/*</resource-name>
</prefer-application-resources>
</weblogic-application>

hadoop-aws compile dependencies on jackson library

I am trying to write a Spark program using Java to fetch records from oracle database and write it into S3 bucket. To access bucket using s3a:// convention, I have added hadoop-aws as dependency in the pom.xml.
I have added below dependencies in the pom.xml file :
<properties>
<java.version>1.8</java.version>
<scala.version>2.12</scala.version>
<spark.version>3.0.2</spark.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>com.github.noraui</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
<dependency>
<groupId>com.github.noraui</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.690</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-aws</artifactId>
</dependency>
I tried to run the program but got dependency error :
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/type/ReferenceType
at com.fasterxml.jackson.module.scala.modifiers.ScalaTypeModifierModule.$init$(ScalaTypeModifier.scala:35)
at com.fasterxml.jackson.module.scala.DefaultScalaModule.<init>(DefaultScalaModule.scala:18)
at com.fasterxml.jackson.module.scala.DefaultScalaModule$.<init>(DefaultScalaModule.scala:36)
at com.fasterxml.jackson.module.scala.DefaultScalaModule$.<clinit>(DefaultScalaModule.scala)
After bit of research, I got to know the hadoop-aws has compilation dependency on com.fasterxml.jackson.core as mentioned here :
https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-aws/2.8.5
So, I updated my pom.xml with the below dependencies :
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
But, I am still getting the same error. I am not sure what else I am missing here.

Cannot create a secure XMLInputFactory when calling Apache CXF Client in spring boot application

I'm trying to use a service in my spring boot application. This exact client works fine in netbeans and an older project using spring 3 MVC but when I try to call the same method I get javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: java.lang.RuntimeException: Cannot create a secure XMLInputFactory.
I searched a lot and tried different answer but no luck! these are some of question on stackoverflow that I tried:
CXF web service client: "Cannot create a secure XMLInputFactory"
java.lang.RuntimeException: Cannot create a secure XMLInputFactory when deploying on Glassfish
Cannot create a secure XMLInputFactory
Cannot create a secure XMLInputFactory when calling Apache CXF Client from Plain Java
Although passing a VM Option for allowing less secure parsers wasn't a solution for me I tried that. When I added the -Dorg.apache.cxf.stax.allowInsecureParser=1 the first line of code does not throw the specified exception but on second line when I try to get the port a java.lang.NoSuchFieldError: QUALIFIED will be thrown!
Code for calling service:
MessageRelayService messageRelayService = new MessageRelayService();
MessageRelay msgService = messageRelayService.getMessageRelayPort();
CountResult countResult = msgService.getReceivedMessageCount(USERNAME, PASSWORD);
My pom(some parts were omitted for brevity):
<properties>
...
<java.version>1.8</java.version>
<cxf.version>3.0.0</cxf.version>
<swagger.version>2.6.0</swagger.version>
<purchase.version>1.2.4</purchase.version>
<spring-cloud.version>Camden.SR2</spring-cloud.version>
...
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
.
.
.
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
.
.
.
</dependencies>
...
Any help would be greatly appreciated.
After a lot of search and trying all kinds of things with help of #pringi I returned back to my pom and found out the problem so I thought to write an answer maybe it'll help somebody someday!
The problem was that I had some dependencies in my pom that weren't needed and they could be removed and they conflicted with cxf! So I removed these dependencies and voila!
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.neethi</groupId>
<artifactId>neethi</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.2</version>
</dependency>
Thanks To All!

Problems creating JAXBContext in OSGI Bundle

Task: Batch process to transform data and store the result as XML-File on disk.
Problem: Marshalling objects, loading JAXBContextFactory in OSGI bundle.
Deadlock caused by java.lang.NoClassDefFoundError: org/eclipse/persistence/internal/libraries/asm/ClassWriter in FutureTask:311. No stacktrace or cause.
Question: What kind of setting or import do I miss to get the JAXBContext instantiation working?
Explanation:
For data processing I need to store my POJO Class as XML-File on Disk.
The POJO Class is generated from an xsd file with jaxb2-maven-plugin (xjc) filled in the batch process and then saved to disk where it will be further processed.
From an different Stack Overflow question I learned that OSGI uses different classloader and I have to use the right newInstance method to instantiate the JAXBContext. (Answer: https://stackoverflow.com/a/1043807/7461710).
This is my current newInstance call, The PrintDocument class is in the auto generated package com.some.package.generated and the ObjectFactory is in the same package and also generated by the jaxb2-maven-plugin.
The Programm fails during the newInstance call.
JAXBContext jaxbContext = JAXBContext.newInstance(PrintDocument.class.getPackage().getName(),
ObjectFactory.class.getClassLoader());
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
Logfile:
DEBUG XMLUtil:24 -Step 4/4: Save result into file. path: /somewhere/result.xml
DEBUG bind:282 - Searching jaxb.properties
DEBUG bind:300 - Searching the system property
DEBUG bind:565 - Trying to load org.eclipse.persistence.jaxb.JAXBContextFactory
[no further output]
We use bnd to Import packages, I have set the bnd.bnd file in the bundle to
Import-Package: \
org.eclipse.persistence.jaxb,\
*
As JAXB implementation I use moxy.
If I add this jaxb.properties file to the generated pojo package:
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
A regular class not found exception is thrown. Even in my unit test. (The unit-test performs the marshalling outside of the OSGI bundle)
javax.xml.bind.JAXBException: Provider org.eclipse.persistence.jaxb.JAXBContextFactory not found
- with linked exception:
[java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.JAXBContextFactory ]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:134)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:293)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:394)
[...]
But if I change the newInstance call to JAXBContextFactory.createContext based on this Answer https://stackoverflow.com/a/6820113/7461710, my unit-test works again and the programm gets stuck in the Deadlock caused by java.lang.NoClassDefFoundError: org/eclipse/persistence/internal/libraries/asm/ClassWriter as mentioned above.
Project dependencies:
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.launcher</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.11.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-api</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-service</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>org.zeroturnaround</groupId>
<artifactId>zt-exec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.io7m.xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.10</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.jdbc</groupId>
<artifactId>pax-jdbc</artifactId>
<version>0.9.0</version>
<exclusions>
<exclusion>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.ops4j.pax.jdbc</groupId>
<artifactId>pax-jdbc-h2</artifactId>
<version>0.4.0</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.193</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.jdbc</groupId>
<artifactId>pax-jdbc-oracle</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.cmpn</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.asm</artifactId>
<version>3.3.1_1</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.saxon</artifactId>
<version>9.7.0-10_1</version>
</dependency>
<dependency>
<groupId>xml-resolver</groupId>
<artifactId>xml-resolver</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.configadmin</artifactId>
<version>1.8.12</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.gogo.shell</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.gogo.command</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.gogo.runtime</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>2.6.4</version>
</dependency>
The default is com.sun.xml.internal.ws.developer.JAXBContextFactory but you should not set it in your bundle as it is a sun private package.
Instead try to use this in your OSGi framework properties:
org.osgi.framework.bootdelegation=com.sun.*
This will allow the JAXBContext to find an instantiate the default JAXBContextImpl.

Wildfly10 Server giving ClassCastException on deploying EJB module

I'm trying to move from wildfly9 to wildfly 10.
My code works properly on wildfly9
But when I try to deploy my ejb module on wildfly 10 I get the following error:
java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
I tried all the options available out there to correct this error but nothing helped me.
Here are the dependencies that i have in my pom
<dependencies>
<dependency>
<groupId>za.co.ecommunicate</groupId>
<artifactId>pl4sms-billing</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- ehcache dependency -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.1.0.Final</version>
</dependency>
<!-- ehcache dependency -->
<dependency>
<groupId>za.co.ecommunicate</groupId>
<artifactId>pl4sms-persistence</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- dependencies require for test asserts -->
<!-- <dependency> <groupId>za.co.ecommunicate</groupId> <artifactId>pl4sms-web</artifactId>
<version>1.0-SNAPSHOT</version> </dependency> -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.13</version>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>tomee-embedded</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
According to the solutions available I have found the the problem is related to hibernate, I have updated hibernate dependencies, changing the scope and also adding dom4j dependency but nothing worked.
The same module gets deployed without any problem on wildfly 9.
Can anybody help me out in resolving this error.
I have found the solution of my question may be it will help others.
i got the solution from this blog.
I added the line in my war's MANIFEST.MF file:
Open {your war}/META-INF/MANIFEST.MF
Add this line at the end - Dependencies: org.dom4j export
and added the following line in persistence.xml:
<property name="hibernate.listeners.envers.autoRegister" value="false"/ >
And it worked for me.
You problem is this:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.1.0.Final</version>
</dependency>
It brings in the old dom4j jar: Reference this ticket: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory.
You either need to remove it, declare it as provided in scope, or not run the application on the Wildfly Server (which is probably not your preferred option).

Categories