[jboss-user] [Installation, Configuration & DEPLOYMENT] - Classloader issue with EAR (EJB/WAR) deployment on JBoss 4.0

ybh6336 do-not-reply at jboss.com
Thu Jul 26 11:22:56 EDT 2007


Hello all,

I have been struggling with a classloader issue for several days now and would appreciate if someone could help me with this.

Environment:
JBoss AS 4.0.5 GA
Windows XP
Spring 2.0.4

I'm trying to deploy a J2EE application, the packaging of which looks as follows:


  | jboss_server_instance
  |                      |
  |                      |-lib
  |                      |    |
  |                      |    |- spring2.0.4.jar
  |                      |    |- ...
  |                      |    |- ...
  |                      |
  |                      |- deploy
  |                               |
  |                               |- EAR
  | 			      	    |
  | 			            |- abc.jar
  | 			            |- xyz.jar
  | 			            |- ejb1.jar
  | 			            |- ejb2.jar
  | 			            |- ...
  | 			            |- ...
  | 			            |- WAR
  | 			                  |         
  | 			                  |- WEB-INF
  | 					           |
  | 					           |- classes (has nothing)
  | 					           |- lib (initially had abc.jar and xyz.jar as well, now has nothing)
  | 					           |- application-context1.xml
  | 					           |- application-context2.xml
  | 					           |- ...
  | 					           |- ...
  | 

There are several classes in abc.jar and xyz.jar that are referenced from inside some EJB jars as well as from inside the WAR. From inside the WAR, I mean servlet definitions in web.xml and bean definitions in Spring configuration files, since 'classes' inside my WEB-INF is empty.

Scenario 1: I placed both abc.jar and xyz.jar at the root of the EAR as well as inside WEB-INF/lib of the WAR. The startup servlets are able to find all the required classes and Spring gets configured fine as well. The problem in this scenario is that there are some classes that need to have singleton instances, and classes inside EJB jars are not able to get the singleton instances created by the WAR.

Scenario 2: I placed abc.jar and xyz.jar ONLY at the root of the EAR and got rid of all jars from WEB-INF/lib of the WAR. Now during the initialization of Spring context I get NoClassDefFoundError for all classes inside abc.jar or xyz.jar. So the classloader is not able to pick classes from the root of the EAR.

I have tried setting the following inside jbossweb-tomcat55.sar/META-INF/jboss-service.xml:


  | 	<attribute name="Java2ClassLoadingCompliance">true</attribute>
  | 	<attribute name="UseJBossWebLoader">true</attribute>
  | 

but that did not help either.

I also tried putting the following inside jboss-app.xml of the EAR:


  | 	<loader-repository>
  | 	com.my.package=unique.ear
  | 		<loader-repository-config> 
  | 		java2ParentDelegation=true 
  | 		</loader-repository-config>
  | 	</loader-repository>
  | 

and the following in jboss-web.xml:


  | 	<class-loading java2ClassLoadingCompliance="true">
  | 		<loader-repository>
  | 		com.my.package.war:loader=unique.war
  | 			<loader-repository-config>
  | 			java2ParentDelegation=true
  | 			</loader-repository-config>
  | 		</loader-repository>
  | 	</class-loading>
  | 

But none of these solves the problem. Am I missing something in my configuration here?

Regards.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067863#4067863

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067863



More information about the jboss-user mailing list