This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
[ 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".
Would you please provide more details? Some steps to reproduce, logs, screenshots. Thank you.
Getting this output when trying to generate jaxb classes: xjc-typedef-target: jaxb-code-generation: Compiling file:.../xml-resources/jaxb/Semiramis_0901/my.xsd ...\xml_binding_build.xml:17: java.lang.reflect.UndeclaredThrowableException at $Proxy35.required(Unknown Source) at com.sun.tools.xjc.generator.bean.field.AbstractField.annotateReference(AbstractField.java:187) at com.sun.tools.xjc.generator.bean.field.AbstractField.annotate(AbstractField.java:156) at com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.createField(AbstractFieldWithVar.java:75) at com.sun.tools.xjc.generator.bean.field.SingleField.<init>(SingleField.java:89) at com.sun.tools.xjc.generator.bean.field.SingleField.<init>(SingleField.java:76) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.sun.tools.xjc.generator.bean.field.GenericFieldRenderer.generate(GenericFieldRenderer.java:64) at com.sun.tools.xjc.generator.bean.field.DefaultFieldRenderer.generate(DefaultFieldRenderer.java:79) at com.sun.tools.xjc.generator.bean.BeanGenerator.generateFieldDecl(BeanGenerator.java:747) at com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassBody(BeanGenerator.java:535) at com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:235) at com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:175) at com.sun.tools.xjc.model.Model.generateCode(Model.java:286) at com.sun.tools.xjc.XJC2Task._doXJC(XJC2Task.java:494) at com.sun.tools.xjc.XJC2Task.doXJC(XJC2Task.java:434) at com.sun.tools.xjc.XJC2Task.execute(XJC2Task.java:369) at com.sun.istack.tools.ProtectedTask.execute(ProtectedTask.java:55) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189) at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:278) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:498) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151) Caused by: java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required() at java.lang.Class.getDeclaredMethod(Class.java:1937) at com.sun.codemodel.TypedAnnotationWriter.invoke(TypedAnnotationWriter.java:107) ... 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).
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/project.properties ? jaxbwiz.endorsed.dirs=${newJAXBJarDir} jaxbwiz.gensrc.classpath=${newJAXBJars} jaxbwiz.xjcdef.classpath=${newJAXBJars} jaxbwiz.xjcrun.classpath=${newJAXBJars}
Found at least one configuration problem in project.properties: jaxbwiz.endorsed.dirs="${netbeans.home}/../ide9/modules/ext/jaxb/api" (ide9 instead of ide12) But it doesn't fix this issue. The properties now are: jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api" jaxbwiz.gensrc.classpath=${libs.jaxb.classpath} jaxbwiz.xjcdef.classpath=${libs.jaxb.classpath} jaxbwiz.xjcrun.classpath=${libs.jaxb.classpath} 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 200910270201\\ide12\\modules\\ext\\jaxb\\api\\jsr173_api.jar (selected output from <echoproperties/>) Going to clear caches (var/cache and var/filehistory)
Cleaning the caches didn't help, either :(
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?
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.
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. [1] 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"
Created attachment 90191 [details] Simple project tried with NB 6.8 nightly build
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?
How is this Netbeans JAXB Wizard issue? I see JAXB RI issue for this at https://jaxb.dev.java.net/issues/show_bug.cgi?id=692 . Is it not this a JAXB RI issue? What parameter JAXB Wizard should pass to XJC?
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("http://xml.netbeans.org/schema/CreditReport", "ssn"), String.class, "12345678")); If there is an work which we can implement in NB tooling, please file separate enhancement ticket. [1] https://jaxb.dev.java.net/issues/show_bug.cgi?id=692
No. It's not the same bug - there's no "nillable='true'"
Problems with endorsed libraries can be solved by setting the endorsed.classpath property in project.properties file. e.g. endorsed.classpath=my_path/jaxb-api.jar:my_path/jaxws-api.jar,... Note, in Java EE 6 web/ejb projects the property is set up automatically: endorsed.classpath=${libs.javaee-endorsed-api-6.0.classpath}
Editing project.properties 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.
Same problem here with Netbeans 6.8. When trying to compile I get: java.lang.NoClassDefFoundError: de Caused by: java.lang.ClassNotFoundException: de at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) 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\private.properties everything works OK, but Netbeans keeps adding that line afterwards.
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 (http://java.sun.com/javase/6/docs/technotes/guides/standards/), 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: "javax.xml.ws.WebServiceException: Cannot find 'https://nfe.fazenda.sp.gov.br/nfeweb/services/nfestatusservico.asmx?wsdl' 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("https://nfe.fazenda.sp.gov.br/nfeweb/services/nfestatusservico.asmx?wsdl"); 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("https://nfe.fazenda.sp.gov.br/nfeweb/services/nfestatusservico.asmx?wsdl") 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.
I agree the issue is pretty serious. Please, temporarily, as a workaround, insert this line into nbproject/project.properties: endorsed.classpath=${libs.jaxb.classpath}
this should be fixed for 6.8 patch 1
(In reply to comment #18) > I agree the issue is pretty serious. > Please, temporarily, as a workaround, insert this line into > nbproject/project.properties: > > endorsed.classpath=${libs.jaxb.classpath} Didn't work. I inserted the endorsed.classpath=${libs.jaxb.classpath} at end the nbproject/project.properties and I got this compilation exeption: ...NfeStatusServico.java:44: cannot find symbol symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[]) location: class javax.xml.ws.Service super(__getWsdlLocation(), NFESTATUSSERVICO_QNAME, features); ...NfeStatusServico.java:52: cannot find symbol symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[]) location: class javax.xml.ws.Service Code taken from NfeStatusServico.java: #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.
It has something to do with web services. So instead of endorsed.classpath=${libs.jaxb.classpath} you should use : endorsed.classpath=${libs.JAX-WS-ENDORSED.classpath} (this is added automatically when you create a web service client in your project) or endorsed.classpath=${libs.javaee-endorsed-api-6.0.classpath} (this is added automatically in JavaEE 6 project types)
Fixed. Implemented JAXB_ENDORSED classpath for projects containing JAXB bindings. Details: http://hg.netbeans.org/main/rev/fc4a7af7418c
Hello, didn't work. Maybe you prefer I open a new issue, but this endorsed.classpath=${libs.JAX-WS-ENDORSED.classpath} or endorsed.classpath=${libs.javaee-endorsed-api-6.0.classpath} 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: javax.xml.ws.WebServiceException: Cannot find 'https://https://myserverwebservice/mywebservice.asmx?wsdl' wsdl. Place the resource correctly in the classpath. at package.MyWebService.<clinit>(MyWebService.java:34) Exactly in the getResource method! I'll attempt to found a public webservice to reproduce a step-by-step tutorial. henrique.
Integrated into 'main-golden', will be available in build *200912190200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/fc4a7af7418c User: mkuchtiak@netbeans.org Log: #175436: add JAXB-ENDORSE classpath to projects containing JAXB bindings, remove obsolete code
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.
One another fix (incorrect test statement): http://hg.netbeans.org/main/rev/49521873de65 Note: this is just code cleanup for JAXB support.
Integrated into 'main-golden', will be available in build *200912220201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/49521873de65 User: mkuchtiak@netbeans.org Log: #175436: fixing incorrect if statement
v.
The fix has been ported into the release68_fixes repository. http://hg.netbeans.org/release68_fixes/rev/604bc914fe57
*** Bug 179956 has been marked as a duplicate of this bug. ***
Hi, 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 = "http://www.w3.org/2000/09/xmldsig#", 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 ?
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.