0

`I'm trying to do basic configuration of Maven, Spring, Spring MVC, JPA with hibernate,c3p0, MySql and Jetty server once i start server I'm getting

ClassNotFoundException org.springframework.objenesis.ObjenesisException,

but I've also added "objenesis-1.2" dependency as i saw solution from net.

<properties>
        <java.version>1.7</java.version>
    </properties>

  <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>3.2.13.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.10</version>
        </dependency>
        <dependency>
            <groupId>com.mchange</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>3.2.13.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.7.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.10.Final</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.0.5</version>
        </dependency>
        <!-- EHCache Core APIs -->
        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache-core</artifactId>
            <version>2.4.3</version>
        </dependency>
        <!-- Hibernate EHCache API -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
            <version>4.3.10.Final</version>
        </dependency>
        <!-- <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>7.0.0.pre5</version>
        </dependency> -->
    </dependencies>


    <!-- Build section -->
    <build>
        <finalName>zz</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.6</version>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.1.v20120215</version>
                <configuration>
                    <stopKey></stopKey>
                    <stopPort>7864</stopPort>
                    <scanIntervalSeconds>6</scanIntervalSeconds>
                    <webAppSourceDirectory>src/main/webapp</webAppSourceDirectory>
                    <reload>manual</reload>
                    <webAppConfig>
                        <contextPath>/zz</contextPath>
                    </webAppConfig>
                    <connectors>
                        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                            <port>7773</port>
                            <maxIdleTime>60000</maxIdleTime>
                        </connector>
                    </connectors>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.objenesis</groupId>
                        <artifactId>objenesis</artifactId>
                        <version>1.2</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>`
Amit Kammar
  • 29
  • 1
  • 8

2 Answers2

1

This is the Objenesis version that is embedded in Spring. So you don't need the actual Objenesis jar. Which is normally in spring-core.

In your case, I think you have an incompatibility between your spring jar. The easiest solution is probably to upgrade everything to the latest spring version.

Henri
  • 5,551
  • 1
  • 22
  • 29
0

Please make sure the jar is in the boot classpath of the server. This is usually the server's lib or endorsed directory, not your application's WEB-INF/lib directory.

See if that solves your problem.

Hope this helps!

Prashant
  • 1,002
  • 13
  • 29
  • Why would you recomment putting the library in the server's lib? This is not a good practice. – Tunaki Oct 07 '15 at 07:14