Exception in thread "main" java.lang.ExceptionInInitializerError HELP!
I'm getting the above error after compiling successfully with no errors and then trying to run my program. Can someone help me interpret this error? thanks!
Code:
C:\java_dev_new_complete>javac -cp ".;*.jar" com\amazonservices\mws\sellers\samp
les\GetServiceStatusSample.java
Code:
C:\java_dev_new_complete>java com.amazonservices.mws.sellers.samples.GetServiceS
tatusSample
Code:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.amazonservices.mws.sellers.MarketplaceWebServiceSellersClient.<cl
init>(MarketplaceWebServiceSellersClient.java:111)
at com.amazonservices.mws.sellers.samples.GetServiceStatusSample.main(Ge
tServiceStatusSample.java:69)
Caused by: javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.C
ontextFactory could not be instantiated: javax.xml.bind.JAXBException: "com.amaz
onservices.mws.sellers.model" doesnt contain ObjectFactory.class or jaxb.index
- with linked exception:
[javax.xml.bind.JAXBException: "com.amazonservices.mws.sellers.model" doesnt con
tain ObjectFactory.class or jaxb.index]
at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
at javax.xml.bind.ContextFinder.find(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at com.amazonservices.mws.sellers.MarketplaceWebServiceSellersClient.<cl
init>(MarketplaceWebServiceSellersClient.java:107)
... 1 more
Caused by: javax.xml.bind.JAXBException: "com.amazonservices.mws.sellers.model"
doesnt contain ObjectFactory.class or jaxb.index
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Sou
rce)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
... 6 more
Re: Exception in thread "main" java.lang.ExceptionInInitializerError HELP!
Quote:
Originally Posted by
SnakeDoc
I'm getting the above error after compiling successfully with no errors and then trying to run my program. Can someone help me interpret this error?
Have you read the API for that class?
db
Re: Exception in thread "main" java.lang.ExceptionInInitializerError HELP!
Hello db!
If you are referring to the documentation for the GetServiceStatusSample class file, then yes, i've read the entire provided documentation from Amazon (this class file is part of the Amazon MWS API Java Client Library)... and unfortunately Amazon's documentation... is lacking.
If you are referring to the documentation for the javax.bind.xml 3rd party dependency, then yes i've attempted to read this through and understand it, but I'm afraid I may be missing something.
my errors seem to tell me that i'm missing the jaxb.index file, however I'm unsure what that could be. I basically unzipped the provided Client Library from Amazon and configured the API credentials I was provided with... and then they say to run the sample code... whcih I'm trying to, but getting this error above.
in case it helps: https://developer.amazonservices.com...0701/java.html <--------- place to look at the API files and instructions.
Re: Exception in thread "main" java.lang.ExceptionInInitializerError HELP!
Ok i figured this one out. Thanks db for your assistance.
ended being I was importing the javax.bind.xml dependency incorrectly. I ended up starting over this time using Eclipse and got no errors. Woot! (although this means I have zero understanding of how to properly do this on my own without the help of an IDE... :-/ )
Re: Exception in thread "main" java.lang.ExceptionInInitializerError HELP!
I was referring to the documentation for ExceptionInInitializerError.
Glad your problem is solved, one way or another. You probably had a wrong version of a dependency on your classpath.
db