3 Replies Latest reply on Apr 9, 2010 1:27 AM by Richard Opalka

    Error on java.lang.IllegalStateException: Cannot build JAXB

    Mathan Kumar Sambasivam Newbie

      Hi,

      I created a Java WebService implementation java file named as DeviceServiceEventBroker.java with JAX-WS annotations. My Java WebService implementation file is implements with an interface named as DeviceOmi.java of my Web Service class. And My Interface class is extends with the java.io.Serializable.

      I am not able to generate the wsdl from java. I got the below error. Any idea? Is there any option to use my Implemtation class with out the extends classes.


      D:\MCP-2008\classes>"C:\Program Files\Java\jdk1.6.0_02\bin\java" -Djava.endorsed.dirs="D:\jboss-4.2.2.GA\bin\\..\lib\endorsed" -Dlog4j.configuration=
      wstools-log4j.xml -classpath ";D:\jboss-4.2.2.GA\bin\\../client/jboss-xml-binding.jar;D:\jboss-4.2.2.GA\bin\\../client/activation.jar;D:\jboss-4.2.2.G
      A\bin\\../client/javassist.jar;D:\jboss-4.2.2.GA\bin\\../client/getopt.jar;D:\jboss-4.2.2.GA\bin\\../client/jaxb-api.jar;D:\jboss-4.2.2.GA\bin\\../cli
      ent/jaxb-impl.jar;D:\jboss-4.2.2.GA\bin\\../client/jbossall-client.jar;D:\jboss-4.2.2.GA\bin\\../client/jbossws-client.jar;D:\jboss-4.2.2.GA\bin\\../c
      lient/jboss-jaxws.jar;D:\jboss-4.2.2.GA\bin\\../client/jboss-jaxrpc.jar;D:\jboss-4.2.2.GA\bin\\../client/jboss-saaj.jar;D:\jboss-4.2.2.GA\bin\\../clie
      nt/log4j.jar;D:\jboss-4.2.2.GA\bin\\../client/mail.jar;D:\jboss-4.2.2.GA\bin\\../client/jbossws-spi.jar" org.jboss.wsf.spi.tools.cmd.WSProvide --show-
      traces -o D:\MCP-2008\wsdl -w com.nortelnetworks.mcp.ne.sm.svc.device.impl.DeviceServiceEventBroker
      Output directory: D:\MCP-2008\wsdl
      Source directory: D:\MCP-2008\wsdl
      Generating WSDL:
      log4j:WARN No appenders could be found for logger (org.jboss.wsf.framework.DefaultSPIProvider).
      log4j:WARN Please initialize the log4j system properly.
      Error: Could not generate. (use --show-traces to see full traces)
      java.lang.IllegalStateException: Cannot build JAXB context
      at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.createJAXBContext(JAXWSMetaDataBuilder.java:944)
      at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.buildWebServiceMetaData(JAXWSWebServiceMetaDataBuilder.java:146)
      at org.jboss.ws.tools.jaxws.impl.JBossWSProviderImpl.provide(JBossWSProviderImpl.java:108)
      at org.jboss.ws.tools.jaxws.impl.JBossWSProviderImpl.provide(JBossWSProviderImpl.java:124)
      at org.jboss.wsf.spi.tools.cmd.WSProvide.generate(WSProvide.java:184)
      at org.jboss.wsf.spi.tools.cmd.WSProvide.main(WSProvide.java:77)
      Caused by: org.jboss.ws.WSException: Failed to create JAXBContext
      at org.jboss.ws.core.jaxws.CustomizableJAXBContextFactory.createContext(CustomizableJAXBContextFactory.java:111)
      at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.createJAXBContext(JAXWSMetaDataBuilder.java:935)
      ... 5 more
      Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
      java.io.Serializable is an interface, and JAXB can't handle interfaces.
      this problem is related to the following location:
      at java.io.Serializable
      at public java.io.Serializable
      com.nortelnetworks.mcp.ne.share.svc.filter.data.PropertyFilterDataObject.getPropertyValue()
      at com.nortelnetworks.mcp.ne.share.svc.filter.data.PropertyFilterDataObject
      at public com.nortelnetworks.mcp.ne.share.svc.filter.data.PropertyFilterDataObject[] com.nortelnetworks.mcp.ne.share.svc.filter.data.F
      ilterDataObject.getPropertyFilters()
      at com.nortelnetworks.mcp.ne.share.svc.filter.data.FilterDataObject
      at com.nortelnetworks.mcp.ne.share.svc.device.data.DeviceMtcDataFilter
      at private com.nortelnetworks.mcp.ne.share.svc.device.data.DeviceMtcDataFilter com.nortelnetworks.mcp.ne.sm.svc.device.impl.jaxws.GetF
      ilteredDeviceListFromIPCM.arg1
      at com.nortelnetworks.mcp.ne.sm.svc.device.impl.jaxws.GetFilteredDeviceListFromIPCM
      java.io.Serializable does not have a no-arg default constructor.
      this problem is related to the following location:
      at java.io.Serializable
      at public java.io.Serializable com.nortelnetworks.mcp.ne.share.svc.filter.data.PropertyFilterDataObject.getPropertyValue()
      at com.nortelnetworks.mcp.ne.share.svc.filter.data.PropertyFilterDataObject
      at public com.nortelnetworks.mcp.ne.share.svc.filter.data.PropertyFilterDataObject[] com.nortelnetworks.mcp.ne.share.svc.filter.data.F
      ilterDataObject.getPropertyFilters()
      at com.nortelnetworks.mcp.ne.share.svc.filter.data.FilterDataObject
      at com.nortelnetworks.mcp.ne.share.svc.device.data.DeviceMtcDataFilter
      at private com.nortelnetworks.mcp.ne.share.svc.device.data.DeviceMtcDataFilter com.nortelnetworks.mcp.ne.sm.svc.device.impl.jaxws.GetF
      ilteredDeviceListFromIPCM.arg1
      at com.nortelnetworks.mcp.ne.sm.svc.device.impl.jaxws.GetFilteredDeviceListFromIPCM

      at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:286)
      at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
      at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:105)
      at org.jboss.ws.core.jaxws.CustomizableJAXBContextFactory.createContext(CustomizableJAXBContextFactory.java:102)
      ... 6 more

        • 1. Re: Error on java.lang.IllegalStateException: Cannot build JAXB
          David Jitendranath Novice

          I have the same exception thrown on JBoss 5.1 when I run wsprovide to generate the wsdl and server classes.

          Did you get this resolved? can you please post how?

           

          Here's my exception.

           


          C:\Projects\BOR\ETASWS\ETAS-Service-2.0\ETASWS\build\classes>wsprovide -t -k -w -o c:\Projects\BOR\ETASWS\ETAS-Service-2.0\ETASWS\src\gov\usbr\ws\jaxw
          s\ gov.usbr.ws.ETAS
          Output directory: c:\Projects\BOR\ETASWS\ETAS-Service-2.0\ETASWS\src\gov\usbr\ws\jaxws
          Source directory: c:\Projects\BOR\ETASWS\ETAS-Service-2.0\ETASWS\src\gov\usbr\ws\jaxws
          Generating WSDL:
          Error: Could not generate. (use --show-traces to see full traces)
          java.lang.IllegalStateException: Cannot build JAXB context
                  at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.createJAXBContext(JAXWSMetaDataBuilder.java:984)
                  at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.buildWebServiceMetaData(JAXWSWebServiceMetaDataBuilder.java:154)
                  at org.jboss.ws.tools.jaxws.impl.JBossWSProviderImpl.provide(JBossWSProviderImpl.java:108)
                  at org.jboss.ws.tools.jaxws.impl.JBossWSProviderImpl.provide(JBossWSProviderImpl.java:124)
                  at org.jboss.wsf.spi.tools.cmd.WSProvide.generate(WSProvide.java:183)
                  at org.jboss.wsf.spi.tools.cmd.WSProvide.main(WSProvide.java:76)
          Caused by: org.jboss.ws.WSException: Failed to create JAXBContext
                  at org.jboss.ws.core.jaxws.CustomizableJAXBContextFactory.createContext(CustomizableJAXBContextFactory.java:114)
                  at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.createJAXBContext(JAXWSMetaDataBuilder.java:980)
                  ... 5 more
          Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
          java.io.Serializable is an interface, and JAXB can't handle interfaces.
                  this problem is related to the following location:
                          at java.io.Serializable
                          at public java.io.Serializable gov.usbr.data.etas.Timesheet.getEmpSigned()
                          at gov.usbr.data.etas.Timesheet
                          at public gov.usbr.data.etas.Timesheet gov.usbr.data.etas.Employee.getTimesheet()
                          at gov.usbr.data.etas.Employee
                          at private gov.usbr.data.etas.Employee gov.usbr.ws.jaxws.GetEmployeeResponse._return
                          at gov.usbr.ws.jaxws.GetEmployeeResponse
          java.io.Serializable does not have a no-arg default constructor.
                  this problem is related to the following location:
                          at java.io.Serializable
                          at public java.io.Serializable gov.usbr.data.etas.Timesheet.getEmpSigned()
                          at gov.usbr.data.etas.Timesheet
                          at public gov.usbr.data.etas.Timesheet gov.usbr.data.etas.Employee.getTimesheet()
          • 2. Re: Error on java.lang.IllegalStateException: Cannot build JAXB
            Jim Ma Apprentice

            The problem is in your types classes passed to the wsprovide tool.  One of reason I can see from the exception stack trace is the types class implemented interface java.io.Serializable and JAXB can not handle it. Here is the reason why JAXB can not :  http://weblogs.java.net/blog/2006/06/06/jaxb-and-interfaces

            • 3. Re: Error on java.lang.IllegalStateException: Cannot build JAXB
              Richard Opalka Master

              You're using JAXB incompatible classes.

              Double check JAXB documentation

              how to proceed and to see what's supported.