[weld-issues] [JBoss JIRA] Created: (WELD-872) Glassfish 3.1 maven-embedded-glassfish-plugin failure when cdi enabled (beans.xml present): java.lang.ClassNotFoundException: org.apache.tools.ant.Task

Craig Ringer (JIRA) jira-events at lists.jboss.org
Wed Mar 23 09:25:46 EDT 2011


Glassfish 3.1 maven-embedded-glassfish-plugin failure when cdi enabled (beans.xml present): java.lang.ClassNotFoundException: org.apache.tools.ant.Task
-------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: WELD-872
                 URL: https://issues.jboss.org/browse/WELD-872
             Project: Weld
          Issue Type: Bug
         Environment: Glassfish 3.1 via maven-embedded-glassfish-plugin 

Tested on:
Apache Maven 3.0.2 (r1056850; 2011-01-09 08:58:10+0800) 
Java version: 1.6.0_24, vendor: Sun Microsystems Inc. 
Java home: C:\Program Files\Java\jdk1.6.0_24\jre 
Default locale: en_AU, platform encoding: Cp1252 
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

and:
Apache Maven 3.0.1 (r1038046; 2010-11-23 18:58:32+0800)
Java version: 1.6.0_20
Java home: /usr/lib/jvm/java-6-openjdk/jre
Default locale: en_AU, platform encoding: UTF-8
OS name: "linux" version: "2.6.35-25-generic-pae" arch: "i386" Family: "unix"
            Reporter: Craig Ringer


>From http://java.net/jira/browse/JERSEY-689 ; I'm not sure if this is a Jersey or a Weld issue.

I'm having problems getting my app to run under Glassfish 3.1 embedded, and have boiled the issue down to a minimal test case involving maven-embedded-glassfish-plugin for glassfish 3.1, jersey 1.5, and cdi (weld). There isn't even any Java code of my own in it, only web.xml, beans.xml and a pom.xml that declares a dependency on jersey-server 1.5. I'm using Jersey 1.5 because I need its improved file upload handling and JSON support. 

When I use it to run an embedded glassfish server, deployment to to the embedded server fails with: 

  3/03/2011 6:40:28 PM org.glassfish.deployment.admin.DeployCommand execute 
  SEVERE: Exception while loading the app : org/apache/tools/ant/Task 
  java.lang.ClassNotFoundException: org.apache.tools.ant.Task 
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        ... (elided, see full exception linked below) ...
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1465)
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
	at org.glassfish.weld.BeanDeploymentArchiveImpl.handleEntry(BeanDeploymentArchiveImpl.java:485)
	at org.glassfish.weld.BeanDeploymentArchiveImpl.collectJarInfo(BeanDeploymentArchiveImpl.java:473)
	at org.glassfish.weld.BeanDeploymentArchiveImpl.populate(BeanDeploymentArchiveImpl.java:420)
	at org.glassfish.weld.BeanDeploymentArchiveImpl.<init>(BeanDeploymentArchiveImpl.java:148)
	at org.glassfish.weld.BeanDeploymentArchiveImpl.populate(BeanDeploymentArchiveImpl.java:391)
	at org.glassfish.weld.BeanDeploymentArchiveImpl.<init>(BeanDeploymentArchiveImpl.java:148)
	at org.glassfish.weld.BeanDeploymentArchiveImpl.<init>(BeanDeploymentArchiveImpl.java:128)
	at org.glassfish.weld.DeploymentImpl.<init>(DeploymentImpl.java:120)
	at org.glassfish.weld.WeldDeployer.load(WeldDeployer.java:334)
	at org.glassfish.weld.WeldDeployer.load(WeldDeployer.java:99)
	at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
	at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:249)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
        ...

(full exception and log of test run here: https://github.com/ringerc/scrapcode/blob/master/testcases/javaee/embeddedglassfish-jersey15-testcase/README ) 

If I delete beans.xml to disable CDI, the failure goes away. The stack trace passes through weld, providing further evidence that it's somewhere in CDI-land that things are breaking. 

I suspected that the problem might be related to WADL generation, so I set com.sun.jersey.config.feature.DisableWADL to true in the jersey servlet init params. That had no effect. 

Excluding all the dependencies of jersey-server, so only the jersey-server jar its self was present, still triggers the issue. It doesn't seem to be an issue with one of jersey-server's dependencies.

The ready-to-run testcase is here: https://github.com/ringerc/scrapcode/tree/master/testcases/javaee/embeddedglassfish-jersey15-testcase . Just: 

just: 

git clone git://github.com/ringerc/scrapcode.git 
cd scrapcode/testcases/javaee/embeddedglassfish-jersey15-testcase 
mvn clean install 

I'm filing this here because Jersey 1.5 seems to be the immediate cause, but there's always a chance it's a GF 3.1 or Weld bug.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the weld-issues mailing list