I am getting uses constraint violation as below while installing a feature in Apache Karaf (karaf framework is felix and version is 4.2.1)
could not be resolved. Reason: Package uses conflict: Import-Package: org.apache.http.entity; version="0.0.0"
After googling , came to know that "Dependency Chain" can help in root causing the issue. but I do not know the steps to follow to get this dependency chain printed in the logs or osgi console
Example Dependency chain is given in the below URL:
Dependency chain conflicts for Hibernate and Apache Felix
Thanks in advance
If you use the felix framework this should be printed either on the console and/or in the logfile while starting the bundle.
With Karaf you also can take a look at bundle:tree-show [bundle-id]. This will show you all bundles your bundle depends on.
Related
I am migration Java Web Application from jboss 6.0 to wildfly 11. I am getting
"java.lang.ClassCastException: __redirected.__XMLInputFactory cannot
be cast to org.codehaus.stax2.XMLInputFactory2" while running the code
on wildfly 11.0.0.Final. Junit tests are working without error.
Looks like there is some dependency issue in wildfly but unable to find any solution. Appreciate any help to resolve this issue..
I have included following woodstox dependencies in pom.
woodstox-core-asl 4.4.1
stax2-api 3.1.4
Thanks
Sanjay
This is caused by duplicate classes in the classpath.
Wildfly ships stax2-api as part of the woodstocks module, see modules/system/layers/base/org/codehaus/woodstox/main/ in the wildfly dist folder.
If you also have it in your application's lib folder, this will cause issues.
The solution is to either set the dependency to <scope>provided</scope> (or build) in pom.xml, or if you really need a special version, exclude wildfly's module via jboss-deployment-structure.xml.
See https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly for more information on classloading in Wildfly.
I am trying to implement JPA using DataNucleus in an OSGI Environment (Apache ServiceMix). I am following the guide mentioned here - http://www.datanucleus.org/products/datanucleus/jpa/osgi.html (Section under Name "JPA and OSGi")
As per the documentation here I am using the DataNucleus JPA jar. So I have Deployed this Jar on ServiceMix as follows -
osgi:install mvn:org.datanucleus/datanucleus-jpa/2.1.7
osgi:start bundleId
As this jar export the persistence provider,I have correctly changed the provider in my persistence.xml file to be org.datanucleus.jpa.PersistenceProviderImpl (which is exported by the above bundle) rather than usual org.datanucleus.api.jpa.PersistenceProviderImpl which is in a normal J2EE JPA APP.
I also have the DataNucleus Core Bundle running on my ServiceMix, which was installed on my ServiceMix using the following -
osgi:install mvn:org.datanucleus/datanucleus-core/4.0.0-release
osgi:start bundleId
Please Note: I donot have the datanucleus-api-jpa bundle running on my ServiceMix, as per the documentation, the datanucleus-jpa bundle would export the necessary classes and hence datanucleus-api-jpa bundle would not be required.
At runtime, I am getting the following error Caused by: java.lang.ClassNotFoundException: org.datanucleus.PersistenceConfiguration not found by org.datanucleus.jpa [261]
What I have noticed is that the DataNucleus Core version 4.0.0-release does not have this class, but this class exists in all previous releases (3.2.15).
I cannot deploy DataNucleus Core Version 3.2.XX onto my ServiceMix, because I have other bundles using DataNucleus Core 4.0.0-release and having both is not an option because of Singleton Creation problems.
Please let me know, if you need me to post my code, I will do so.
Please help
Cheers,
Abhijit
In conclusion, you are using incorrect/invalid jars. "datanucleus-jpa" was removed back in v2 of DataNucleus. All recent versions using "datanucleus-api-jpa" (or "datanucleus-api-jdo" if using JDO). A simple download of the DataNucleus zip file for 4.0.x would show this very clearly.
I am trying to get a Scala library using H2 database loading in Karaf 3.0.0-RC1 and I got this error
Unresolved constraint in bundle org.h2 [86]: Unable to resolve 86.0: missing requirement
[86.0] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.jdbc)(version>=1.0.0)
Does anyone know what I need to add to POM and / or feature.xml to get this working?
Thanks,
Bob
You need that jar that contains the package. To get it:
go to http://search.maven.org
Push Advanced search
To the Classname, type "org.osgi.service.jdbc"
You will get a list of dependencies that contain the package. For example, the first one will be good for you: http://search.maven.org/#artifactdetails|org.ow2.spec.osgi|ow2-jdbc-service-1.0-spec|1.0.13|bundle
Btw.: The package originally comes from the OSGi enterprise spec (or compendium, do not remember). As much as I saw all of the OSGi spec packages are available in ow2 dependencies that separated logically.
In Karaf, there might be other ways to get the dependency you need but I did not use Karaf in the past.
I am trying to upgrade an old project from Spring 2.5.6 to Spring 3.1.0. The project is not built with Maven so I had to add the jars manually to the build path.
The application uses Eclipse RAP as well as Spring.
I added all the Spring 3.1 jars in my build path:
lib/org.springframework.aop-3.1.0.RELEASE.jar
lib/org.springframework.asm-3.1.0.RELEASE.jar
lib/org.springframework.aspects-3.1.0.RELEASE.jar
lib/org.springframework.beans-3.1.0.RELEASE.jar
lib/org.springframework.context-3.1.0.RELEASE.jar
lib/org.springframework.context.support-3.1.0.RELEASE.jar
lib/org.springframework.core-3.1.0.RELEASE.jar
lib/org.springframework.expression-3.1.0.RELEASE.jar
lib/org.springframework.instrument-3.1.0.RELEASE.jar
lib/org.springframework.instrument.tomcat-3.1.0.RELEASE.jar
lib/org.springframework.jdbc-3.1.0.RELEASE.jar
lib/org.springframework.jms-3.1.0.RELEASE.jar
lib/org.springframework.orm-3.1.0.RELEASE.jar
lib/org.springframework.oxm-3.1.0.RELEASE.jar
lib/org.springframework.test-3.1.0.RELEASE.jar
lib/org.springframework.transaction-3.1.0.RELEASE.jar
lib/org.springframework.web-3.1.0.RELEASE.jar
lib/org.springframework.web.portlet-3.1.0.RELEASE.jar
lib/org.springframework.web.servlet-3.1.0.RELEASE.jar
lib/org.springframework.web.struts-3.1.0.RELEASE.jar
and I also listed them in the MANIFEST.MF.
The project builds fine, but at runtime when trying to login it gives me the following error:
java.lang.NoClassDefFoundError: org/springframework/beans/factory/ListableBeanFactory
I looked in the beans jar and the class is definitely there. I also searched through the project and the class is not used explicitly anywhere.
What could cause this? Thank you in advance.
This class does not exist in Spring 3.1.0. See http://www.jarfinder.com/index.php/java/info/org.springframework.beans.factory.ListableBeanFactory
I'm trying to run the region digraph bundle of Equinox in Eclipse IDE. When I run the relevant bundle using start command in OSGi command prompt, I'm getting an error saying
The bundle could not be resolved. Reason: Missing Constraint: Import-Package: org.osgi.framework.hooks.bundle; version="1.0.0". To find out the existing version in the framework, I tried the command p org.osgi.framework.hooks.bundle. The result shows all the bundles in the framework. In that list org.osgi.framework.hooks.bundle is not there. This is the same case for few other bundles such as
org.osgi.framework.hooks.resolver. Any helps about how to fix this issue??
What version of Eclipse are you using?
The org.osgi.framework.hooks.bundle package was added in OSGi Release 4.3, and so you would need a version of Eclipse that supports that, which would be at least Eclipse 3.7 (Indigo).