-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reflection error when creating XeroClient #163
Comments
Looking at the pom it looks like you are creating an uber jar with all the dependencies? This is not an ideal situation for projects that rely on maven to discover and resolve dependencies. I believe this is the source of my problem because you are including dependencies that I have elsewhere but with different versions. Do you have a maven pom that does not do this? |
Hey @ludup Always interested in hearing how to do things better. If you want to share some links to how to enable "discover and resolve dependencies" I'd be happy to review it for an enhancement request. In the meantime, the order of your dependencies does impact which version is loaded. Perhaps you could work around this in the near term. |
Thanks for the quick response. You do not need to "enable" dependency discovery, its a core part of Maven. https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html I note that actually you are deploying both an uber jar and the standard jar so I do have the artifact I need. I'm still trying to track down the problem here, it may not be caused by the uber jar after all. I'll update you when I have more information. I would like to make one suggestion for the improvement of your project layout. It would be better for users if you separate out the core API code that developers need to use, from the examples code so that we do not have to pull in the dependencies of your examples. I'd prefer that I did not have to pull in servlet API etc for your example web app. yes I can exclude from maven, but I'd rather not have to. |
Hi @ludup We've already separated example code in version 3.x of our SDK which is for OAuth 2.0. I've gone ahead and removed "servlet" code from the example for version 2.3.21. Thanks |
I'm trying to track down a problem with the Xero API.
Version 2.3.16
I get an exception whilst trying to create an instance of XeroClient.
I wonder if this is some sort of dependency / version issue? Although the maven module does not appear to draw in any transitive dependencies?
[Thread-111] ERROR com.hypersocket.crm.xero.XeroAccountingServiceImpl - Failed to post invoice
java.lang.NoSuchFieldError: REFLECTION
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.(RuntimeModelBuilder.java:89)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:456)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(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.v2.ContextFactory.createContext(ContextFactory.java:121)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:171)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:131)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:335)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:394)
at com.xero.api.jaxb.XeroJAXBMarshaller.initContext(XeroJAXBMarshaller.java:27)
at com.xero.api.jaxb.XeroJAXBMarshaller.(XeroJAXBMarshaller.java:23)
at com.xero.api.XeroClient.(XeroClient.java:40)
I used the following code:
The text was updated successfully, but these errors were encountered: