Solution to exceptions in the "an import-package cocould not be resolved" class on the virgo Server

Source: Internet
Author: User

Recently, Virgo was used to develop basic osgi projects. The most common exception reported during Environment setup was that the exception started with "An import-package cocould not be resolved, according to your understanding and actual problems, there are two causes of some class exceptions:

First, different bundle names are introduced in the environment, but the bundle-symbolicname in manifest. MF of multiple bundle components is the same. Of course, this exception is easy to find;

Second: most of the cases are caused by different versions of packages referenced by bundle.

A. You can download compatible packages.

B. If no compatible package is found, the following exception is reported in the project:

An import-package cocould not be resolved. Caused by missing constraint in bundle <eap_framework_1.0.0>
Constraint: <import-package: Org. hibernate. loader. collection; version = "0.0.0"> constrained to bundle <com.springsource.org. hibernate> constrained bundle version range "[3.3.1.ga, 3.3.1.ga]" an import-package cocould not be resolved. caused by missing constraint in bundle <com.springsource.org. hibernate_3.3.1.ga>
Constraint: <import-package: org. slf4j; version = "[1.5.2, 1.6.0)">
The preceding two exceptions of the same type result in <eap_framework_1.0.0> component and <com.springsource.org component. hibernate> cannot be loaded because 1: The component <eap_framework_1.0.0> cannot be loaded because the component Org. hibernate. loader. the collection package cannot be found, and this package is composed of components <com.springsource.org. hibernate>, that is, the dependent component <com.springsource.org. hibernate> cause 2: component <com.springsource.org. hibernate_3.3.1.ga> cannot be loaded (started) because the imported package Org. slf4j fails to be found, and the org. the slf4j package version is between 1.5.2 and 1.6.0. from the above two reasons, we can see that exception 2 is the cause of exception 1, that is, exception 2 is solved. component 1 fails to be loaded because component 2 fails to be loaded, and component 2 fails to be loaded because the appropriate version of org cannot be found. slf4j package, so <com.springsource.org. for components, find the org. slf4j components or packages. Let's look back at your Virgo-Tomcat-server directory \ repository \'s ext and usr directories to see if there is a suitable package that contains org. slf4j components (cannot be found or the version is not between 1.5.2 and 1.6.0), both of which are available in my directories, but neither of which is: COM. springsource. slf4j. api-1.5.0.jar and COM. springsource. slf4j. api-1.6.1.jar, (typically downloaded in a way)
The two versions I downloaded do not meet the requirements of [1.5.2-1.6.0]. Because one version is 1.5.0 and the other version is 1.6.1, an error is always reported, I didn't find the bundle version suitable for slf4j at the time. This exception left me four hours in the afternoon and four hours in the evening, and I was able to solve it with the help of my colleagues! I think he is smart as follows: the most basic cause of the error is com.springsource.org. hibernate-3.3.1.GA.jar manifest in this bundle. org. the slf4j package requires a version between [1.5.2-1.6.0], and the version of the slf4j component package in the ext and usr directories in the virgo-tomcat-server-3.0.3.RELEASE \ repository \ directory is not in this range, therefore, an exception is reported if it does not meet the requirements. solution: Modify the scope of requirements for org. slf4j in manifest. MF in com.springsource.org. hibernate-3.3.1.GA.jar in this bundle, as shown in:


It should solve this problem. The post is a little too long, but it is always better to understand it. Some posts are original. Please indicate the source for reprinting!

Solution to exceptions in the "an import-package cocould not be resolved" class on the virgo Server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.