users@jaxb.java.net

Re: java.lang.ClassFormatError when creating JAXBContext object

From: vince10 <vcnzc_at_hotmail.com>
Date: Tue, 7 Aug 2007 03:55:43 -0700 (PDT)

I am having the same problem .
I use jdk 1.5.0.12 to compile and run my program and JAXB 2.0.5.
I tried to switch to JAXB 2.1.4 but it is the same
I have found a bypass for the problem setting the "-npa" xjc option.
In this way package-info.java is not generated by xjc and the program
compiles and works fine.
I have not found, up to now side effects after this change, is there any?
bye
vince10


Geoff Winsor wrote:
>
> Hi,
> I am trying to marshal an XML document using JAXB 2.0. At runtime, when
> my web application tries to create a JAXBContext object, I get the
> following exception:
>
> *type* Exception report
>
> *message*
>
> *description* _The server encountered an internal error () that
> prevented it from fulfilling this request._
>
> *exception*
>
> javax.servlet.ServletException: Servlet execution threw an exception
>
> org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
>
> *root cause*
>
> java.lang.ClassFormatError: Illegal class modifiers in class
> com/innatedb/xml/mi/package-info: 0x1600
> java.lang.ClassLoader.defineClass1(Native Method)
> java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>
> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1815)
>
> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:869)
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1322)
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> java.lang.Class.forName0(Native Method)
> java.lang.Class.forName(Class.java:242)
> java.lang.Package.getPackageInfo(Package.java:350)
> java.lang.Package.getAnnotation(Package.java:361)
>
> com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getPackageAnnotation(RuntimeInlineAnnotationReader.java:85)
>
> com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getPackageAnnotation(RuntimeInlineAnnotationReader.java:17)
>
> com.sun.xml.bind.v2.model.impl.TypeInfoImpl.parseElementName(TypeInfoImpl.java:86)
>
> com.sun.xml.bind.v2.model.impl.ClassInfoImpl.<init>(ClassInfoImpl.java:126)
>
> com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.<init>(RuntimeClassInfoImpl.java:50)
>
> com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createClassInfo(RuntimeModelBuilder.java:59)
>
> com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createClassInfo(RuntimeModelBuilder.java:41)
>
> com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:123)
>
> com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
>
> com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
>
> com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
>
> com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.java:63)
>
> com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.java:232)
>
> com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:201)
>
> com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:352)
>
> com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:350)
> java.security.AccessController.doPrivileged(Native Method)
>
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:349)
>
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:215)
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:124)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> java.lang.reflect.Method.invoke(Method.java:585)
> javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
> javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
> javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
> javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
> javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
>
> com.innatedb.search.interaction.DownloadPsiMiXmlAction.execute(DownloadPsiMiXmlAction.java:155)
>
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
>
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
>
>
>
> Here is the line of code which throws the exception:
> JAXBContext jc = JAXBContext.newInstance("com.innatedb.xml.mi");
>
> I am using JDK1.6
> I have no problem creating XML objects from classes based on the xml
> schema and I used the xjc compiler belonging to the JKD1.6. In addition,
> the java class containing the above snippet of code compiles without any
> problems.
> Is there anything obvious that I am overlooking? Thanks for any
> suggestions you can offer.
> (I originally posted this on the java.net forums page - Please accept my
> apologies if this is a redundant post).
> Geoff
>
>
>

-- 
View this message in context: http://www.nabble.com/java.lang.ClassFormatError-when-creating-JAXBContext-object-tf4000896.html#a12032049
Sent from the java.net - jaxb users mailing list archive at Nabble.com.