Spring Maven的Hibernate问题& Tomcat的

时间:2014-05-14 15:26:26

标签: java spring hibernate maven tomcat

我一直在挠头几个小时似乎无法解决这个问题。我一直在关注Maven& amp; Hibernate,关注thisthis。每次我在Virgo 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)">

所以我在我的pom中添加了Java Assist作为依赖,然后吐出

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

在搜索回购时我找不到上面的包。我以前也遇到过类似的问题,每次添加一个找不到的新依赖项时,都找不到另一个依赖等等......

我的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>

感谢您的帮助。

2 个答案:

答案 0 :(得分:1)

嗯,你有没有试过jboss javassist

答案 1 :(得分: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>