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. I've even tried to export org.okkam.client.data in the manifest and the import it but I have the same error

Maybe I'm doing something wrong with the manifest (at the moment this is the only solution which come to my mind), so I'll post in this message:

Manifest-Version: 1.0
Embed-Directory: lib
Bundle-ClassPath: .,
 lib/okkam-proxy-1.0.jar,
 lib/okkam-client-2.0.0.1.jar,
 lib/commons-logging-1.0.4.jar,
Built-By: Andrea
Tool: Bnd-0.0.357
Bundle-Name: Maskkot
Created-By: Apache Maven Bundle Plugin
Build-Jdk: 1.6.0_20
Bundle-Version: 0.0.2.SNAPSHOT
Bnd-LastModified: 1273753798793
Bundle-ManifestVersion: 2
Bundle-Activator: it.uniroma2.art.maskkot.osgi.bundle.MaskkotBundle
Bundle-Description: A plugin for integrate Semantic Turkey and Okkam s
 ystem
Embed-Dependency: !semanticturkey
Export-Package: org.okkam.client.data
Import-Package: javax.jws, com.sun.xml.internal.ws.developer,
 com.sun.xml.internal.ws.api.message, org.okkam.client.data,
 com.google.common.base,com.google.common.collect,it.
 uniroma2.art.owlart.exceptions,it.uniroma2.art.owlart.filter,it.uniro
 ma2.art.owlart.io,it.uniroma2.art.owlart.model,it.uniroma2.art.owlart
 .models,it.uniroma2.art.owlart.models.impl,it.uniroma2.art.owlart.nav
 igation,it.uniroma2.art.owlart.query,it.uniroma2.art.owlart.query.io,
 it.uniroma2.art.owlart.resources,it.uniroma2.art.owlart.utilities,it.
 uniroma2.art.owlart.vocabulary,it.uniroma2.art.semanticturkey,it.unir
 oma2.art.semanticturkey.exceptions,it.uniroma2.art.semanticturkey.fil
 ter,it.uniroma2.art.semanticturkey.ontology,it.uniroma2.art.semantict
 urkey.plugin,it.uniroma2.art.semanticturkey.plugin.extpts,it.uniroma2
 .art.semanticturkey.project,it.uniroma2.art.semanticturkey.resources,
 it.uniroma2.art.semanticturkey.servlet,it.uniroma2.art.semanticturkey
 .utilities,it.uniroma2.art.semanticturkey.vocabulary,javax.activation
 ,javax.annotation,javax.crypto,javax.crypto.interfaces,javax.crypto.s
 pec,javax.xml,javax.xml.bind,javax.xml.bind.annotation,
 javax.xml.bind.an
 notation.adapters,javax.xml.bind.attachment,javax.xml.bind.helpers,ja
 vax.xml.bind.util,javax.xml.datatype,javax.xml.namespace,javax.xml.pa
 rsers,javax
 .xml.soap,javax.xml.stream,javax.xml.stream.events,javax.xml.stream.u
 til,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.s
 ax,javax.xml.transform.stream,javax.xml.validation,javax.xml.ws,javax
 .xml.ws.handler,javax.xml.ws.handler.soap,javax.xml.ws.http,javax.xml
 .ws.soap,javax.xml.ws.spi,org.osgi.framework;version="1.4",
 org.w3c.dom,org.w3c.dom.ls,org.w3c.dom.traversal,
 org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers,
Bundle-SymbolicName: maskkot



Thanks,

Andrea

Il 26/05/2010 10:58, Andrea Turbati ha scritto:
I've done some testing and moving aroung some library (I've put the library rt.jar in the main application and not in the bundle), but now I've got a different problem:

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

where someone said:

"JAXB can't find jaxb.index, because by default, newInstance(String) uses the current thread's class loader (as returned by Thread.getContextClassLoader()). This doesn't work inside Felix, because the OSGi bundles and the framework's threads have separate class loaders.

The solution is to get a suitable class loader from somewhere and use newInstance(String, ClassLoader). I got a suitable class loader from one of the classes in the package that contains jaxb.index, a sensible choice for flexibility reasons probably is ObjectFactory:

ClassLoader cl = my.package.name.ObjectFactory.class.getClassLoader();
JAXBContext jc = JAXBContext.newInstance("my.package.name", cl);

Maybe you could also get at the class loader that the Bundle instance is using, but I couldn't figure out how, and the above solution seems safe to me."


I've quite understand his solution, but I'm not able to implemented it because in my case the code that does the newInstance request is inside a third party jar which it is inside my bundle, so I'm not able to change the code.

Does someone have any suggestions because  I'm really stuck.

Thanks,

Andrea


Il 20/05/2010 12:05, Andrea Turbati ha scritto:
Thank you for the answer.

I add in the manifest javax.jws in the Import-Package and now it seems that I've resolved that problem, but a new one has appeared:

GRAVE: interface com.sun.xml.internal.ws.developer.WSBindingProvider is not visible from class loader java.lang.IllegalArgumentException: interface com.sun.xml.internal.ws.developer.WSBindingProvider is not visible from class loader
    at java.lang.reflect.Proxy.getProxyClass(Unknown Source)
    at java.lang.reflect.Proxy.newProxyInstance(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(Unknown Source) at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source) at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source) at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at javax.xml.ws.Service.getPort(Unknown Source)
at org.okkam.core.ws.WebServicesService.getWebServicesPort(WebServicesService.java:56)


And I don't understand the reason because in my bundle I've put in the directory lib the library rt.jar and in the manifest I have:

Bundle-ClassPath: .,
 lib/rt.jar,
 lib/okkam-proxy-1.0.jar,
 lib/okkam-client-2.0.0.1.jar,
 lib/commons-logging-1.0.4.jar,


So I don't undestand the reason of the "not visible from class loader" error.

By the way to which class loader is the error refearing to? I think it should be the bundle classloader, but that classloader should have access to that interface

Thanks,

Andrea


Il 19/05/2010 18:59, Richard S. Hall ha scritto:
See the FAQ:

http://felix.apache.org/site/apache-felix-osgi-faq.html

Perhaps your annotation packages are not available to your bundle.

-> richard

On 5/19/10 6:48, Andrea Turbati wrote:
Hi,
In my bundle I'm trying to use a library (Okkam library) to retrieve same information from a web service and I get the following error:

com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: org.okkam.core.ws.WebServices at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(Unknown Source) at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(Unknown Source) at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(Unknown Source) at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source) at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source) at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at javax.xml.ws.Service.getPort(Unknown Source)
at org.okkam.core.ws.WebServicesService.getWebServicesPort(WebServicesService.java:56) at org.okkam.proxyclient.WebServicesClientManager.createOkkamWebServiceInstance(WebServicesClientManager.java:57) at org.okkam.proxyclient.WebServicesClientManager.<init>(WebServicesClientManager.java:44)
    at org.okkam.client.wsclient.EnsPublicClient.init(Unknown Source)
at org.okkam.client.wsclient.EnsPublicClient.<init>(Unknown Source)
    ....


I'm not very prepared on WebServices, so I don't know what I'm doing wrong and how can I solved it. The some code works in an non-OSGi enviroment.

I've also tried to include in the bundle various library from jdk1.6.0_20\jre\lib (and also change the manifest accordingly) but the error remain the same.

Thanks,

Andrea

---------------------------------------------------------------------
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]




---------------------------------------------------------------------
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]

Reply via email to