This content has been marked as final. Show 6 replies
I've used JAXB a little, maybe I can help.
"C:\...\NetBeansProjects\myproject\build.xml:12: Problem: failed to create task or type importOpen up the build.xml file in your editor and tell us what's on line 12. (Or if it's not too big, copy and paste your whole file here, since sometimes errors can be reported on one line, but there's really something wrong with the line before).
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place."
Does anybody know what it's happening? It could be that there is a .jar missing?Not sure. What JARs are you including? When I was testing out JAXB, I included their whole lib, which is:
I don't think all of them are required, but I included them to be on the safe side. E.g., I believe jaxb1-impl.jar is just for support for their 1.0 runtime. So if you're using the 2.x runtime, you don't need that JAR.
Also, what's the command you're using to compile the generated classes?
Sounds like you probably haven't quite configured the JAXB ant task or whatever properly. I've never used it, being a lazy Maven addict and all, but that's my initial guess.
The document build.xml at line 12 says <import file="nbproject/build-impl.xml"/>. The file nbproject / build-impl.xml exists. If you want I could send it to you.
I have included all the .jar you mentioned (excep the jaxb1-imp.jar).
The thing is that I am working with Netbeans 6.5. In this IDE the JAXB Bindings can be done without entering any code. You only have to right click on the project name, select Add JAXB Binding and choose the XML Schema you want to bind. Like one week ago it worked fine. The .java classes were created automatically from the XML Schema, but suddenly this error appeared. And I have not touched anything, the only thing I did was to add other .jars (for other purposes). But anyway I went back to remove this new .jars and the JAXB Binding still doesn't work . Should I uninstall the IDE and re-install? I do not know what else to do ...
Thank you so much for your answers, I'm in a big trouble whit this...
Edited by: Stipebeans on Oct 30, 2009 7:22 AM
The thing is that I am working with Netbeans 6.5Ah ok.. I've only used JAXB with Eclipse and the command-line, so I'm not familiar. What georgemc mentioned sounds most likely to be the issue, though, so if I were you I would try to figure out how to fix your ant task.
Thank you so much for your answers, I'm in a big trouble whit this...The only other thing I can really suggest is to just see if it works from the command-line. I mean, it's really just a matter of typing in:
Edit: Forgot to mention that I'm assuming the JAXB path is configured on your system. If it's not, just copy your schema/xml data to the JAXB /bin/ directory and run the above command from that location.
xjc -p your_package_name your_schema_file_path -d your_output_path
Edited by: ibanezplayer85 on Oct 30, 2009 10:48 AM
The document build.xml at line 12 says <import file="nbproject/build-impl.xml"/>. The file nbproject / build-impl.xml exists. If you want I could send it to you.You could post it here (the build-impl.xml, I mean).
I have a working example, we could compare.
I have included all the .jar you mentioned (excep the jaxb1-imp.jar).?
If you added this JAXB compiling target via NB's wizard, as you describe below, you shouldn't have to "include" whatever jars wich are already in the JDK. That is, if you're using JDK6 - JAXB was not (or not so much) included in the JDK prior to 1.6.
If the JDK is 1.5, I have no idea where you have to add these jars, possibly you're not add them in the correct classpath. Presumably Ant itself would need them in its classpath to be able to define the task.
And I have not touched anythingThey all say that... :o)
the only thing I did was to add other .jars (for other purposes).See?
Is it possible that you removed one of the important jars when doing back-and-forth tries?
But anyway I went back to remove this new .jars and the JAXB Binding still doesn't work .Do you have any reason to believe you did corrupt the JDK or NetBeans's installation? For example, when you write about adding/removing the mentioned jars, did you do that somewhere in the JDK or NB installation?
Should I uninstall the IDE and re-install? I do not know what else to do ...
Other than that, I don't see what reinstalling NB would do.
Without going to such extremes, have you tried simply to remove the JAXBBinding, and add it again in the NetBeans project, using the wizard?
Yes, I am working with Jdk 1.6, so I didn't have to install the .jar's of JAXB, but I meaned that they were already installed. Of course, I had tried to remove the JAXB Bindings and it didn't work. Actually, when removing the JAXB Bidings the error message appeared again.
Ok, well...It seems that the problem has disapeared. I uninstalled the .jar's of Ant 1.4.1 and installed the Ant 1.7.1...Maybe the problem was that I unistalled by accident some .jar of Ant 1.4.1, before...Sorry then, it was obviously my fault, but I was so nervous! and thank you again for your answers!