[jboss-user] JBOSS 5 Deployment Error -- java.lang.NoClassDefFoundError

William zhou_william at yahoo.cn
Thu May 7 23:39:20 EDT 2009


When I was upgrading JBoss from 4.2.3GA to 5.0.1GA and JDK from 5 to 6, I met 

some errors in the deployment.

The error message is:
22:44:33,938 INFO  [TomcatDeployment] deploy, ctxPath=/rs
22:44:33,985 ERROR [[/rs]] Exception starting filter BasicAuthFilter
java.lang.NoClassDefFoundError: com/example/context/Identity
        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.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at 

org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:258)
        at 

org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:220)
        at 

org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:332)
        at 

org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:90)
        at 

org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3783)
        at 

org.apache.catalina.core.StandardContext.start(StandardContext.java:4413)
        at 

org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:312)
        at 

org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:144)
        at 
......

My app is like this:
App.ear
 - APP-INF
 - META-INF
 - Foo.war
   - WEB-INF
   - META-INF
The jars in war/WEB-INF/lib has dependencies on jars in ear/APP-INF/lib.

In ear/META-INF/, application.xml is like this:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" 

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 

http://java.sun.com/xml/ns/javaee/application_5.xsd">
  <display-name>My APP</display-name>
  <module>
    <web>
      <web-uri>Foo.war</web-uri>
      <context-root>/rs</context-root>
    </web>
  </module>
</application>

In ear/META-INF/, jboss-app.xml is like this:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-app>
    <loader-repository>
        com.example:loader=App.ear
        <loader-repository-config>
            java2ParentDelegation=false
        </loader-repository-config>
    </loader-repository>
    <library-directory>
        APP-INF/lib
    </library-directory> 
</jboss-app>

In war/META-INF, the Manifest is like:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: William
Title: Sample App
Copyright: Copyright 2009.
Class-Path: APP-INF/classes/

1) While I was deploying the ear in JBOSS 4.x & JDK5, it succeeded.
2) If I move jar files from ear/APP-INF/lib to war/WEB-INF/lib or reversingly, the deployment succeeds as well.

Seemingly, the error has relation with classloader, am I doing something wrong?

Thanks,
William




      ___________________________________________________________ 
  好玩贺卡等你发,邮箱贺卡全新上线! 
http://card.mail.cn.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20090508/2110fc68/attachment.html 


More information about the jboss-user mailing list