0

I am new to Wildfly and wanted to upgrade our current JBoss 5.1 server to Wildfly 8.1. I have an application that contains 1 war and many jars which are on the class path for that war. This ear deploys on JBoss 5.1 with no issue but on Wildfly 8.1 I get LinkageErrors.

2014-10-09 16:08:12,425 WARN  [org.jboss.modules] (MSC service thread 1-16) Failed to define class org.castor.xml.XMLProperties in Module "deployment.iffc.ear.castor-1.3.3-xml.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/castor/xml/XMLProperties (Module "deployment.iffc.ear.castor-1.3.3-xml.jar:main" from Service Module Loader)
...
Caused by: java.lang.ClassNotFoundException: org.castor.core.util.AbstractProperties from [Module "deployment.iffc.ear.castor-1.3.3-xml.jar:main" from Service Module Loader]

The application uses castor 1.3.3 and on the classpath for the war these are included: castor-1.3.3-core.jar and castor-1.3.3-xml.jar.

The directory structure of the ear is like this:

ear
 |---METAINF
 |---castor-1.3.3-core.jar
 |---castor-1.3.3-xml.jar
 |---many other jars
 |---warFile.war

The ClassNotFoundException pointing to org.castor.core.util.AbstractProperties DOES EXIST but in castor-1.3.3-core.jar. How come the code does not look in the core jar file instead of the xml jar file?

I've learned with Wildfly that the classloading has changed. There's a section title "EAR Class Loading".

The only subdeployment in this ear, though, is the warFile.war. The others don't show up as subdeployments unless I'm interpreting the docs wrong. It states that wars and EJB jars are subdeployments and I do not have EJB jars.

In anycase, I did try explicitly setting ear-subdeployments-isolated to false by creating a jboss-deployment-structure.xml file in the ear's METAINF directory. That didn't do anything.

I also explicitly modified the manifest file of castor-1.3.3-xml.jar to have a dependency on castor-1.3.3-core.xml but that caused a whole other mess. This resulted in all the other jars missing dependencies on other jars... I guess if you explicitly state a dependency on one jar you have to do it to all?

Any help is much appreciated. Would like to get this app running on this new server. Thanks!

UPDATE:
The warFile.war has the Class-Path defined in its MANIFEST.MF file with all those jars located at the ear root level.

Added the class path from the war module:

Class-Path: axis-1.3.jar castor-1.3.1-core.jar castor-1.3.1-xml.jar co
 mmons-jxpath-1.2.jar commons-lang-2.0.jar commons-logging.jar commons
 -pool-1.3.jar log4j-1.2.14.jar gson-2.2.4.jar activation.jar axiom-ap
 i.jar axiom-impl.jar axis2-adb.jar axis2-kernel.jar backport-util-con
 current.jar commons-codec.jar commons-discovery.jar commons-fileuploa
 d.jar commons-httpclient.jar commons-io.jar geronimo-strax-api_1.0_sp
 ec.jar neethi.jar qxpsm-webservicestubs-10.1.jar wsdl4j.jar wstx-asl.
 jar XmlSchema.jar
Chuck L
  • 1,026
  • 10
  • 23
  • WildFly (and JBossAS 7.x) class loading was changed so that it behaved in the way that the JavaEE spec dictates by default. Earlier JBossAS versions required configuration to get this effect. Please show the content of the Class-Path entry in the MANIFEST.MF from the WAR file – Steve C Oct 24 '14 at 05:47
  • @SteveC I have updated the question with the Class-Path entry. I ended up moving all the jar files to the lib directory of the ear file and now classes are loaded with no errors. I think this is inline with the JavaEE spec? – Chuck L Oct 27 '14 at 19:39

1 Answers1

1

You have to put non ejb or war modules into a lib folder in the ear file

ear
 |---lib
 |     |---castor-1.3.3-core.jar
 |     |---castor-1.3.3-xml.jar
 |     |---non ejb jars
 |
 |-- warFile.war
 |-- ejbFile.jar
pikmat
  • 26
  • 2
  • Thanks for giving an answer and I finally tried this out and worked in my case. I'm still not quite sure why I cannot have those same jars at the ear level. I forgot to mention that my war file had the Class-Path specified in its manifest file with those jars. Shouldn't that work also? – Chuck L Oct 14 '14 at 21:50