Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

javax.xml.namespace does not exist for JAXB application

Posted on 2004-03-25
57
1,310 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:Mayank S
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 30

Expert Comment

by:Mayank S
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:Mayank S
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:Mayank S
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:Mayank S
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:Mayank S
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:Mayank S
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:Mayank S
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:Mayank S
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:Mayank S
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
 
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:Mayank S
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:Mayank S
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:Mayank S
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
The viewer will learn how to implement Singleton Design Pattern in Java.

860 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