Wednesday, April 18, 2012

Unable to create JAXBContext


While I am trying to invoke web service from my java application in the command line I have face the following error.

root@collaboratorio LUXClientFTP]# java -jar -Djava.endorsed.dirs=lib LUXClient.jar
Apr 12, 2012 12:24:53 PM [com.sun.xml.ws.policy.jaxws.PolicyConfigParser]  parse
INFO: WSP5018: Loaded WSIT configuration from file: jar:file:/home/java/LUXClientFTP/lib/venusc-api.jar!/META-INF/wsit-client.xml.
Apr 12, 2012 12:24:54 PM [com.sun.xml.ws.policy.jaxws.PolicyConfigParser]  parse
INFO: WSP5018: Loaded WSIT configuration from file: jar:file:/home/java/LUXClientFTP/lib/venusc-api.jar!/META-INF/wsit-client.xml.
javax.xml.ws.WebServiceException: Unable to create JAXBContext
        at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:166)
        at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:94)
        at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:258)
        at com.sun.xml.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:661)
        at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:649)
        at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:343)
        at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:326)
        at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:308)
        at javax.xml.ws.Service.getPort(Service.java:99)
        at com.bsc.venusbes.venusclient.BESFactoryPortTypeImplService.getBESFactoryPortTypePort(BESFactoryPortTypeImplService.java:82)
        at com.bsc.venusbes.venusclient.VENUSClient.createActivity(VENUSClient.java:88)
        at LUXClient.submitRender(LUXClient.java:165)
        at LUXClient.main(LUXClient.java:104)
Caused by: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.lang.StackTraceElement does not have a no-arg default constructor.
        this problem is related to the following location:
                at java.lang.StackTraceElement
                at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
                at java.lang.Throwable
                at public java.lang.Throwable[] com.bsc.venusbes.types.bes.jaxws.CantApplyOperationToCurrentStateFaultBean.suppressed
                at com.bsc.venusbes.types.bes.jaxws.CantApplyOperationToCurrentStateFaultBean
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:153)
        ... 12 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.lang.StackTraceElement does not have a no-arg default constructor.
        this problem is related to the following location:
                at java.lang.StackTraceElement
                at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
                at java.lang.Throwable
                at public java.lang.Throwable[] com.bsc.venusbes.types.bes.jaxws.CantApplyOperationToCurrentStateFaultBean.suppressed
                at com.bsc.venusbes.types.bes.jaxws.CantApplyOperationToCurrentStateFaultBean
        at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:472)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:302)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1140)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
        at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:106)
        at com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:109)
        at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:161)
        at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:154)
        ... 14 more
==============
null
[root@XXX LUXClientFTP]#

Of course,  I spent more time to solve the problem this problem by searching blogs and google. Mosst of the developers encounter the same problem like mine, but they didn't put the short solution.
Firstly I used jdk 7 for developing and running the client application, and the problem occurred here.

After long time, I change my JDK to version 1.6.0_22 and it works.  But, saying there is application that can run on oldest version but not in latest one is strange for me.  Anyways, the problem is solved. ;)

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. problem with Exception / Error..
    remove that

    ReplyDelete
  3. I can't use JDK 1.7 ! I have too keep my 1.6 version !
    There is other solution please ?

    ReplyDelete