[jboss-user] [Beginners Corner] - ClassNotFoundException whereas the JAR is here!

sarbogast do-not-reply at jboss.com
Thu Dec 27 13:23:50 EST 2007


I have a classloading issue with an EAR application. It contains:

  | *  spring-2.0.7.jar
  | *  myapp-core.jar
  | *  myapp-web.war
  | 

In myapp-web.war, there is a WEB-INF/web.xml file with the following:

  | <web-app>
  | <!-- ... -->
  |   <listener>
  |       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  |     </listener>
  | 
  |     <context-param>
  |         <param-name>contextConfigLocation</param-name>
  |         <param-value>
  |             classpath:applicationContext.xml
  |         </param-value>
  |     </context-param>
  | </web-app>
  | 

And applicationContext.xml (Spring configuration file) resides in myapp-core.jar, with the following section:

  | <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  |         <property name="dataSource"><ref bean="dataSource"/></property>
  |         <property name="mappingLocations"><ref bean="hibernateMappingLocations"/></property>
  |         <property name="hibernateProperties"><ref bean="hibernateProperties"/></property>
  |     </bean>
  | 

And LocalSessionFactoryBean class resides in spring-2.0.7.

Yet, when I start up my application, I get the following exception:

  | 19:05:52,534 ERROR [ContextLoader] Context initialization failed
  | org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.hibernate3.LocalSessionFactoryBean] for bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.LocalSessionFactoryBean
  | Caused by: 
  | java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.LocalSessionFactoryBean
  | 	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
  | ...
  | 

And I can't figure out why I get this ClassNotFoundException since spring-2.0.7.jar is here, at the root of the EAR.

Can somebody help me out with that, because I don't understand how EAR classpath works?

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

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



More information about the jboss-user mailing list