Hi All,
I have still the problem:
java.lang.RuntimeException: javax.xml.bind.JAXBException:
"org.okkam.client.data" doesnt contain ObjectFactory.class or jaxb.index
and I don't know how to solve it.
Just to give a brief recap in my bundle I'm using a library which try to
interact with a WebService, so I cannot change the code which ask the
WebService for a particular service. All I (think I) can do is change
the manifest of my bundle.
If someone has any suggestion please let me know because I really don't
know what to do.
Andrea
Il 07/06/2010 17:55, Andrea Turbati ha scritto:
Thank you for the answer. But I'm not able to understand the meaning
of my error:
java.lang.RuntimeException: javax.xml.bind.JAXBException:
"org.okkam.client.data" doesnt contain ObjectFactory.class or jaxb.index
In the jar library I'm using the class file is in the right place, so
I can't understand why the bundle it's not able to find it. I'm
starting to believe that the error it is somewhere else (maybe I'm
using the manifest in a wrong way) and the error shown it is just a
side effect of the real error.
I cannot implement the answer you provided because the:
ObjectFactory.class
it is called within the OKKAM library, so in theory I'm should not be
able to change that library.
I'm searching for the reason to this error, more than a workaround,
because if in the future I will have to use a different library I
should not be worried about what code is inside it (as long as it is a
working one :-) ).
Thanks,
Andrea
Il 07/06/2010 16:41, Larry Touve ha scritto:
I posted this problem over on the Glassfish forum, and got the
following from Sahoo. I implemented the workaround and it works great.
======================================================================
I have actually filed a bug for this. See [1]. Vote for it please. I
don't know if there is any better way to solve it, but I faced it for
one of my GlassFish extension bundles and I worked around it like this:
import org.glassfish.internal.api.Globals;
import org.glassfish.internal.api.ClassLoaderHierarchy;
...
private JAXBContext getJAXBContext() throws JAXBException {
// We need to set context class loader to be
CommonClassLoader, otherwise our stupid JAXB implementation
// won't be able to locate the default JAXB context factory
class.
final Thread thread = Thread.currentThread();
ClassLoader oldCL = thread.getContextClassLoader();
try {
ClassLoader ccl =
Globals.get(ClassLoaderHierarchy.class).getCommonClassLoader();
thread.setContextClassLoader(ccl);
JAXBContext jc =
JAXBContext.newInstance(ObjectFactory.class);
return jc;
} finally {
thread.setContextClassLoader(oldCL);
}
}
You will have to add the following dependency to compile though:
<dependency>
<groupId>org.glassfish.common</groupId>
<artifactId>internal-api</artifactId>
<version>${project.version}</version>
</dependency>
I don't think you can apply this work around in your code - it has
too much dependency on glassfish internals.
Thanks,
Sahoo
[1] https://glassfish.dev.java.net/issues/show_bug.cgi?id=11748
Larry
-----Original Message-----
From: Andrea Turbati [mailto:[email protected]]
Sent: Monday, June 07, 2010 6:06 AM
To: [email protected]
Subject: ObjectFactory.class or jaxb.index
Hi,
I've presented this problem in another discussion, which started from a
totally different one, so I've decided to open a new discussion with
the
hope to solve it.
In my bundle I'm trying to use a a library which it's using a
webservice
(the OKKAM webservice).
When the bundle invoke a class from the library I have the following
error:
java.lang.RuntimeException: javax.xml.bind.JAXBException:
"org.okkam.client.data" doesnt contain ObjectFactory.class or
jaxb.index
at org.okkam.client.util.XMLEntityConverter.init(Unknown Source)
at org.okkam.client.util.XMLEntityConverter.xmlToEntity(Unknown
Source)
at
it.uniroma2.art.maskkot.osgi.service.Maskkot.inquireOkkamForIds(Maskkot.
java:130)
Doing a search on internet I've found this site:
http://stackoverflow.com/questions/1043109/why-cant-jaxb-find-my-jaxb-
index-when-running-inside-apache-felix
(It appears to be a similar problem)
I've checked in the jar library which is inside my bundle and I've
found
that in the package org.okkam.client.data the file ObjectFactory.class
exixts (but not the file jaxb.index), so I really don't understand the
meaning of that error.
My application is a bit particular, because the main java application
(the one with the Felix instance) is run from inside Firefox as an
estension and my bundle is an extension to both Firefox and to
Felix. So
the main java application is not able to see the normal classpath,
but I
have to explicitely list all the jar library, so maybe this is part of
the problem.
Thanks
Andrea
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.819 / Virus Database: 271.1.1/2899 - Release Date:
06/07/10
02:35:00
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
-------------------------------------------------
Dott. Andrea Turbati
AI Research Group PhD student,
Dept. of Computer Science, Systems and Production
University of Roma, Tor Vergata
Via del Politecnico 1 00133 ROMA (ITALY)
tel: +39 06 7259 7332 (lab)
e_mail: [email protected]
home page: http://art.uniroma2.it/turbati/
--------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]