Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 175436 - [68cat] JAXB not working
[68cat] JAXB not working
Product: webservices
Classification: Unclassified
Component: JAXB
PC Windows 7 x64
: P2 with 2 votes (vote)
: 6.x
Assigned To: issues@webservices
: 179956 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2009-10-26 15:26 UTC by Peter Nabbefeld
Modified: 2013-04-01 07:54 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT

Simple project tried with NB 6.8 nightly build (32.96 KB, application/x-compressed)
2009-10-29 01:34 UTC, _ gmpatil

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Nabbefeld 2009-10-26 15:27:01 UTC
[ JDK VERSION : 1.6.* ]

Cannot see how to resolve conflict between JAXB from JDK1.6 and JAXB2.2. I've tried different project configuration
(with or without adding JAXB2.2 library), but always get errors (searched with google, found implementation conflict as
the problem, but no solution :( ). Also couldn't find any option to set JAXB as endorsed lib.

Thus, JAXB is currently not usable at all.
There should be an option, which implementation to use.

As this doesn't work *completely*, setting prio to 1. IMHO, JAXB is sth. that ought to work properly in an IDE which
has started as "Forte for Java".
Comment 1 Michael Nazarov 2009-10-27 10:44:56 UTC
Would you please provide more details? Some steps to reproduce,
logs, screenshots.

Thank you.
Comment 2 Peter Nabbefeld 2009-10-27 10:59:18 UTC
Getting this output when trying to generate jaxb classes:

Compiling file:.../xml-resources/jaxb/Semiramis_0901/my.xsd
        at $Proxy35.required(Unknown Source)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
        at java.lang.reflect.Constructor.newInstance(
        at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
Caused by: java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required()
        at java.lang.Class.getDeclaredMethod(
        at com.sun.codemodel.TypedAnnotationWriter.invoke(
        ... 36 more
BUILD FAILED (total time: 10 seconds)

Google says that this error message is the result of a jaxb version conflict. NetBeans doesn't give me a more detailed
message about why this happens, so I have to trust Google.

There should be some options to select a JAXB version to use (and also for JAX-WS - but it at least has a workaround).
Comment 3 _ gmpatil 2009-10-28 02:55:07 UTC
Can you give below information to reproduce?
- JDK version/Java Platform used. With JDK 1.6 update 13, unable to reproduce.
- Sample project used
- Also what kind of work around you are looking for. 

Did you try to change below property to point to JAXB version you would like to use in nbporject/ ?
Comment 4 Peter Nabbefeld 2009-10-28 10:05:25 UTC
Found at least one configuration problem in


(ide9 instead of ide12)

But it doesn't fix this issue. The properties now are:

with libs.jaxb.classpath=C\:\\Programme\\NetBeans Dev
200910270201\\ide12\\modules\\ext\\jaxb\\activation.jar;C\:\\Programme\\NetBeans Dev
200910270201\\ide12\\modules\\ext\\jaxb\\api\\jaxb-api.jar;C\:\\Programme\\NetBeans Dev
200910270201\\ide12\\modules\\ext\\jaxb\\jaxb-impl.jar;C\:\\Programme\\NetBeans Dev
200910270201\\ide12\\modules\\ext\\jaxb\\jaxb1-impl.jar;C\:\\Programme\\NetBeans Dev
200910270201\\ide12\\modules\\ext\\jaxb\\jaxb-xjc.jar;C\:\\Programme\\NetBeans Dev

(selected output from <echoproperties/>)

Going to clear caches (var/cache and var/filehistory)
Comment 5 Peter Nabbefeld 2009-10-28 10:26:14 UTC
Cleaning the caches didn't help, either :(
Comment 6 Peter Nabbefeld 2009-10-28 10:49:34 UTC
Found already one bug here:
org.netbeans.modules.xml.jaxb.util.ProjectHelper / line 810:
        String ret = "\"${netbeans.home}/../ide9/modules/ext/jaxb/api\""; //NOI18N
(ide9 instead of ide12)

Did You really test with current daily build?
Comment 7 _ gmpatil 2009-10-28 18:53:59 UTC
I tried with JDK 1.6 update 13, using NB 6.7.1. I am not actively involved in NB 6.8, that is the reason for asking for
details on environment used.

Will try to simulate using nb 6.8 build and commit the fix.
Comment 8 _ gmpatil 2009-10-29 01:32:47 UTC
Tried with NB 6.8 nightly build1[1]  with attached simple project in/with JDK 1.6.0_16, unable to reproduce the error.
Even the "ide9" in endorsed property though wrong did not any effect while running the Hello class.

Please attach non-proprietary project to simulate this issue.

Product Version: NetBeans IDE Dev (Build 200910280201)
Java: 1.6.0_16; Java HotSpot(TM) Client VM 14.2-b01
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Documents and Settings\gpatil\.netbeans\dev

[2] jaxbwiz.endorsed.dirs="${netbeans.home}/../ide9/modules/ext/jaxb/api"
Comment 9 _ gmpatil 2009-10-29 01:34:47 UTC
Created attachment 90191 [details]
Simple project tried with NB 6.8 nightly build
Comment 10 Peter Nabbefeld 2009-10-29 15:25:20 UTC
Just a little change in line 9 results in the error:
    <xsd:element name="ssn" minOccurs="0" nillable="true" type="xsd:string"></xsd:element>

I've found out, this should result in a declaration like
protected JAXBElement<String> ssn;

Further, it usually seems to work (googled for "nillable jaxb" and found a question about this behavior, so somebody
must have been able to produce this).

So, the question is:
Does JAXB need a parameter to be set, and why isn't it set by the JAXB module?
Comment 11 _ gmpatil 2009-10-29 19:51:53 UTC
How is this Netbeans JAXB Wizard issue? 
I see JAXB RI issue for this at .
Is it not this a JAXB RI issue?

What parameter JAXB Wizard should pass to XJC?

Comment 12 _ gmpatil 2009-10-29 22:53:36 UTC
As mentioned in JAXB RI issue[1] as a work around, copied the JAXB API jar to <JRE 1.6>/lib/endorsed/ directory. Able to
build the project with the Schema file changed as suggested. Also able to run the Hello class by changing code (note not
a Netbeans module issue) as below.

cq.setSsn(new JAXBElement(new QName("", "ssn"), String.class, "12345678"));

If there is an work which we can implement in NB tooling, please file separate enhancement ticket.

Comment 13 Peter Nabbefeld 2009-10-30 08:28:39 UTC
No. It's not the same bug - there's no "nillable='true'"
Comment 14 Milan Kuchtiak 2009-11-09 05:58:28 UTC
Problems with endorsed libraries can be solved by setting the 
endorsed.classpath property in file.


Note, in Java EE 6 web/ejb projects the property is set up automatically:

Comment 15 Peter Nabbefeld 2009-11-09 08:19:37 UTC
Editing is a hack, not a solution. If the property has to be edited, it's the task of the JAXB module to solve this, not the user's one.
Comment 16 marianomd 2009-12-16 13:45:10 UTC
Same problem here with Netbeans 6.8.

When trying to compile I get:

java.lang.NoClassDefFoundError: de
Caused by: java.lang.ClassNotFoundException: de
        at Method)
        at java.lang.ClassLoader.loadClass(
        at sun.misc.Launcher$AppClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        at java.lang.ClassLoader.loadClassInternal(
Could not find the main class: de.  Program will exit.
Exception in thread "main" Java Result: 1

After removing this line:

jaxbwiz.endorsed.dirs=C:\\Archivos de programa\\NetBeans 6.8\\ide12\\modules\\ext\\jaxb\\api

from nbproject\private\ 

everything works OK, but Netbeans keeps adding that line afterwards.
Comment 17 _ henriquemeira 2009-12-16 18:27:20 UTC
I've a collection of webservices that worked fine on Netbeans 6.7.1! Since I updated to 6.8 I got this error:

"You are running on JDK6 which comes with JAX-WS 2.1 API, but this tool requires JAX-WS 2.2 API. Use the endorsed standards override mechanism (, or set xendorsed="true" on <wsimport>."

I set xendorsed=true (in properties of webservice reference), and generates without errors, but it don't work, I get the exception: 

" Cannot find '' wsdl. Place the resource correctly in the classpath."

Debugging, I discovered the problem, the "JAX-WS RI 2.2-hudson-752-" generates a diferent code from previous 2.1 version, wich (2.2 version) try to init URL location by this way: 

NFESTATUSSERVICO_WSDL_LOCATION = NfeStatusServico.class.getResource(""); 

This resource is not found. Ie., getResource() returns null value. 

From 2.1 version, the JAX code auto-generated, do the load URL by this form: 

URL url = new URL("") 

Now, until this moment, I don't know how to solve, because, if I edit this generated file, this will work, but if I "clean and build" the project, the NetBeans will regenerate the bad code again.
Comment 18 Milan Kuchtiak 2009-12-17 04:14:03 UTC
I agree the issue is pretty serious.
Please, temporarily, as a workaround, insert this line into nbproject/

Comment 19 Lukas Jungmann 2009-12-17 06:34:27 UTC
this should be fixed for 6.8 patch 1
Comment 20 _ henriquemeira 2009-12-17 16:24:16 UTC
(In reply to comment #18)
> I agree the issue is pretty serious.
> Please, temporarily, as a workaround, insert this line into
> nbproject/
> endorsed.classpath=${libs.jaxb.classpath}

Didn't work.

I inserted the endorsed.classpath=${libs.jaxb.classpath} at end the nbproject/ and I got this compilation exeption: cannot find symbol
symbol  : constructor Service(,javax.xml.namespace.QName,[])
location: class
        super(__getWsdlLocation(), NFESTATUSSERVICO_QNAME, features); cannot find symbol
symbol  : constructor Service(,javax.xml.namespace.QName,[])
location: class

Code taken from

#43 public NfeStatusServico(WebServiceFeature... features){
#44     super(__getWsdlLocation(), NFESTATUSSERVICO_QNAME, features);
#45 }

#51 public NfeStatusServico(URL wsdlLocation, WebServiceFeature... features){
#52     super(wsdlLocation, NFESTATUSSERVICO_QNAME, features);
#53 }

I'm analising the error, but if you have any hint, I'll appreciate.
Comment 21 Milan Kuchtiak 2009-12-18 02:43:23 UTC
It has something to do with web services.

So instead of 

you should use :
(this is added automatically when you create a web service client in your project)


(this is added automatically in JavaEE 6 project types)
Comment 22 Milan Kuchtiak 2009-12-18 09:14:13 UTC

Implemented JAXB_ENDORSED classpath for projects containing JAXB bindings.

Comment 23 _ henriquemeira 2009-12-18 19:00:27 UTC
Hello, didn't work.

Maybe you prefer I open a new issue, but this


do not solved the problem.

As I said before, the problem is on URL class load.

The jax-ws source generated of the JAX-WS RI 2.2-hudson-752- makes use of the follow code to initiate the URL object:

// Sample:
NFESTATUSSERVICO_WSDL_LOCATION = package.MyWebService.class.getResource("https://myserverwebservice/mywebservice.asmx?wsdl");

I discovered that this problem happen just with remote webservices, ie, schemas did catch from HTTP or HTTPS protocols. If I use a local wsdl schema file, this error does not happen, ie, with schemas from file with FILE:// protocol.

I do return to NetBeans 6.7.1 and all works fine. The NB 6.7.1 do use JAX-WS RI 2.1, wich initiate the URL object by this way:

URL url = new URL("https://myserverwebservice/mywebservice.asmx?wsdl");

I think so the problem is in getResource method from generated class MyWebService, wich cannot found the resource.

Running the project, I got this error message: Cannot find 'https://https://myserverwebservice/mywebservice.asmx?wsdl' wsdl. Place the resource correctly in the classpath.
        at package.MyWebService.<clinit>(

Exactly in the getResource method! 

I'll attempt to found a public webservice to reproduce a step-by-step tutorial.

Comment 24 Quality Engineering 2009-12-19 00:25:22 UTC
Integrated into 'main-golden', will be available in build *200912190200* on (upload may still be in progress)
Log: #175436: add JAXB-ENDORSE classpath to projects containing JAXB bindings, remove obsolete code
Comment 25 Milan Kuchtiak 2009-12-21 01:40:09 UTC
Peter, please, open a new issue for your problem, with the detailed steps to reproduce. Your problem is related more to JAX-WS not JAXB, isn't it ?
The original - JAXB problem related to endorsed mechanism was fixed.

Actually, I am a little bit lost what's your problem. The best would be to attach the wsdl file to that new issue. 
Thank You.
Comment 26 Milan Kuchtiak 2009-12-21 06:31:09 UTC
One another fix (incorrect test statement):

Note: this is just code cleanup for JAXB support.
Comment 27 Quality Engineering 2009-12-21 23:39:39 UTC
Integrated into 'main-golden', will be available in build *200912220201* on (upload may still be in progress)
Log: #175436: fixing incorrect if statement
Comment 28 Jaroslav Pospisil 2010-01-12 01:56:01 UTC
Comment 29 pgebauer 2010-01-14 02:50:49 UTC
The fix has been ported into the release68_fixes repository.
Comment 30 Milan Kuchtiak 2010-02-08 10:30:43 UTC
*** Bug 179956 has been marked as a duplicate of this bug. ***
Comment 31 stefvz1 2013-03-26 02:24:59 UTC
when, i can see that in release 7.3 are still problems with jaxb 2.0... When I'm generating the asynchronous web service client in GUI application, IDE generate me web service classes with  
@XmlElementRef(name = "DSAKeyValue", namespace = "", type = JAXBElement.class, required = false),

... Unfortunetly Netbeans doesn't support jaxb 2.2. so I'm getting error in part of required method cause XmlElementRef is from 2.0 api and generated method is related against 2.2. api.. I used Jaxb 2.2.5 library module from netbeans but still with no sucess.. Any other suggestions ?
Comment 32 Sergey Petrov 2013-04-01 07:54:28 UTC
I'm not sure it was good idea to reopen two years old issue, please file new one instead.
This one issue is also about 2.2 and is not about 2.0, if you are referring diffeent issues in your comment, please file several issues also (one for "problems with jaxb 2.0", another for "Netbeans doesn't support jaxb 2.2. so I'm getting error in" etc. if necessary).
close this one back as fixed for a few releases and restore some other fields.

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