java.lang.ClassFormatError when creating JAXBContext object

Discussion in 'Java' started by gwinsor, Jun 29, 2007.

  1. gwinsor

    gwinsor Guest

    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.0
    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.0. 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.
    Geoff
     
    gwinsor, Jun 29, 2007
    #1
    1. Advertising

  2. gwinsor

    timjowers Guest

    Geoff,

    Did you solve this one? Looks like the class bytecode being produced
    is not a valid Java class. ??? Maybe you can post an XML.

    TimJowers
     
    timjowers, Jul 2, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page