• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New to Web Services and JAXB

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have downloaded and installed the JWSDP and installed it with tomcat 5 for Java WSDP on my Win XP workstations. I am able to build and compile the source files for the unmarshal-read sample application. However, when I go on to try to run the application, i get the following stack trace:

C:\Sun\jwsdp-1.6\jaxb\samples\unmarshal-read\classes>java Main
java.lang.SecurityException: class "javax.xml.namespace.NamespaceContext"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:599)
at java.lang.ClassLoader.defineClass(ClassLoader.java:532)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at primer.po.impl.runtime.GrammarInfoFacade.class$(GrammarInfoFacade.jav
a:162)
at primer.po.impl.runtime.GrammarInfoFacade.createGrammarInfoFacade(Gram
marInfoFacade.java:161)
at primer.po.impl.runtime.DefaultJAXBContextImpl.<init>(DefaultJAXBConte
xtImpl.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.sun.xml.bind.ContextFactory_1_0_1.createContext(ContextFactory_1_
0_1.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:96)
at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:229
)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:238)
at Main.main(Main.java:37)


The statement in Main.java that is the point of failure is the statement that sets the JAXB context:

JAXBContext jc = JAXBContext.newInstance( "primer.po" );
I am using the ant build.xml to do the build.

Any help is appreciated.

Thanks,

javawannabe2005
 
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've not hit this myself, but from what I've read, this is usually a classpath issue.

That is, the JAXB classes are finding the class 'javax.xml.namespace.NamespaceContext' somewhere on the classpath, but it isn't the one provided with JWSDP (and so, the one that would have appropriate signing/security information).

What you need to do is ensure you're using the "right version" of each class - the right namespace.jar, in this case. In this case, this involves making sure you're using the version supplied with JWSDP, not whichever one appears on your classpath.

Usually, you'd do this by passing a particular classpath to the java program. I.e., 'java -classpath "c:/foo/bar;..." Main'.

However, the JWSDP includes a *much* nicer way: use the Ant build file ('build.xml') supplied with the unmarshal example (i.e., JWSDP_HOME/jaxb/samples/unmarshal-read/build.xml). Looking at the contents of this build file, you want to run the Ant target "run". That is, you should be able to type (from the directory containing 'build.xml') "ant run".

If you're not familiar with Ant, I suggest you read up on it a bit - it's used throughout JWSDP, and across Java applications in general. It all starts here.


-Tim
 
Connie Irwin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's interesting and helpful. I did start of with ant and the build.xml that were supplied with the JWSDP, however, I will try running the sample with the classpath qualifier as you suggest, and will let you know the result. Much thanks. Btw, I did suspect that it wasa classpath issue.
 
Connie Irwin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem was indeed a classpath problem. The jre required a reference to the jaxp jars. The jwsdp installation deploys a message to the final screen instructing the user to:

create a directory as follows in the jre path
<JAVA_HOME>\jre\lib\endorsed
copy the jaxp jars to this library
<JWSDP_HOME>\jaxp\lib
<JWSDP_HOME>\jaxp\lib\endorsed

As soon as I copied these files to the <JAVA_HOME> jre, the example built, compiled and ran.
 
Ew. You guys are ugly with a capital UG. Here, maybe this tiny ad can help:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic