Warum können meine Java - /SalesForce-app anlegen JAXBContext aufgrund einer sicherheitseinschränkung?

War ich auf einer Java - /Salesforce-tutorial, aber ich konnte es nicht zu funktionieren, da der SoapBindingStub obsolet zu sein scheint-code, basierend auf der Abschreibung Bibliotheken. So habe ich versucht, Netz-code mit dem code aus JAX-WS, Quick Start, aber das hat nicht ganz funktioniert. Egal, was ich Tat, letztlich die Beispiel-Konsolenanwendung würde darunter leiden, Ausnahmen, Klagen "Web-Service-Ausnahme erstellen salesface port.: Unable to create JAXBContext wegen der Sicherheit Einschränkung auf der Klasse javax.xml.ws.WebServiceException".

Ich aufgegeben (für den moment) versucht, die Maische zwei codes, und stattdessen bin jetzt gerade an die Abstraktion der JAX-WS Quickstart.java so kann ich verstehen, wow, es funktioniert und Wiederverwendung Ihrer Methoden in anderen Applikationen.

Egal wie ich slice und dice den code, der es immer hängen bleibt an der gleichen Position mit im wesentlichen gleichen Fehler.

Hier ist der aktuelle code für die Methode ist, die persistantly Ausfall:

private void initPort() 
{
    try 
    {
        URL wsdlLocation = this.getClass().getClassLoader().getResource("META-INF/enterprise.wsdl");
        if (wsdlLocation == null) 
        {
            WebServiceException webServiceException = new WebServiceException("enterprise.wsdl not found!");
            ExceptionToolkit.display("Web Service Exception can't find enterprise.wsdl", webServiceException);
            throw webServiceException;
        }
        else {System.out.println("\nFOUND enterprise.wsdl!!!\n\n");}

        QName qName = new QName("urn:enterprise.soap.sforce.com", "SforceService");
        SforceService sforceService = new SforceService( wsdlLocation, qName );
        System.out.println("\nsforceService INITIALIZED. About to get Soap.\n\n");
        Soap soap = (sforceService).getSoap();
        System.out.println("\nWe have soap.\n\n");
        setPort (soap);
    } 
    catch (WebServiceException webServiceException) 
    { 
        ExceptionToolkit.display("Web Service Exception creating salesface port", webServiceException); 
        return;
    }
}

Hier ist der Fehler, einschließlich der Ausgabe unmittelbar vor und nach:

Running main loop



FOUND enterprise.wsdl!!!



sforceService INITIALIZED. About to get Soap.




Web Service Exception creating salesface port: Unable to create JAXBContext due to the security restriction
on class javax.xml.ws.WebServiceException
javax.xml.ws.WebServiceException: Unable to create JAXBContext due to the security restriction
    at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:131)
    at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:63)
    at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:224)
    at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:588)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:291)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:274)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:267)
    at javax.xml.ws.Service.getPort(Unknown Source)
    at com.sforce.soap.enterprise.SforceService.getSoap(SforceService.java:53)
    at hu.flux.salesforce.LoginToolkit.initPort(LoginToolkit.java:78)
    at hu.flux.salesforce.LoginToolkit.doLogin(LoginToolkit.java:122)
    at hu.flux.salesforce.LoginToolkit.<init>(LoginToolkit.java:49)
    at hu.flux.salesforce.samples.Quickstart.mainLoop(Quickstart.java:55)
    at hu.flux.salesforce.samples.Quickstart.<init>(Quickstart.java:28)
    at hu.flux.salesforce.samples.Quickstart.main(Quickstart.java:21)
Caused by: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 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 java.lang.Exception
        at com.sforce.ws.ConnectionException
        at com.sforce.ws.SoapFaultException
        at com.sforce.soap.enterprise.fault.ApiFault
        at public javax.xml.bind.JAXBElement com.sforce.soap.enterprise.fault.ObjectFactory.createFault(com.sforce.soap.enterprise.fault.ApiFault)
        at com.sforce.soap.enterprise.fault.ObjectFactory
com.sforce.ws.types.Time does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.sforce.ws.types.Time
        at public com.sforce.ws.types.Time com.sforce.soap.enterprise.sobject.BusinessHours.getFridayEndTime()
        at com.sforce.soap.enterprise.sobject.BusinessHours
        at public com.sforce.soap.enterprise.sobject.BusinessHours com.sforce.soap.enterprise.sobject.ObjectFactory.createBusinessHours()
        at com.sforce.soap.enterprise.sobject.ObjectFactory

    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:124)
    ... 14 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 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 java.lang.Exception
        at com.sforce.ws.ConnectionException
        at com.sforce.ws.SoapFaultException
        at com.sforce.soap.enterprise.fault.ApiFault
        at public javax.xml.bind.JAXBElement com.sforce.soap.enterprise.fault.ObjectFactory.createFault(com.sforce.soap.enterprise.fault.ApiFault)
        at com.sforce.soap.enterprise.fault.ObjectFactory
com.sforce.ws.types.Time does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.sforce.ws.types.Time
        at public com.sforce.ws.types.Time com.sforce.soap.enterprise.sobject.BusinessHours.getFridayEndTime()
        at com.sforce.soap.enterprise.sobject.BusinessHours
        at public com.sforce.soap.enterprise.sobject.BusinessHours com.sforce.soap.enterprise.sobject.ObjectFactory.createBusinessHours()
        at com.sforce.soap.enterprise.sobject.ObjectFactory

    at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:270)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:103)
    at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:89)
    at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:126)
    at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:125)
    ... 16 more



1. Login
2. Get Accounts
3. Update Accounts
4. Get Server Timestamp
5. Exit
Enter a menu option: 

Die Letzte Zeile (chronologisch) auf den stack bezieht sich auf meine eigene code ist:

at hu.flux.salesforce.LoginToolkit.initPort(LoginToolkit.java:78)

System.aus.println-Anweisungen in der Quelle, die bestätigt, dass dies ist, was die Ausführung beendet. Diese Linie ausdrücklich heißt:

Soap soap = (sforceService).getSoap();

Weiß jemand, wie oder warum dies könnte über eine sicherheitseinschränkung letztlich verlassen java nicht in der Lage zu schaffen, die JAXBContext?

Downvoting ein legitimes problem... sehr hilfreich. :-/

InformationsquelleAutor Brian Kessler | 2011-01-22

Schreibe einen Kommentar