OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   JAXB SecurtiyException with NamespaceContext

[ Lists Home | Date Index | Thread Index ]

Hello,

 

I'm attempting to use JAXB for the first time and I'm experiencing a couple of problems.  I hope this is a suitable mailing list to post this question to – I have tried the Java Forums with no luck.  However if you think there is a better forum for this question, could you please let me know?  Anyway, here’s my problem:

I'm able to generate the classes from my XML Schema using the following command:

c:\jwsdp-1.5\jaxb\bin\xjc.bat -p com.piper.datamanager.config main.xsd



This generates the expected classes and puts them in the specified package. I have then added the following code to one of my classes to read from an XML file:

        try {
            JAXBContext context = JAXBContext.newInstance("com.piper.datamanager.config");
            Unmarshaller unmarshaller = context.createUnmarshaller();
            DataManager dataManager = (DataManager) unmarshaller.unmarshal(new File("D:/eclipse/workspace/dataManager/dataManager.cfg"));
            logger.info("done");
        } catch (Exception e) {
            logger.error(e, e);
        }

When I run this though, from Eclipse, I get the following error when the first line of the above try block is executed:
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:611)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:532)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        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:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        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 com.piper.datamanager.config.impl.runtime.GrammarInfoFacade.createGrammarInfoFacade(GrammarInfoFacade.java:165)
        at com.piper.datamanager.config.impl.runtime.DefaultJAXBContextImpl.<init>(DefaultJAXBContextImpl.java:47)
        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: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(DelegatingMethodAccessorImpl.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 com.piper.datamanager.client.LoginDialog.initialize(LoginDialog.java:99)
        at com.piper.datamanager.client.LoginDialog.<init>(LoginDialog.java:81)
        at com.piper.datamanager.Main.main(Main.java:34)

From my own investigation into this it seems that this is occurring as I have two jars in my classpath containing the package javax.xml.namespace and they are signed differently. These are jax-qname.jar and namespace..jar. I got both of these jars from my
C:\jwsdp-1.5\jwsdp-shared\lib

directory. I have even tried putting the contents of both jars into one jar but this makes no difference. The application I am writing is a Swing app that also uses JAX-RPC to communicate with a server - I have tried using just one of these jars but both of them are required for my application to run and build.

Does anyone know how I can fix this problem? Any help will be greatly appreciated.

Ian.





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS