2014-05-14 124 views
0

我一直在撓頭腦幾個小時,似乎無法解決這個問題。我一直在關注如何開始使用Maven & Hibernate,關注thisthis。每次我對處女座的Tomcat的部署,我得到隨地吐痰以下錯誤出Spring與Spring的休眠問題Maven&Tomcat

An Import-Package could not be resolved. Caused by missing constraint in bundle <com.stuart.contextmanagement_0.1.0> constraint: <Import-Package: javassist.util.proxy; version="[3.18.0,4.0.0)">

所以我添加的Java協助在我pom的依賴,然後吐出來

An Import-Package could not be resolved. Caused by missing constraint in bundle 
com.stuart.contextmanagement_0.1.0> 
      constraint: <Import-Package: com.sun.jdi.request; version="0.0.0"> 

我可以」在搜索repo的時候找到上面的包。我以前也經歷過類似的問題,每次添加它找不到的新依賴項時,都找不到另一個依此類推......

我的pom的片段如下;

 <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-log4j12</artifactId> 
      <version>${slf4j.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <version>4.3.5.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>javassist</groupId> 
      <artifactId>javassist</artifactId> 
      <version>3.12.1.GA</version> 
     </dependency> 

感謝您的幫助。

+0

導入包基本上應用於OSGI環境。你能分享更多細節嗎?你也在運行OSGI嗎? –

+0

是的,我。不過,我終於整理了這個問題。我最終創建了另一個Maven項目,該項目導出了我可以在文檔中看到的更多依賴關係。 –

回答

1

嗯,你有沒有試過jboss javassist

+0

不,還是得到com.sun.jdi.request上的導入包未解決 –

+0

+1。我確實需要jboss javaassist,但也需要其他依賴項! –

0

我最終找到了解決方案。對於任何感興趣的人,我最終創建了另一個Maven項目並導出了其他幾個依賴項,而我看不到任何文檔或教程。以下是我的最終pom.xml的片段。

<dependencies> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>org.springframework.spring-library</artifactId> 
     <type>libd</type> 
     <version>3.0.5.RELEASE</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.jboss.javassist</groupId> 
     <artifactId>com.springsource.javassist</artifactId> 
     <version>3.15.0.GA</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.persistence</groupId> 
     <artifactId>com.springsource.javax.persistence</artifactId> 
     <version>2.0.0</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.persistence</groupId> 
     <artifactId>persistence-api</artifactId> 
     <version>1.0</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.annotation</groupId> 
     <artifactId>jsr250-api</artifactId> 
     <version>1.0</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.commons</groupId> 
     <artifactId>com.springsource.org.apache.commons.dbcp</artifactId> 
     <version>1.2.2.osgi</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>commons-collections</groupId> 
     <artifactId>commons-collections</artifactId> 
     <version>3.0</version> 
     <scope>compile</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.apache.derby</groupId> 
     <artifactId>com.springsource.org.apache.derby</artifactId> 
     <version>10.5.1000001.764942</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>com.springsource.org.hibernate</artifactId> 
     <version>3.3.2.GA</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>com.springsource.org.hibernate.annotations</artifactId> 
     <version>3.4.0.GA-A</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>com.springsource.org.hibernate.annotations.common</artifactId> 
     <version>3.3.0.ga</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.dom4j</groupId> 
     <artifactId>com.springsource.org.dom4j</artifactId> 
     <version>1.6.1</version> 
    </dependency> 
    <dependency> 
     <groupId>mysql</groupId> 
     <artifactId>mysql-connector-java</artifactId> 
     <version>5.1.9</version> 
     <scope>compile</scope> 
    </dependency> 
</dependencies>