Solved

javax.xml.namespace does not exist for JAXB application

Posted on 2004-03-25
57
1,303 Views
Last Modified: 2013-11-23
Hi,

 I am trying to run JAXB application
When i am trying to compile, after i generate Java classes using JAXB
I encounterd the following exception

javax.xml.namespace does not exist....

What jar file i suppose to put in my classpath?

Thanks

0
Comment
Question by:mvkraju
  • 26
  • 18
  • 13
57 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 10682363
Put any and all of these in ALL lib\ext folders:

jaxb-api.jar
The javax.xml.bind interfaces and helper classes
jaxb-xjc.jar
The JAXB RI binding compiler classes
jaxb-impl.jar   (formerly named jaxb-ri.jar)
The JAXB RI binding runtime framework classes
jaxb-libs.jar
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10684403
Either add the JAR files themselves to the classpath or (better) put them to the lib\ext folder.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10685863
?!
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10685934
Sorry I thought you said ext\lib
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10685940
:-)
0
 

Author Comment

by:mvkraju
ID: 10686695
I put all the 4 jar files in the classpath.

Still i have javax.xml.namespace  does not found error!!
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10686852
Did you try putting them in lib/ext?

BTW, did you add all the 4 individual JAR files to the class-path, or did you add only their directory to the class-path?

Are you using any app-server? Tomcat, etc don't use System classpath.
0
 

Author Comment

by:mvkraju
ID: 10686864
I am using JDK 1.4.2
actually this javax.xml.namespace.QName is a class in JDK 1.4 and later versions itself.
This class is in the JDK 1.4.2 API also
I don't understand why this compilation error is coming?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10686895
javax.xml.namespace.QName is not in 1.4.2. It could even be an Axis class/interface
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10686915
Not until Java 1.5 is that class in the SDK.
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10686916
The closest packages that I see in the Java doc for J2SE 1.4.2 are:

javax.xml.parsers
javax.xml.transform
javax.xml.transform.dom
javax.xml.transform.sax
javax.xml.transform.stream
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10686928
If you say that it is in the JDK 1.4 (let's assume that you were correct), then which JAR files were you adding to the class-path? Where are those files? Which files are those?
0
 

Author Comment

by:mvkraju
ID: 10686971
I have put the followng things in my classpath

C:\JAVA\j2sdk1.4.2_03\jre\lib\charsets.jar
C:\JAVA\j2sdk1.4.2_03\jre\lib\jce.jar
C:\JAVA\j2sdk1.4.2_03\jre\lib\jsse.jar
C:\JAVA\j2sdk1.4.2_03\jre\lib\plugin.jar
C:\JAVA\j2sdk1.4.2_03\jre\lib\rt.jar
C:\JAVA\j2sdk1.4.2_03\jre\lib\sunrsasign.jar
C:\JAVA\j2sdk1.4.2_03\jre\lib\ext\dnsns.jar
C:\JAVA\j2sdk1.4.2_03\jre\lib\ext\ldapsec.jar
C:\JAVA\j2sdk1.4.2_03\jre\lib\ext\localedate.jar
C:\JAVA\j2sdk1.4.2_03\jre\lib\ext\sunjce_provider.jar

C:\JAVA\jwsdp-1.3\jaxb\lib\jaxb-api.jar
C:\JAVA\jwsdp-1.3\jaxb\lib\jaxb-impl.jar
C:\JAVA\jwsdp-1.3\jaxb\lib\jaxb-libs.jar
C:\JAVA\jwsdp-1.3\jaxb\lib\jaxb-xjc.jar

am i missing anything in the classpath?
may be i need to add some thing to my JDK classpath!
Please help me!

Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10686978
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10686997
Now you've posted that, can you just tell us the output of

echo %CLASSPATH%

btw?
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10687026
The ones in jre\lib\ext need not be in the class-path.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10687067
None of them needs to be actually, apart from the jaxb ones, but let's not jump the gun. Can you post the output of the command mvkraju?
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10687099
I have a feeling that if he tried moving he JARs to lib/ext, it would work.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10687119
That class may not be in those jars
0
 

Author Comment

by:mvkraju
ID: 10687179
C:\>echo %CLASSPATH%
C:\Program Files\IBM\WMQ\Java\lib\providerutil.jar;C:\Program Files\IBM\WMQ\Java
\lib\com.ibm.mqjms.jar;C:\Program Files\IBM\WMQ\Java\lib\ldap.jar;C:\Program Fil
es\IBM\WMQ\Java\lib\jta.jar;C:\Program Files\IBM\WMQ\Java\lib\jndi.jar;C:\Progra
m Files\IBM\WMQ\Java\lib\jms.jar;C:\Program Files\IBM\WMQ\Java\lib\connector.jar
;C:\Program Files\IBM\WMQ\Java\lib\fscontext.jar;C:\Program Files\IBM\WMQ\Java\l
ib\com.ibm.mq.jar;.;C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip;C:\PROGRA~1\IBM\SQLL
IB\java\db2jcc.jar;C:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip;C:\PROGRA~1\IBM\SQLLIB\b
in;C:\PROGRA~1\IBM\SQLLIB\java\common.jar

By the by i am using IntelliJ IDEA IDE.
I guess this classpath does not effect my thing!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10687257
>>By the by i am using IntelliJ IDEA IDE.

Oh well there's not much point in echoing it then, assuming it builds its own classpath. Change to

C:\JAVA\jwsdp-1.3\jaxb\lib

and tell me what you see when you run this command


for %? in (*.jar) do jar -tvf %? | find /I "QName"
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10687262
Those JARs are not there.

How are you adding to the classpath in IntelliJ IDEA? In the Classpath tab of the File -> Project Properties -> Paths dialog, click on "Add" ?
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10687271
>> I guess this classpath does not effect my thing!

Perhaps it does. Most of them use their own class-paths.
0
 

Author Comment

by:mvkraju
ID: 10687307
do you want me to type
>>for %? in (*.jar) do jar -tvf %? | find /I "QName"
this at command prompt?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10687353
>>do you want me to type this at command prompt?

Yes, once you've changed dir to those jaxb jars
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10687475
But CEHJ, the error says that the javax.xml.namespace itself does not exist?

mvkraju, did you try it adding to IDEA's class-path the way I told you?
0
 

Author Comment

by:mvkraju
ID: 10687495
By the by i moved all the 4 jar files to alib directory as mayankeagle said.
no result.
0
 

Author Comment

by:mvkraju
ID: 10687497
By the by i moved all the 4 jar files to alib directory as mayankeagle said.
no result.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 86

Expert Comment

by:CEHJ
ID: 10687514
They should not be in a lib directory. That's not going to help

>>But CEHJ, the error says that the javax.xml.namespace itself does not exist?

What's your point here?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10687531
What was the result of the command i asked you to run? There's not much point in moving those jars around the system if that package is not even in there
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10687613
>> What's your point here?

That it could be possible that he's missing a required JAR file for the entire package.

>> By the by i moved all the 4 jar files to alib directory as mayankeagle said

Did you add them to IDEA's class-path like I have said?
0
 

Author Comment

by:mvkraju
ID: 10687651
do i need to
>>for %? in (*.jar) do jar -tvf %? | find /I "QName"
at the command prompt?
or just
>>%? in (*.jar) do jar -tvf %? | find /I "QName"
only?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10687661
>>That it could be possible that he's missing a required JAR file for the entire package.

Which is why i suggested searching for the class in all jars

This is a case where i would not move the jars at all, as it looks like they belong to an installation of some kind. You need to set your class path to them instead, or add them to your IDE's classpath. This is of course assuming that class is in one of them, which is still to be determined until you run the command i gave you
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10687675
This one

for %? in (*.jar) do jar -tvf %? | find /I "QName"

Before you do that, you may as well make sure you have jar in your path, so just do

jar
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10687717
If you are able to find the class using that method, then can you please tell me whether you have tried adding the JARs to the class-path using the way I told you?

>> In the Classpath tab of the File -> Project Properties -> Paths dialog, click on "Add" ?
0
 

Author Comment

by:mvkraju
ID: 10687760
jar is in my PATH
when type the command at my command prompt

>>for %? in (*.jar) do jar -tvf %? | find /I "QName"

i did not get any result!
0
 

Author Comment

by:mvkraju
ID: 10687823
i added these jars
>> Project Settings -> select Paths in the Project tab -> select Libraries(classpath) tab in the right hand side -> added all 4 jar using "Add Jar/Directory" button.

As i told you before i am using IDEA.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10687844
>>i did not get any result!

...which suggests that the class is not in there. Did you download the jar i pointed you to earlier?
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10687849
Then perhaps the required JAR is not there. I noticed in the Java doc that javax.xml.namespace comes with J2EE 1.4 and not with J2SE 1.4.
0
 

Author Comment

by:mvkraju
ID: 10687976
I downloaded the jwsdp-1_3-windows-i586.exe file
from the link u have given to me.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 50 total points
ID: 10688031
>>
I downloaded the jwsdp-1_3-windows-i586.exe file
from the link u have given to me.
>>

??

"JAR with javax.xml.namespace.QName API Class Files 1.1 "

is the one i intended you to download...
0
 

Author Comment

by:mvkraju
ID: 10688083
sorry i did not look at it.
Yes i downloaded the jax-1_1-fr-qname-class.zip file
I put the jax-1_1-fr-qname-class.zip file in the classpath where i put the rest of the 4 jars.

Still the error did not go away!!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10688123
Can you run this command on that zip file:

jar -tvf jax-1_1-fr-qname-class.zip | find "QName"
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10688199
"in the classpath where"

You do realise that archives have to have their full path including their own name named don't you? i.e. the name of the folder they're in won't do
0
 

Author Comment

by:mvkraju
ID: 10688267
sorry i did wrong before
there is a jar file when i extract jax-1_1-fr-qname-class.zip.
I put the jar file in the classpath

now that error has gone

really good job guys!!!!
excellent job!!!!
I appreciate ur support.

I need u guys to stay with me some more time.

bcz i am getting another compilation error now
this time it says
package org.relaxng.datatype does not exist.....

by the by i am inceasing my points!!!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10688311
Oh no! ;-)

0
 

Author Comment

by:mvkraju
ID: 10688353
may be i will give ur points then will another thread!!
will do that? :)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10688379
Might be a good idea. Here's one for free: you need this:

http://heanet.dl.sourceforge.net/sourceforge/relaxng/relaxngDatatype-1.0.zip
0
 

Author Comment

by:mvkraju
ID: 10688663
CEHJ could you give me another link where i can find the file
some how i could not access the file there.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10688745
Strange - what happens? Don't know if i can remember how i got there now ..;-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10688755
0
 

Author Comment

by:mvkraju
ID: 10688768
never mind i could get that!
now that's woking fine
now it could not find javax.xml.XMLConstants package
any idea?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10688817
New question time - "Treasure Hunt"(?)
0
 

Author Comment

by:mvkraju
ID: 10688864
O.K. i am increasing points :)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10688904
I think your other idea is better - close this one and open a new one
0
 

Author Comment

by:mvkraju
ID: 10688974
O.k. as u like!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10688991
:-)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now