-
1. Re: Getting "java.lang.ClassNotFoundException" while creating JAXBContext instance
thomas.diesler Sep 11, 2012 5:04 AM (in response to sivaram123)You can monitor/vote on https://issues.jboss.org/browse/AS7-5531
-
2. Re: Getting "java.lang.ClassNotFoundException" while creating JAXBContext instance
sivaram123 Sep 11, 2012 10:18 AM (in response to thomas.diesler)Hi Thomas,
Thank You for the response. Is there any other way to access these jaxb libraries at the moment.
-
3. Re: Getting "java.lang.ClassNotFoundException" while creating JAXBContext instance
sivaram123 Oct 4, 2012 3:07 AM (in response to sivaram123)Hi Thomas,
I have checked the issue here https://issues.jboss.org/browse/AS7-5531 as it is in the resolved status. I have downloaded the jboss 7.2.0.Alpha1 and getting the following errors while creating the JAXBContext:
JBOSGI011026: Framework Error: org.osgi.framework.BundleException: JBOSGI011254: Cannot start bundle: SimpleJaxb:1.0.0.201210041208
at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:352) [jbosgi-framework-core-2.0.0.CR29.jar:2.0.0.CR29]
at org.jboss.osgi.framework.internal.HostBundleState.startInternal(HostBundleState.java:246) [jbosgi-framework-core-2.0.0.CR29.jar:2.0.0.CR29]
at org.jboss.osgi.framework.internal.AbstractBundleState.start(AbstractBundleState.java:521) [jbosgi-framework-core-2.0.0.CR29.jar:2.0.0.CR29]
at org.jboss.osgi.framework.internal.StartLevelPlugin.increaseStartLevel(StartLevelPlugin.java:270) [jbosgi-framework-core-2.0.0.CR29.jar:2.0.0.CR29]
at org.jboss.osgi.framework.internal.FrameworkActive.start(FrameworkActive.java:136) [jbosgi-framework-core-2.0.0.CR29.jar:2.0.0.CR29]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl
at com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:65)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:133)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:85)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(ModelBuilder.java:156)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:93)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:450)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1163)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_26]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_26]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211) [rt.jar:1.6.0_26]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:392) [rt.jar:1.6.0_26]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618) [rt.jar:1.6.0_26]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:565) [rt.jar:1.6.0_26]
at simplejaxb.Activator.start(Activator.java:17)
at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:326) [jbosgi-framework-core-2.0.0.CR29.jar:2.0.0.CR29]
... 9 more
12:10:14,545 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."SimpleJaxb_1.0.0.201210041208.jar".Activate: org.jboss.msc.service.StartException in service jboss.deployment.unit."SimpleJaxb_1.0.0.201210041208.jar".Activate: JBAS011968: Cannot start bundle: SimpleJaxb:1.0.0.201210041208
at org.jboss.as.osgi.deployment.BundleActivateProcessor$BundleActivateService.start(BundleActivateProcessor.java:137)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
Caused by: org.osgi.framework.BundleException: JBOSGI011254: Cannot start bundle: SimpleJaxb:1.0.0.201210041208
at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:352)
at org.jboss.osgi.framework.internal.HostBundleState.startInternal(HostBundleState.java:246)
at org.jboss.osgi.framework.internal.AbstractBundleState.start(AbstractBundleState.java:521)
at org.jboss.as.osgi.deployment.BundleActivateProcessor$BundleActivateService.start(BundleActivateProcessor.java:134)
... 5 more
Caused by: java.lang.Error: Failed to initialize JAXP 1.3 DatatypeFactory class.
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.init(RuntimeBuiltinLeafInfoImpl.java:905)
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(RuntimeBuiltinLeafInfoImpl.java:899)
at com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:65)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:133)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:85)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(ModelBuilder.java:156)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:93)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:450)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1163)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_26]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_26]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211) [rt.jar:1.6.0_26]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:392) [rt.jar:1.6.0_26]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618) [rt.jar:1.6.0_26]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:565) [rt.jar:1.6.0_26]
at simplejaxb.Activator.start(Activator.java:17)
at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:326)
... 8 more
Caused by: javax.xml.datatype.DatatypeConfigurationException: Provider __redirected.__DatatypeFactory not found
at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:137) [rt.jar:1.6.0_26]
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.init(RuntimeBuiltinLeafInfoImpl.java:903)
... 29 more
Caused by: java.lang.ClassNotFoundException: __redirected/__DatatypeFactory
at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_26]
at java.lang.Class.forName(Class.java:247) [rt.jar:1.6.0_26]
at javax.xml.datatype.FactoryFinder.getProviderClass(FactoryFinder.java:121) [rt.jar:1.6.0_26]
at javax.xml.datatype.FactoryFinder.newInstance(FactoryFinder.java:146) [rt.jar:1.6.0_26]
at javax.xml.datatype.FactoryFinder.find(FactoryFinder.java:187) [rt.jar:1.6.0_26]
at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:131) [rt.jar:1.6.0_26]
... 30 more
12:10:14,554 INFO [org.jboss.osgi.framework] (MSC service thread 1-4) JBOSGI011000: OSGi Framework started
12:10:14,561 INFO [org.jboss.web] (MSC service thread 1-4) JBAS018210: Register web context: /httpservice
12:10:14,565 ERROR [SimpleJaxb] (Thread-68) FrameworkEvent ERROR: org.apache.felix.log.LogException: org.osgi.framework.BundleException: JBOSGI011254: Cannot start bundle: SimpleJaxb:1.0.0.201210041208
at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:352)
at org.jboss.osgi.framework.internal.HostBundleState.startInternal(HostBundleState.java:246)
at org.jboss.osgi.framework.internal.AbstractBundleState.start(AbstractBundleState.java:521)
at org.jboss.osgi.framework.internal.StartLevelPlugin.increaseStartLevel(StartLevelPlugin.java:270)
at org.jboss.osgi.framework.internal.FrameworkActive.start(FrameworkActive.java:136)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl
at com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:65)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:133)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:85)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(ModelBuilder.java:156)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:93)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:450)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1163)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_26]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_26]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211) [rt.jar:1.6.0_26]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:392) [rt.jar:1.6.0_26]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618) [rt.jar:1.6.0_26]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:565) [rt.jar:1.6.0_26]
at simplejaxb.Activator.start(Activator.java:17)
at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:326)
... 9 more
In my application i need to create the jaxb context object in the stating phase of the bundle(In Activators start method). I am getting the above exception. Is this issue is resolved in the new version ?.
Kindly please guide me as i need it urgently for my application. I am attaching the bundle and the source code that i am testing.
Regards,
Siva Ram.
-
Activator.java.zip 494 bytes
-
Bookstore.java.zip 535 bytes
-
Book.java.zip 559 bytes
-
-
4. Re: Getting "java.lang.ClassNotFoundException" while creating JAXBContext instance
thomas.diesler Oct 4, 2012 4:21 AM (in response to sivaram123)This might be the root cause
Caused by: java.lang.ClassNotFoundException: __redirected/__DatatypeFactory
at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_26]
at java.lang.Class.forName(Class.java:247) [rt.jar:1.6.0_26]
at javax.xml.datatype.FactoryFinder.getProviderClass(FactoryFinder.java:121) [rt.jar:1.6.0_26]
at javax.xml.datatype.FactoryFinder.newInstance(FactoryFinder.java:146) [rt.jar:1.6.0_26]
at javax.xml.datatype.FactoryFinder.find(FactoryFinder.java:187) [rt.jar:1.6.0_26]
at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:131) [rt.jar:1.6.0_26]
jboss-modules provides these JAXP redirects. It is possible that the module that loads javax.xml.datatype.DatatypeFactory does not have a wire to org.jboss.modules
It is also possible that there is some invalid TCCL involved in the discovery.
Gernerally, many of these JRE APIs use the TCCL for discovery of their respective implementations, which is obviously not going to work in an OSGi environment.
There is a variant
JAXBContext.newInstance(String contextPath, ClassLoader classLoader)
that takes an explicit CL. Maybe that would help if this is related to some TCCL issue.
If you look at the test case, this is how I do it
JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class.getPackage().getName(), ObjectFactory.class.getClassLoader());
-
5. Re: Getting "java.lang.ClassNotFoundException" while creating JAXBContext instance
sivaram123 Oct 4, 2012 9:38 AM (in response to thomas.diesler)HI Thomas,
I have tried in that way also by creating jaxb context using package name and class loader. Getting the same above error response don't know how to resolve this error.
Added the below line in the code getting the same exception above:
JAXBContext jcontext = JAXBContext.newInstance(Bookstore.class.getPackage().getName(), Bookstore.class.getClassLoader());
Kindly help me resolving this issue. Is it a problem in my code. Do i need to add any extra configurations.
Kind Regards,
Siva Ram.
-
6. Re: Getting "java.lang.ClassNotFoundException" while creating JAXBContext instance
thomas.diesler Oct 7, 2012 11:15 PM (in response to sivaram123)In that case we need to step back a little and work on a test case that allows us to repoduce the issue. Could you perhaps provide a patch to the existing jaxb test case or a variant of it?
-
7. Re: Getting "java.lang.ClassNotFoundException" while creating JAXBContext instance
sivaram123 Oct 8, 2012 7:10 AM (in response to thomas.diesler)Hi Thomas,
Here i am attacing the bundle and the eclipse project source code for the sample bundle. By deploying the bundle in the server we can see the error we are getting.
Kindly find the attached files.
-
SimpleJaxb.zip 11.6 KB
-