简体   繁体   中英

Hibernate Issue with Spring Maven & Tomcat

I have been scratching my head for a few hours and can't seem to solve this issue. I have been following several tutorials on getting started with Maven & Hibernate, following this and this . Each time I deploy on Virgo Tomcat, I get the following error spitting out

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

So I added Java Assist as a dependency in my pom, then is spat out

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

I can't find the above package when searching through repo's. I have also experienced a similar issue before, and every time I add a new dependency which it can't find, it can't find another one and so on...

A snippet of my pom is as follows;

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

Thanks for your help.

嗯,您也尝试过jboss javassist吗?

I ended up finding a solution. For any one who's interested, I ended up creating another maven project and exporting several other dependencies than I could see any any documentation or tutorial. Below is the snippet of my final 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM