An Ant build executes wsimport prior to creating a jar which includes the generated classes. After upgrading various libraries in the project, to include jaxws, the task which creates the jar fails. The reported error is "Cause: the class org.apache.tools.ant.taskdefs.Jar was not found"
I'm upgrading an old project to use newer versions of various libraries. I've been gradually upgrading the libraries in the project. I perform an Ant build each time to isolate any compile time errors. Thus far the upgrades haven't had a major impact, though the libraries I've replaced are things like logging, e-mail, and etc.
Now I've reached the jaxws libraries. We're coming from version 2.1 and going to 2.2.7. After a few cycles of upgrading the libraries and updating the build file with newer versions, the deployed WAR seems to function correctly as the WSDL is responding.
As part of the build process the service is deployed. Subsequently an Ant task performs wsimport to generate Java classes corresponding to the WSDL. The generated classes are then used to create a jar.
It is here that the process now breaks with an exception from Ant. The first visible exception is "java.lang.ClassNotFoundException: org.apache.tools.ant.util.DateUtils". Running the process again in verbose mode generates "Problem: failed to create task or type jar" as an earlier exception in the trace.
I've fiddled with things like setting ANT_HOME per a post involving jaxb. I've also tried different JDKs - open vs Oracle. Changing various classpath entries in the build file hasn't had a positive effect.
What I have discovered is that I can execute each task independently in the proper sequence. The jar task normally has a depends statement involving the wsimport task. In prior use this worked fine. Now it seems as though the hand-off between the tasks is causing something to break.
I did try integrating the wsimport execution into the jar task. No change. I can't seem to narrow down whether the issue is with the wsimport task, the jar task, or some underlying environment configuration. It's especially strange as various other tasks in the build prior to this point work just fine.
The environment is RHEL 7, open JDK 1.7, ant 1.9.4. I also have an Oracle JDK 1.8 available.
build.xml:
<path id="jaxws.classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="${jar.dir}">
<include name="jaxws-tools.jar"/>
</fileset>
</path>
<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath refid="jaxws.classpath"/>
</taskdef>
<path id="processing.service.classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="${jar.dir}">
<include name="activemq-core-5.4.3.jar"/>
<include name="jaxb-impl.jar"/>
<include name="jaxb-xjc.jar"/>
<include name="jaxrpc.jar"/>
<include name="jaxws-rt.jar"/>
<include name="jaxws-tools.jar"/>
<include name="jms.jar"/>
<include name="jsr181-api.jar"/>
<include name="policy.jar"/>
<include name="slf4j-api-1.7.26.jar"/>
</fileset>
</path>
<target name="generate-processing-client" depends="setup">
<waitfor maxwait="60" maxwaitunit="second">
<http url="${serviceurl}?wsdl"/>
</waitfor>
<wsimport debug="true" verbose="true" keep="true" package="x.x.x.service.processing.client" destdir="${build.classes.dir}" wsdl="${serviceurl}?wsdl">
</wsimport>
</target>
<target name="jar-processing-client" depends="generate-processing-client" unless="skip.service.clients">
<jar basedir="${build.classes.dir}" destfile="${jar.dir}/agard-processing-client.jar" includes="x/x/x/service/processing/client/**"/>
</target>
Stacktrace:
jar-processing-client:
Caught an exception while logging the end of the build. Exception was:
java.lang.NoClassDefFoundError: org/apache/tools/ant/util/DateUtils
at org.apache.tools.ant.DefaultLogger.formatTime(DefaultLogger.java:330)
at org.apache.tools.ant.DefaultLogger.buildFinished(DefaultLogger.java:177)
at org.apache.tools.ant.Project.fireBuildFinished(Project.java:2087)
at org.apache.tools.ant.Main.runBuild(Main.java:872)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.util.DateUtils
at java.net.URLClassLoader$1.run(URLClassLoader.java:360)
at java.net.URLClassLoader$1.run(URLClassLoader.java:349)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:348)
at java.lang.ClassLoader.loadClass(ClassLoader.java:430)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:323)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 7 more
There has been an error prior to that:
/home/x/git/x/etc/ant/services/processing.xml:132: Problem: failed to create task or type jar
Cause: the class org.apache.tools.ant.taskdefs.Jar was not found.
Action: Check that the component has been correctly declared
and that the implementing JAR is in one of:
-/usr/share/ant/lib
-/home/x/.ant/lib
-a directory added on the command line with the -lib argument
Do not panic, this is a common problem.
It may just be a typographical error in the build file or the task/type declaration.
The commonest cause is a missing JAR.
This is not a bug; it is a configuration problem
at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:499)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:431)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
at org.apache.tools.ant.Task.perform(Task.java:347)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
I've also encountered errors relating to the manifest when I build the entire project. The jar task doesn't define a manifest. Adding manifest entries to the jar task seemed to remove that as an issue. When I execute only the jar task I receive the jar taskdef error above.
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.util.DateUtils
at java.net.URLClassLoader$1.run(URLClassLoader.java:360)
at java.net.URLClassLoader$1.run(URLClassLoader.java:349)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:348)
at java.lang.ClassLoader.loadClass(ClassLoader.java:430)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:323)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 7 more
There has been an error prior to that:
/home/x/git/alerting/build.xml:114: The following error occurred while executing this line:
/home/x/git/alerting/build.xml:63: The following error occurred while executing this line:
/home/x/git/alerting/etc/ant/services/processing.xml:132: Could not find default manifest: /org/apache/tools/ant/defaultManifest.mf
Update
I reverted several of the jaxws and jaxb libraries. This returned the build to a working state. I've subsequently added the newer versions of the libraries, each time running the build process. I identified the need to include items like jaxb-core-2.2.7, which oddly aren't available in the jaxws-ri-2.2.7 distribution. There are still issues with the build process as I proceed with upgrading the libraries. The current stack I'm receiving is as follows:
Caused by: java.lang.IllegalAccessError: tried to access field com.sun.xml.bind.marshaller.SAX2DOMEx.nodeStack from class com.sun.tools.ws.wsdl.parser.DOMBuilder
at com.sun.tools.ws.wsdl.parser.DOMBuilder.comment(DOMBuilder.java:136)
It seems very strange that these errors are occurring during what should be a rather simple jar task.
Update
I've been placing the new libraries in the same folder as the old ones. I thought this may cause an issue with the classpath. I decided to isolate the new libraries from the old by placing them in a separate directory. I copied in the other libraries I haven't yet updated. The issue with Ant still persists. I've isolated it to the wsimport task. I'm wondering if it isn't something to do with the classpath set by the taskdef.
Update
I've been digging through the wsimport Ant task sources. The closest thing I've seen thus far in the call hierarchy resides in WsTask2.java. They're changing the classloader. In tracking this down, it appears that the classpath should be that of the Ant tool. There are cases of reading the java.class.path and few which alter it.
It's still unclear why I'm experiencing this issue in my environment with these versions of software. I looked at the history of this project on github and didn't see any obvious sign of a bug related to this issue being fixed.
ClassLoader old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try {
ok = runInVm(getCommandline().getJavaCommand().getArguments(), logstr);
} finally {
Thread.currentThread().setContextClassLoader(old);
}
Update
I've confirmed the issue is not specific to my environment. I moved the source code and libraries to another server which is installed with RHEL 6. The build still fails with the same error.
I went back to my development machine and attempted to replace the JAXWS libraries with a higher version. I tried 2.2.8, 2.2.10, and 2.3.0. Of course with 2.3.0 I had to change to a 1.8 JDK. The issue persists.
Related
I have an Ant build which ends with a simple ZIP task:
<target name="packModule" description="Pack the SCO ZIP">
<zip destfile="${deploy.dir}/sco_${module}_${lang}.zip" basedir="${deploy.dir}" />
</target>
This generates a ZIP file which gets deployed fine on many LMS, including SCORM Cloud. But on CSOD, it throws this error:
Error: Failed to unzip: Zip64 Extended information found but version is not valid
Right now, I have to manually unzip the package generated by Ant Build and rezip using 7-Zip to fix the issue. Please help me resolve this. Am on Windows7, using Ant version: apache-ant-1.9.6 and my JRE is jre1.8.0_45
Thanks to #VGR, zip64Mode="never" fixed the issue. I confirm it works fine on CSOD and doesn't require a manual unzip-zip routine. The final task looks like this:
<target name="packModule" description="Pack the SCO ZIP">
<zip zip64Mode="never" destfile="${deploy.dir}/sco_${module}_${lang}.zip" basedir="${deploy.dir}" />
</target>
I am using the following link to create an ant script to run findbugs on a web application:
Chapter 6. Using the FindBugs™ Ant task
I am setting the auxClasspath parameter to my jars folder.
But when i run the task using ant findbugs from the command prompt, it takes a very long time(~45 minutes) and the output xml contains analysis of the jars in the auxClasspath as well as my source code.
I want only my source code to be analyzed.
This is the code in my build.xml:
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
<property name="findbugs.home" value="C:/Software/FindBugs" />
<target name="findbugs" >
<echo message="Finding Bugs From ${basedir}/src/java"/>
<findbugs home="${findbugs.home}"
output="xml:withMessages"
outputFile="${basedir}\findbugs.xml"
stylesheet="fancy-hist.xsl"
timeout="6000000"
jvmargs="-Xmx1200m">
<auxClasspath path="${basedir}/Jars/*.jar" />
<sourcePath path="${basedir}/src/java"/>
<class location="${basedir}/build/myApp-1.0.jar" />
</findbugs>
</target>
I have added findbugs-ant.jar to lib of my ant installation.
The findbugs directory exists.
Other information:
IDE: Netbeans 7.3
OS: Microsoft Windows XP
Ant Version: 1.8.4
Find Bugs Version: 2.0.2
Update
If i leave out this line:
<auxClasspath path="${basedir}/Jars/*.jar" />
I get my desired output(i.e. analysis of only my source code).
But it raises a warning:
[findbugs] The following classes needed for analysis were missing:
[findbugs] javax.servlet.http.HttpServlet
[findbugs] javax.servlet.http.HttpServletRequestWrapper
[list continues]....
Any idea, why find bugs is analyzing jars which it should not analyze(according to the documentation)
I tried to track which Jars are being used in the source code.
In the findbugs xml output, i found a line: ${basedir}\Jars\antlr-2.7.2.jar
The findbugs analysis report showed that all the other jars(except antlr-2.7.2.jar) were missing.
There were no more auxClassPath entries. Solved this by specifying each class path entry in a different line.
If anyone has any better ideas, kindly contribute.
I used the following auxClasspath settings to pull in all my jars in my lib folder and all the jars in directories under my lib folder.
<auxClasspath>
<fileset dir="${lib.dir}">
<include name="*/**"/>
<include name="*.jar"/>
</fileset>
</auxClasspath>
Place it inside the findbugs tag.
Try to remove this line
<class location="${basedir}/build/myApp-1.0.jar" />
Now to try to analyze both jar and source files, that's it takes so long time.
This line is needed and used to find a class if it encounters during analysis of your source.
<auxClasspath path="${basedir}/Jars/*.jar" />
Maybe to can limit it to only really needed jars, not all in the folder.
We got a GWT project in Eclipse, that otherwise works.
Now I want to have a script that runs on the server, which pulls the latest version from source control and compiles it on the server and deploys it.
This will save us a lot of manual work and allow us to deploy new version when on a connection with limited bandwidth (since we won't have to upload the application to the server).
After pulling the latest version of the source code, the script tries to compile the code using the following command:
java -cp "/path/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201211121240-rel-r42/gwt-2.5.0/*:/path/company/projects/pull-compile-deploy/X/X/src:/path/company/projects/pull-compile-deploy/X/X/war/WEB-INF/lib/*" com.google.gwt.dev.Compiler nl.company.projects.X
Compiling module nl.company.projects.X
Finding entry point classes
[ERROR] Unable to find type 'nl.company.projects.X.client.XMain'
[ERROR] Hint: Previous compiler errors may have made this type unavailable
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
All source code is in /path/company/projects/pull-compile-deploy/X/X/src and all used .jars (except for the GWT stuff) are in /path/company/projects/pull-compile-deploy/X/X/war/WEB-INF/lib/. Obviously something goes wrong.
Questions: The file /path/company/projects/pull-compile-deploy/X/X/src/nl/company/projects/X/client/XMain.java does exist and should imho be in the classpath?!
Anyone Any idea what might go wrong here?
Is it maybe possible to see in some log exactly the commands that eclipse executes for compilation? I looked at the build.xml that eclipse can export, but it seems that does not contain a target to compile for production.
something else: apperantly GWT expects the X.gwt.xml to be at /path/company/projects/pull-compile-deploy/X/X/src/nl/company/project/X.gwt.xml, whereas eclipse put it in /path/company/projects/pull-compile-deploy/X/X/src/nl/company/project/X/X.gwt.xml (i.e. nested one directory deeper), I fixed this by creating a symbolic link.
Further Edit:
Since one answer focused on how I invoked the compilation tools, I have rewritten that in Ant, see below.
The problem remains of course.
<!-- Compile the source using javac. -->
<target name="compile" depends="init">
<javac srcdir="src/" destdir="bin/">
<classpath refid="project.classpath"/>
</javac>
</target>
<!-- Use the GWT-compiler. -->
<target name="gwt-compile" depends="compile">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<path refid="project.classpath"/>
<pathelement location="src/"/>
<pathelement location="bin/"/>
</classpath>
<jvmarg value="-Xmx512M"/>
<arg value="${module.name}"/>
</java>
</target>
Anything wrong with the above Ant-script?
module.name = nl.company.projects.X and the path with refid="project.classpath" contains all used libraries aswell as the GWT libraries (gwt-user.jar, gwt-dev.jar and validation-api-1.0.0.GA(-source).jar).
The XMain class inherits nothing (other than from Object) and only implements EntryPoint (which is included in the gwt-user.jar). So I do not think the problem is related to the second hint that the compiler gives.
Any ideas?
GWT requires you to javac your classes, it needs both the *.java and the *.class files.
This has not always been the case, and should change back in the future (see https://code.google.com/p/google-web-toolkit/issues/detail?id=7602 for instance), but for now that's the state of affair: you need to javac before you can com.google.gwt.dev.Compiler.
javac -cp "/path/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201211121240-rel-r42/gwt-2.5.0/*:/path/company/projects/pull-compile-deploy/X/X/war/WEB-INF/lib/*" -sourcepath /path/company/projects/pull-compile-deploy/X/X/src /path/company/projects/pull-compile-deploy/X/X/src/nl/company/projects/X.java -d /path/company/projects/pull-compile-deploy/X/X/bin
java -cp "/path/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201211121240-rel-r42/gwt-2.5.0/*:/path/company/projects/pull-compile-deploy/X/X/src:/path/company/projects/pull-compile-deploy/X/X/bin:/path/company/projects/pull-compile-deploy/X/X/war/WEB-INF/lib/*" com.google.gwt.dev.Compiler nl.company.projects.X
(please double-check the above commands before use)
EDIT: (in response to your "question" re. the X.gwt.xml): GWT expects the X.gwt.xml at nl/company/projects/X.gwt.xml because that's what you told it to use: module.name = nl.company.projects.x. If the file is at nl/company/projects/X/X.gt.xml then use nl.company.projects.X.X as the module name. Using a symbolic link here is likely to be the problem: the source path for the module (search for <source at https://developers.google.com/web-toolkit/doc/latest/DevGuideOrganizingProjects#DevGuideModuleXml) will then be nl/company/projects/client and thus won't include nl/company/projects/X/client where your XMain class lives; it's this unavailable to the GWT compiler.
That said, I totally agree with SSR: use a decent build tool: Ant, Maven, Gradle, Make, whatever, it'll make your life so much easier. A build tool that manages dependencies (Ant+Ivy, Maven, Gradle) is even better IMO.
Why would you put yourself through such non-standard build exercise like this.
If it is non-academic project then USE maven. If you find maven difficult then use ant.
Examples for both type are provided by GWT team - http://code.google.com/p/google-web-toolkit/source/browse/#svn%2Ftrunk%2Fsamples.
Note - maven has plugins to do most of the stuff you are trying in standardized way.
For the life of me, I am trying to get FindBugs (2.0.1) to run as part of my command-line Ant build. I downloaded the FindBugs JAR and extracted it to /home/myuser/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1:
As you can see in the screenshot, under /home/myuser/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1/lib there is a JAR called bcel-1.0.jar, and if you open it, you can see that I have drilled down to a class called org.apache.bcel.classfile.ClassFormatException. Hold that thought.
I then copied /home/myuser/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1/lib/findbugs-ant.jar to ${env.ANT_HOME}/lib to make it accessible to the version of Ant that is ran from the command-line (instead of the Ant instance that comes built-into Eclipse).
My project directory structure is as follows:
/home/myuser/sandbox/workbench/eclipse/workspace/myapp/
src/
main/
java/
test/
java/
build/
build.xml
build.properties
gen/
bin/
main/ --> where all main Java class files compiled to
test/ --> where all test Java class files compiled to
audits/
qual/
staging/
Inside build.xml:
<project name="myapp-build" basedir=".." default="package"
xmlns:fb="antlib:edu.umd.cs.findbugs">
<path id="findbugs.source.path">
<fileset dir="src/main/java">
<include name="**.*java"/>
</fileset>
<fileset dir="src/main/test">
<include name="**.*java"/>
</fileset>
</path>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
uri="antlib:edu.umd.cs.findbugs"/>
<!-- Other Ant target omitted for brevity. -->
<target name="run-findbugs">
<!-- Create a temp JAR that FindBugs can use for analysis. -->
<property name="fb.tmp.jar" value="gen/staging/${ant.project.name}-findbugs-temp.jar"/>
<echo message="Creating ${fb.tmp.jar} for FindBugs."/>
<jar destfile="gen/staging/${ant.project.name}-findbugs-temp.jar">
<fileset dir="gen/bin/main" includes="**/*.class"/>
<fileset dir="gen/bin/test" includes="**/*.class"/>
</jar>
<echo message="Conducting code quality tests with FindBugs."/>
<fb:findbugs home="/home/myuser/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1"
output="html" outputFile="gen/audits/qual/findbugs.html" stylesheet="fancy-hist.xsl" failOnError="true">
<sourcePath refid="findbugs.source.path"/>
<class location="${fb.tmp.jar}"/>
</fb:findbugs>
</target>
<target name="echoMsg" depends="run-findbugs">
<echo message="The build is still alive!!!"/>
</target>
</project>
But when I run ant -buildfile build.xml echoMsg from the command-line, I get an error in FindBugs:
run-findbugs:
[echo] Creating gen/staging/myapp-build-findbugs-temp.jar for FindBugs.
[jar] Building jar: /home/myuser/sandbox/workbench/eclipse/workspace/myapp/gen/staging/myapp-build-findbugs-temp.jar
[echo] Conducting code quality tests with FindBugs.
[fb:findbugs] Executing findbugs from ant task
[fb:findbugs] Running FindBugs...
[fb:findbugs] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/bcel/classfile/ClassFormatException
[fb:findbugs] Caused by: java.lang.ClassNotFoundException: org.apache.bcel.classfile.ClassFormatException
[fb:findbugs] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[fb:findbugs] at java.security.AccessController.doPrivileged(Native Method)
[fb:findbugs] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[fb:findbugs] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[fb:findbugs] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[fb:findbugs] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[fb:findbugs] Could not find the main class: edu.umd.cs.findbugs.FindBugs2. Program will exit.
[fb:findbugs] Java Result: 1
[fb:findbugs] Output saved to gen/audits/qual/findbugs.html
echoMsg:
[echo] The build is still alive!!!
Here's what has me amazed:
Even with failOnError="true", FindBugs is not halting the build even when this runtime exception is encountered
The last piece of output "Output saved to gen/audits/qual/findbugs.html" is a lie! There is nothing in gen/audits/qual!
The bcel-1.0.jar is absolutely under FindBugs home, just like every other JAR in the lib/ directory.
Please note: the findbugs-ant.jar is definitely copied to ANT_HOME/lib; otherwise I would be getting a failed build complaining that it couldn't find the Ant tasks. As a sanity check, I went ahead and did this (I deleted the findbugs-ant.jar from ANT_HOME/lib and got a failed build). This build doesn't fail (it succeeds!). It just doesn't run findbugs.
Can anyone spot what is going on here? Thanks in advance!
You can debug where BCEL is being loaded from using the -verbose:class argument to the jvm.
To pass this argument to the jvm running findbugs, use the jvmargs flag on the find bugs plugin
jvmargs
Optional attribute. It specifies any arguments that should be
passed to the Java virtual machine used to run FindBugs. You may need
to use this attribute to specify flags to increase the amount of
memory the JVM may use if you are analyzing a very large program.
How did you populate the find bugs lib jar? When I download findbugs.zip, I get a lib directory which looks very different than what you show. In particular, mine contains a bcel with a version of 5.3, not 1.0 as you show.
Funny thing because I am using the same version of Findbugs and the jar file is named bcel.jar not bcel-1.0.jar. I am also running Findbugs from an Ant script. As crazy as it might sound, try to download the Findbugs once again, unpack it in the place of your current one and run your script once again.
My guess is that you actually have BCEL in the classpath twice. And the file is being loaded from the jar outside the FindBugs library. Then, when FindBugs tries to load the jar, it finds the BCEL in the FindBugs library and cannot load it, because it's already loaded.
The solution would be to find where else BCEL exists in the classpath and remove it.
You might have to define a AuxClasspath to include the classpath that your <javac> task used when compiling your class files.
You don't show how the compile took place, so I am assuming your created a compile.classapath classpath reference:
<javac destdir="gen/bin/main"
srcdir="src/main/java"
classpathref="compile.classpath"/>
<fb:findbugs home="/home/myuser/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1"
output="html" outputFile="gen/audits/qual/findbugs.html" stylesheet="fancy-hist.xsl" failOnError="true">
<auxClasspath refid="compile.classpath"/>
<sourcePath refid="findbugs.source.path"/>
<class location="${fb.tmp.jar}"/>
</fb:findbugs>
I don't see from your Ant script that bcel is landing on any classpath that the findbugs task would be able to load it from. You might want to try making your taskdef explicitly include everything findbugs needs.
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
uri="antlib:edu.umd.cs.findbugs">
<classpath>
<fileset dir="/home/java/repo/umd/findbugs/2.0.1/findbugs-2.0.1">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
most classpath problems you can debug with tattle. it will report you all jars in your project. all duplicated classes etc. saved me a lot of time.
there is also ant task ready: http://docs.jboss.org/tattletale/userguide/1.2/en-US/html/ant.html
I am experiencing this problem where if I start my server application as a forked Java task , it works fine (but annoyingly grabs the System.in() input) but when I try to run the Java task as unforked (in order to retain the system input), it cant find some of the classes ( specifically a javax ssl package).
Is this an issue where I need to include a task argument like includeJavaRuntime="true" or something? This error suggests to me that the classloader is different when non-forked.
Yes, it's a classloader problem. Most likely the jar you need is missing from the system classpath.
It's actually safer to always run Java processes in a separate thread, using a classpath you provide and specify for them.
<path id="classpath.id">
<fileset ...
</path>
<java fork="true" classpathref="classpath.id" ....