Bug 97865 - LinkageError while compiling simple webservice
LinkageError while compiling simple webservice
Status: VERIFIED FIXED
Product: webservices
Classification: Unclassified
Component: Code
5.x
All All
: P1 (vote)
: 5.x
Assigned To: Milan Kuchtiak
issues@webservices
551_HR_FIX
: SPACE_IN_PATH
Depends on:
Blocks:
  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
:


Attachments
build-impl.xml (45.29 KB, text/plain)
2007-03-14 19:40 UTC, pcmreddy
Details
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
Details
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
Details

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
jar:file:/G:/downloads/NB6/NetBeans%206.0%20Dev/ide8/modules/ext/jaxws21/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class)
needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the
bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
        at
com.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>(ModelBuilder.java:135)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:389)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:253)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:84)
        at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:86)
        at
com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:126)
        at
com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:125)
        at java.security.AccessController.doPrivileged(Native Method)
        at
com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:124)
        at
com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:63)
        at
com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:229)
        at com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:185)
        at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:89)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.ws.Invoker.WsgenMain(Invoker.java:115)
        at com.sun.tools.ws.WsGen.main(WsGen.java:38)
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]
build-impl.xml
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 http://deadlock.nbextras.org/hudson/) 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
com.sun.xml.ws.transport.http.servlet.WSServletContextListener 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
jar:file:/D:/NetBeansProjects/WebApplication1/build/web/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class)
needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the
bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
**************************************WARNING***************************************
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
JAVA_ENDORSED_DIRS=D:\test\netbeans\ide8\modules\ext\jaxws21\api.
************************************************************************************
..."

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
properties...
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/private.properties 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.

Thanks.
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 :
http://websvc.netbeans.org/source/browse/websvc/jaxwsmodel/src/org/netbeans/modules/websvc/api/jaxws/project/WSUtils.java?r1=1.4&r2=1.5

All changes:

/cvs/websvc/jaxwsmodel/src/org/netbeans/modules/websvc/api/jaxws/project/WSUtils.java,v
 <--  WSUtils.java
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

/cvs/web/project/src/org/netbeans/modules/web/project/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.117; previous revision: 1.116

/cvs/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.65; previous revision: 1.64

/cvs/j2ee/clientproject/src/org/netbeans/modules/j2ee/clientproject/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.9; previous revision: 1.8

/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl,v
 <--  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.
Reopening. 

deps-ear-jar:
deps-jar:
wsimport-init:
wsimport-client-check-SearchWS.asmx:
wsimport-client-SearchWS.asmx:
wsimport-client-generate:
wsimport-client-compile:
Compiling 6 source files to C:\Documents and Settings\Telco\My
Documents\NetBeansProjects\WebApplication11\build\web\WEB-INF\classes
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
Documents\NetBeansProjects\WebApplication11\nbproject\build-impl.xml:149:
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 :
http://web.netbeans.org/source/browse/web/project/src/org/netbeans/modules/web/project/resources/build-impl.xsl?r1=1.117&r2=1.118
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 :

/cvs/websvc/jaxwsmodel/src/org/netbeans/modules/websvc/api/jaxws/project/WSUtils.java,v
 <--  WSUtils.java
new revision: 1.1.2.17.10.3; previous revision: 1.1.2.17.10.2

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

/cvs/web/project/src/org/netbeans/modules/web/project/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.100.12.6.2.53.6.2; previous revision: 1.100.12.6.2.53.6.1

/cvs/j2ee/clientproject/src/org/netbeans/modules/j2ee/clientproject/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.1.4.25.8.4; previous revision: 1.1.4.25.8.3

/cvs/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.49.16.4.2.30.8.2; previous revision: 1.49.16.4.2.30.8.1

/cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.58.2.5.2.12.6.2; previous revision: 1.58.2.5.2.12.6.1
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. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo