-
1. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ffang Sep 27, 2010 8:58 AM (in response to ngaurav)Hi,
I just added comment for http://fusesource.com/forums/thread.jspa?messageID=6943ᬟ.
I believe this issue is related to SMX4-580, which swallow exception hide the real problem, the real problem could be miss some package import from your bundle.
The fix for SMX4-580 just throw such more meaningful exception for you to figure out the real problem.
You need use jaxb-api-2.1 latest snapshot[2] to pick up this fix
https://issues.apache.org/activemq/browse/SMX4-580
https://repository.apache.org/content/groups/snapshots-group/org/apache/servicemix/specs/org.apache.servicemix.specs.jaxb-api-2.1/1.6-SNAPSHOT/
Freeman
-
2. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ngaurav Sep 27, 2010 9:55 AM (in response to ffang)Hi Freeman,
Thanks for the response. I removed the dependency for jaxb-api-2.0 and replaced it with jaxb-api-2.1 which you have mentioned above, but I am still getting the same exception. Is there any other thing, I could be missing?
Thanks,
Gaurav
-
3. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ffang Sep 27, 2010 10:02 AM (in response to ngaurav)Hi Gaurav,
Could you tell me how you replace jaxb-api-2.1 snapshot jar?
We've shipped jaxb-api-2.1 jar in
$SMX_HOME/system/org/apache/servicemix/specs/org.apache.servicemix.specs.jaxb-api-2.1/1.5.0/org.apache.servicemix.specs.jaxb-api-2.1-1.5.0.jar
You need copy the snapshot jar I pointed[1] to $SMX_HOME/system/org/apache/servicemix/specs/org.apache.servicemix.specs.jaxb-api-2.1/1.5.0/org.apache.servicemix.specs.jaxb-api-2.1-1.5.0.jar
https://repository.apache.org/content/groups/snapshots-group/org/apache/servicemix/specs/org.apache.servicemix.specs.jaxb-api-2.1/1.6-SNAPSHOT/
Freeman
-
4. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ngaurav Sep 27, 2010 10:56 AM (in response to ffang)Hi Freeman,
Thanks for clearing that up. I had just added it to the pom dependency. Now I replaced the older jar in servicemix system directory. Now I got the following error which I was afraid of:
Caused by: javax.xml.bind.JAXBException: Unable to create context
- with linked exception:
at javax.xml.bind.ContextFinder.find(ContextFinder.java:68)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:77)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:73)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:69)
at com.vzb.ram.bind.ns.XmlPoJoUtil.toPoJo(XmlPoJoUtil.java:185)
... 54 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_18]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_18]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_18]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_18]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:63)
... 58 more
Caused by: javax.xml.bind.JAXBException: "com.mypackage" doesnt contain ObjectFactory.class or jaxb.index
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:197)
... 63 more
MyUtility.jar contains the ObjectFactory.class in com.mypackage. But it is not able to find it. Can you suggest any way so that I can I make servicemix see that class file.
Thanks,
Gaurav
-
5. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ffang Sep 27, 2010 8:58 PM (in response to ngaurav)Hi,
Did you already export com.mypackage package from your bundle so that it's avaible for jaxb?
Freeman
-
6. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ngaurav Sep 27, 2010 10:33 PM (in response to ffang)Hi Freeman,
I had installed MyUtil.jar in servicemix 4.3 using the following command:
osgi:install wrap:file:///C:/MyUtil.jar
and then I started this bundle.
When I say packages:exports for this bundle, com.mypackage is listed there. So I think, it should be available for jaxb.
Thanks,
Gaurav
-
7. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ffang Sep 27, 2010 10:49 PM (in response to ngaurav)Hi Gaurav,
Could you use osgi:headers your_bundle_id and post the output here?
Freeman
-
8. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ngaurav Sep 27, 2010 11:34 PM (in response to ffang)Hi Freeman,
Here is the output for 2 bundles, one is the wrapped jar file and other one is the bundle which is using that jar file.
wrap_file____C__MyUtility.jar (171)
-
Bnd-LastModified = 1285598542345
Bundle-ManifestVersion = 2
Bundle-Name = wrap_file____C__MyUtility.jar
Bundle-SymbolicName = wrap_file____C__MyUtility.jar
Bundle-Version = 0
Created-By = 1.6.0_18 (Sun Microsystems Inc.)
Export-Package =
com.mylog;uses:="com.mypersist,com.mycommons,com.mypackage",com.mypersist;uses:="com.mypackage",com.mytest;uses:="com.mylog",com.mycommons;uses:="org.apache.log4j,javax.xml.bind,javax.xml.validation,gnu.getopt,org.xml.sax",com.mypackage;uses:="javax.xml.bind.annotation,javax.xml.bind,javax.xml.namespace,com.mycommons",gnu.getopt
Generated-By-Ops4j-Pax-From = wrap:file:///C:/MyUtility.jar
Import-Package =
com.mylog;resolution:=optional,com.mypersist;resolution:=optional,com.mytest;resolution:=optional,com.mycommons;resolution:=optional,com.mypackage;resolution
;=optional,gnu.getopt;resolution:=optional,javax.xml.bind;resolution:=optional,javax.xml.bind.annotation;resolution:=optional,javax.xml.namespace;resolution:
=optional,javax.xml.validation;resolution:=optional,org.apache.log4j;resolution:=optional,org.xml.sax;resolution:=optional
Manifest-Version = 1.0
Originally-Created-By = 1.6.0_17 (Sun Microsystems Inc.)
Tool = Bnd-0.0.313
ESB :: Common :: MyLog (172)
-
Bnd-LastModified = 1285644282449
Build-Jdk = 1.6.0_18
Built-By = gaurav.x.nigam
Bundle-ManifestVersion = 2
Bundle-Name = ESB :: Common :: MyLog
Bundle-SymbolicName = AuditLog
Bundle-Version = 0.0.0.main-SNAPSHOT
Created-By = Apache Maven Bundle Plugin
Export-Package = com.esb.common.mylog;uses:="org.apache.camel,com.mycommons,com.mylog"
Import-Package =
com.mylog,com.mycommons,com.mypackage,javax.xml.bind,javax.xml.bind.annotation,javax.xml.namespace,org.apache.camel;version="2.4",org.apache.camel.osgi
Manifest-Version = 1.0
Tool = Bnd-0.0.357
-Gaurav
-
9. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ffang Sep 28, 2010 12:40 AM (in response to ngaurav)Hi,
I noticed that from MyUtility.jar bundle, there's also Import-Package com.mypackage, that would be a problem when other bundles(not MyUtility.jar) also export com.mypackage, could you remove Import-Package com.mypackage from MyUtility.jar?
Freeman
-
10. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ngaurav Sep 28, 2010 2:10 AM (in response to ffang)Hi Freeman,
Thanks for bearing with me. Earlier I was using osgi:install wrap:file:///C:/MyUtility.jar to install the jar as osgi bundle. Now I wrote a pom to wrap that jar as an osgi bundle. Now MyUtility.jar bundle headers look like this:
ESB :: Common :: MyUtility-jar-osgi (177)
-
Bnd-LastModified = 1285653669363
Build-Jdk = 1.6.0_18
Built-By = gaurav.x.nigam
Bundle-Description = MyUtility-jar-osgi wrapper OSGi bundle.
Bundle-ManifestVersion = 2
Bundle-Name = ESB :: Common :: auditlog-jar-osgi
Bundle-SymbolicName = MyUtility-jar-osgi
Bundle-Version = 0.0.0.main-SNAPSHOT
Created-By = Apache Maven Bundle Plugin
Export-Package = com.mylog;uses:="com.mypersist,com.mycommons,com.mypackage",com.mypersist;uses:="com.mypackage",com.mytest;uses:="com.mylog",com.mycommons;uses:="org.apache.log4j,javax.xml.bind,javax.xml.validation,gnu.getopt,org.xml.sax",com.mypackage;uses:="javax.xml.bind.annotation,javax.xml.bind,javax.xml.namespace,com.mycommons",gnu.getopt
Import-Package = javax.xml.bind,javax.xml.bind.annotation,javax.xml.namespace,javax.xml.validation,org.apache.log4j,org.xml.sax
Manifest-Version = 1.0
Tool = Bnd-0.0.357
But still I am getting the same exception. Am I missing anything here?
Gaurav
-
11. Re: "Unable to create context" error while using jaxb in servicemix 4.3
ffang Sep 28, 2010 2:22 AM (in response to ngaurav)Hi Gaurav,
Maybe you can set up remote debug for servicemix, and run the debug in Eclipse, step in the jaxb code, it would give you more idea what's going on there.
Freeman
-
12. Re: "Unable to create context" error while using jaxb in servicemix 4.3
sharma_arun_se1 Nov 16, 2010 11:03 AM (in response to ffang)Hi,
I hope somebody have solved this problem, as I can see there are number of posting for the problem but no real and satisfactory common solution to the problem.
Let me discuss my issue:
I have created jaxb bean as :
In my routeBuilder.java Class, I have create route as :
from(quartzUri)
.to(DataextracterUri)
.marshal(myjaxb)
.to(ftpServerURI);
Now for your concern, I verify you that my jaxb generated classes are in package: com.xyz.abc.xa.jaxb.generated. This include ObjectFactory.class. But there is nothing like jaxb.index inside it.
Why classloader not picking up the class ObjectFactory, although it is there in com.xyz.abc.xa.jaxb.generated package.
FYI: I am deploying my bundle using feature in ServiceMix 4.3--2.0
Error Log:
Caused by: javax.xml.bind.JAXBException: Unable to create context
- with linked exception:
http://java.lang.reflect.InvocationTargetException
at javax.xml.bind.ContextFinder.find(ContextFinder.java:68)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:77)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:73)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:69)
at com.vzb.ram.bind.ns.XmlPoJoUtil.toPoJo(XmlPoJoUtil.java:185)
... 54 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method):1.6.0_18
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39):1.6.0_18
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25):1.6.0_18
at java.lang.reflect.Method.invoke(Method.java:597):1.6.0_18
at javax.xml.bind.ContextFinder.find(ContextFinder.java:63)
... 58 more
Caused by: javax.xml.bind.JAXBException: "com.xyz.abc.xa.jaxb.generated" doesnt contain ObjectFactory.class or jaxb.index
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:197)
... 63 more
Thank you,
Arun Kumar (sharma_arun_se)
Edited by: sharma_arun_se on Nov 16, 2010 2:40 PM
Edited by: sharma_arun_se on Nov 16, 2010 4:02 PM
-
13. Re: "Unable to create context" error while using jaxb in servicemix 4.3
sharma_arun_se1 Nov 20, 2010 7:46 AM (in response to sharma_arun_se1)Hi All,
I have found alternative solution of my problem. If anybody face same kind of problem, I will be more than happy to discuss the solution.
Regards,
Arun Kumar (sharma_arun_se)
Expert SOA (Fuse ESB, Camel, ActiveMQ, OSGi) and RESTful Solution Architect, Open Source Contributor.
linkedin: http://in.linkedin.com/in/aronkumar