Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 97865 - LinkageError while compiling simple webservice
LinkageError while compiling simple webservice
Product: webservices
Classification: Unclassified
Component: Code
All All
: P1 (vote)
: 5.x
Assigned To: Milan Kuchtiak
Depends on:
  Show dependency treegraph
Reported: 2007-03-14 16:36 UTC by pcmreddy
Modified: 2007-03-21 15:01 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT

build-impl.xml (45.29 KB, text/plain)
2007-03-14 19:40 UTC, pcmreddy
proposed patch (3.83 KB, patch)
2007-03-16 14:52 UTC, Lukas Jungmann
Details | Diff
complete patch for trunk (6.05 KB, application/octet-stream)
2007-03-16 15:35 UTC, Lukas Jungmann
complete patch for trunk (6.05 KB, patch)
2007-03-16 15:35 UTC, Lukas Jungmann
Details | Diff
build-impl.xsl from netbeans_home/enterprise3/modules/org-netbeans-modules-web-project.jar (124.91 KB, text/xml)
2007-03-20 11:42 UTC, Milan Kuchtiak

Note You need to log in before you can comment on or make changes to this bug.
Description pcmreddy 2007-03-14 16:36:22 UTC
Build : 20070311 with JDK 1.6 on XP.

Created simple Webapplication.
Add a webservice with all default values.
add an operation which accepts a string and returns a string.
Fix javadoc issues in editor.
Now compile the web project.

Observe the following exception in out put window.
Exception in thread "main" java.lang.LinkageError: JAXB 2.0 API is being loaded
from the bootstrap classloader, but this RI (from
needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the
bootstrap classloader. (See
        at com.sun.xml.bind.v2.ContextFactory.createContext(
        at com.sun.xml.bind.api.JAXBRIContext.newInstance(
        at Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.lang.reflect.Method.invoke(
Comment 1 Lukas Jungmann 2007-03-14 16:55:56 UTC
Can you attach build-impl.xml from your project (or whole nbproject dir), please?
Comment 2 pcmreddy 2007-03-14 19:39:27 UTC
In this case IDE is configured with Tomcat only.
There is no appserver is configured in runtime.

Comment 3 pcmreddy 2007-03-14 19:40:51 UTC
Created attachment 39490 [details]
Comment 4 Lukas Jungmann 2007-03-14 22:18:26 UTC
Thanks for the additional steps.

Anyway, I still cannot reproduce it. It works fine for me using latest trunk
build (the one from on both platforms (XP,
ubuntu) with jdk6u1-b03.

My project (webapp w/ simple ws for bundled tomcat) builds correctly and during
the deployment I can see following expected message in the output from Tomcat:

Mar 14, 2007 10:05:41 PM contextInitialized
SEVERE: WSSERVLET11: failed to parse runtime descriptor: java.lang.LinkageError:
JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from
needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the
bootstrap classloader. (See
To use JAX-WS 2.1 with JDK 6, newer versions of API jars need to be in bootclasspath
before rt.jar. To do this you can use Java endorsed mechanism to override what is in
Java platform. The easiest way to do so is to set the system environment variable

Can you try the latest bits as well, please?
Comment 5 Lukas Jungmann 2007-03-14 22:30:16 UTC
Also I don't see any important differences in our build scripts, weird. Maybe
you don't have jaxws.endorsed.dir property set correctly in project or private
Comment 6 pcmreddy 2007-03-14 22:34:26 UTC
I did not set any properties. Is it necessary to set the property
"jaxws.endorsed.dir" to compile a webservice in NetBeans? if so where do I need
to set this property and what value I should use for this property.

Comment 7 Lukas Jungmann 2007-03-14 22:40:38 UTC
It should be set automatically by the IDE, you should be able to find it in
$PRJ_DIR/nbproject/private/ and it should point to
$NB_HOME/ide8/modules/ext/jaxws21/api. If you have it there, try to replace "/"
with "\\".

BTW: Isn't there a space in path to your NetBeans installation?
Comment 8 pcmreddy 2007-03-14 22:45:51 UTC
My NB installation is : "G:\downloads\NB6\NetBeans 6.0 Dev" .
I guess NB Installer creates install path with spaces.

Comment 9 Lukas Jungmann 2007-03-14 22:59:59 UTC
Bingo! The space in path is the cause.

I will have a patch for this in a while, hope that Milan will apply it soon ;)
Comment 10 Lukas Jungmann 2007-03-14 23:15:21 UTC
BTW: pcm: thanks for catching this! :)
Comment 11 Lukas Jungmann 2007-03-16 14:51:26 UTC
I'm attaching a patch for this.

Note that space in path is handled differently by "compilerarg" nested element
of javac task and "jvmarg" nested element of ws{gen|import} tasks therefore I
couldn't simply put the value in the properties file into double apostrophes.

The same problem is also in 5.5.1 and we should fix this there as well. Rico,
Milan please review and eventually apply attached patch.

Jardo, please, verify.

Comment 12 Lukas Jungmann 2007-03-16 14:52:20 UTC
Created attachment 39586 [details]
proposed patch
Comment 13 Lukas Jungmann 2007-03-16 15:35:12 UTC
Created attachment 39589 [details]
complete patch for trunk
Comment 14 Lukas Jungmann 2007-03-16 15:35:51 UTC
Created attachment 39590 [details]
complete patch for trunk
Comment 15 Lukas Jungmann 2007-03-16 15:37:41 UTC
Please, use the latest patch (the first does not fix all project types, the
second has incorrect mime-type), sorry for confusion.
Comment 16 Jaroslav Pospisil 2007-03-16 15:52:28 UTC
New patch works O.K.
Comment 17 Milan Kuchtiak 2007-03-19 14:32:18 UTC
Fixed for 6.0.

Thank you for the patch. I used it to implement changes for build-impl.xsl files.

However, I used the InstalledFileLocator to resolve endorsed directory in
WSUtils:getJaxWsApiDir() method.

See :

All changes:

new revision: 1.5; previous revision: 1.4

/cvs/websvc/jaxwsmodel/nbproject/project.xml,v  <--  project.xml
new revision: 1.6; previous revision: 1.5

 <--  build-impl.xsl
new revision: 1.117; previous revision: 1.116

 <--  build-impl.xsl
new revision: 1.65; previous revision: 1.64

 <--  build-impl.xsl
new revision: 1.9; previous revision: 1.8

 <--  build-impl.xsl
new revision: 1.84; previous revision: 1.83
Comment 18 Roderico Cruz 2007-03-20 08:46:35 UTC
Fix looks good. Kindly implement in 5.5.1
Comment 19 Jaroslav Pospisil 2007-03-20 11:08:52 UTC
Fix caused another problems, line 
"<compilerarg line="-Djava.endorsed.dirs=${jaxws.endorsed.dir}"/>" in
build-impl.xml is missing apostrophes.

Compiling 6 source files to C:\Documents and Settings\Telco\My
javac: invalid flag: Files\NetBeans
Usage: javac <options> <source files>
use -help for a list of possible options
C:\Documents and Settings\Telco\My
Documents\NetBeansProjects\WebApplication11\nbproject\build-impl.xml:320: The
following error occurred while executing this line:
C:\Documents and Settings\Telco\My
Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
Comment 20 Milan Kuchtiak 2007-03-20 11:38:09 UTC
Yes, I applied incorrectly the Lukas Patch.
Here is the correction :
Comment 21 Milan Kuchtiak 2007-03-20 11:42:26 UTC
Created attachment 39682 [details]
build-impl.xsl from netbeans_home/enterprise3/modules/org-netbeans-modules-web-project.jar
Comment 22 Jaroslav Pospisil 2007-03-20 12:59:55 UTC
Corrected jar works fine.
Comment 23 Milan Kuchtiak 2007-03-20 16:02:04 UTC
Checked into 551 :

new revision:; previous revision:

/cvs/websvc/jaxwsmodel/nbproject/project.xml,v  <--  project.xml
new revision:; previous revision:

 <--  build-impl.xsl
new revision:; previous revision:

 <--  build-impl.xsl
new revision:; previous revision:

 <--  build-impl.xsl
new revision:; previous revision:

 <--  build-impl.xsl
new revision:; previous revision:
Comment 24 Jaroslav Pospisil 2007-03-21 15:01:44 UTC
VERIFIED in 20070320-1724

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo