Recently I wanted to reorganize the jars imported from the weblogic to
our Java EE project. For this I've changed the path and the kind of
included jars. When I had found the minimal set of jars where the
compiler was running without errors I wanted to create a ear file.
Starting the build from eclipse I didn't get an ear file but the
following exception:
[wlappc] java.io.IOException: JDT
compilation error!
[wlappc]
at
weblogic.ejb.container.ejbc.CompilerForJDT.compile(CompilerForJDT.java:66)
[wlappc]
at
weblogic.ejb.container.ejbc.EJBCompiler.doCompile(EJBCompiler.java:357)
[wlappc]
at
weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:552)
[wlappc]
at
weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:490)
[wlappc]
at
weblogic.application.compiler.AppcUtils.compileEJB(AppcUtils.java:306)
[wlappc]
at weblogic.application.compiler.EJBModule.compile(EJBModule.java:128)
Since JDT is the compiler of eclipse I wanted to know if the error
happens also when starting the build from the command line. Using ant
of the local installed Weblogic 10.3.0 I've started the build and it
created the ear without an error.
That's a pretty strange behavior. And as always with strange behaviors
the search on the Internet didn't return much information. Well, it
turned out that there are other people that get this exception but it
is very frustrating to see a forum thread full with posts only to find
out that all the posts are inquiries for help.
So what next? Looking up the jar file where
weblogic.ejb.container.ejbc.CompilerForJDT is I found that there is
also a weblogic.ejb.container.ejbc.CompilerForJavac. The questions
turns into fix the JDT run or force the javac run? Using javac seemed
the better option as it would reduce differences to the build from
command line.
Through the help of javap and JVMS
I was able to find the location where wlappc decided which compiler to
use. It asks the field "compiler" from weblogic.utils.Getopt2. When it
is jdt, the JDT compiler is used, else the javac is used. Looking at
the wlappc
documentation shows that there is a compiler flag. But setting it
to javac didn't help. Instead of solving the problem now builds from
Eclipse and command line throw the following exception:
java.io.IOException: Compiler
failed executable.exec
at
weblogic.utils.compiler.CompilerInvoker.compileMaybeExit(CompilerInvoker.java:435)
at
weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:295)
at
weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:303)
So the compiler flag didn't help. While thinking about the differences
between the eclipse build and the command line build (both use the same
ant build.xml) I've noticed that I use a bat-file from the weblogic
domain to set the ant-Path/Home. This bat-file is setting a lot of
paths and environment variables. So maybe this is setting the right
value. So I've started Eclipse from the command line and requested a
build through Eclipse.
The good news was that the build was successful. But when doing the
cross-check with starting eclipse normal, it turned out that the build
was also running successful. Without changing anything. Maybe it stored
some flags in a kind of internal registry or whatever. The error is
gone but I don't know why. That's a little bit sad.