Java: Klasse Nicht Gefunden: net.sf.cglib.proxy.MethodInterceptor

Also ich habe das alte app und ich bin derzeit immer dieser Fehler beim ausführen von geplanten Aufgaben (siehe Ausnahme).

Erlebte ich irgendwie das gleiche Problem vor und ich löste es durch den Ausschluss cglib aus jersey (siehe pom.xml). Aber jetzt scheint es, dass diese betroffenen einen anderen Teil der app.

Irgendwelche Ideen?

UPDATE: Das Projekt nutzt java 1.6

Ausnahme:

ERROR at org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler.handleError(:95) Unexpected error occurred in scheduled task.
    java.lang.NoClassDefFoundError: net/sf/cglib/proxy/MethodInterceptor
            at org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.initialize(ServiceLocatorGeneratorImpl.java:71)
            at org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.create(ServiceLocatorGeneratorImpl.java:96)
            at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.internalCreate(ServiceLocatorFactoryImpl.java:251)
            at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.create(ServiceLocatorFactoryImpl.java:228)
            at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:142)
            at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:113)
            at org.glassfish.jersey.internal.RuntimeDelegateImpl.<init>(RuntimeDelegateImpl.java:60)
            at sun.reflect.GeneratedConstructorAccessor439.newInstance(Unknown Source)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:534)
            at java.lang.Class.newInstance(Class.java:379)
            at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:117)
            at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:207)
            at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:135)
            at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:120)
            at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:95)
            at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)
            at org.glassfish.jersey.client.JerseyWebTarget.<init>(JerseyWebTarget.java:72)
            at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:180)
            at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:69)
            [Some app method calling a REST service]..
            at sun.reflect.GeneratedMethodAccessor998.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:622)
            at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64)
            at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
            at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
            at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
            at java.lang.Thread.run(Thread.java:701)
    Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.MethodInterceptor
            at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858)
            at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
            ... 35 more

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    ....
    <modules>
        ....
    </modules>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-idea-plugin</artifactId>
                    <version>2.2-fixed</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-idea-plugin</artifactId>
                <version>2.2</version>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <useFile>false</useFile>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        ...

        <repository>
            <id>official1</id>
            <name>Official Maven Repository Mirror 1</name>
            <url>http://repo1.maven.org/maven2</url>
            <releases>
                <!--<checksumPolicy>false</checksumPolicy>-->
                <updatePolicy>never</updatePolicy>
            </releases>
        </repository>

        <repository>
            <id>official2</id>
            <name>Official Maven Repository Mirror 2</name>
            <url>http://repo2.maven.org/maven2</url>
            <releases>
                <!--<checksumPolicy>false</checksumPolicy>-->
                <updatePolicy>never</updatePolicy>
            </releases>
        </repository>
    </repositories>

    <pluginRepositories>
        ...
        ...
    </pluginRepositories>

    <properties>
        <spring.version>3.2.14.RELEASE</spring.version>
        <org.spring.security.version>3.2.8.RELEASE</org.spring.security.version>
        <cxf.version>2.1</cxf.version>
        <gwtVersion>1.5.3</gwtVersion>
        <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            ...
            <!-- END internal modules -->

            <dependency>
                <groupId>org.apache.ws.commons.axiom</groupId>
                <artifactId>axiom-impl</artifactId>
                <version>1.2.7</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>geronimo-javamail_1.4_spec</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>geronimo-activation_1.1_spec</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>jaxen</groupId>
                        <artifactId>jaxen</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.ws.commons.axiom</groupId>
                <artifactId>axiom-api</artifactId>
                <version>1.2.7</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>geronimo-javamail_1.4_spec</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>geronimo-activation_1.1_spec</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>jaxen</groupId>
                        <artifactId>jaxen</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- Spring Framework -->
            <dependency>
                <groupId>aopalliance</groupId>
                <artifactId>aopalliance</artifactId>
                <version>1.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.xmlbeans</groupId>
                <artifactId>xmlbeans</artifactId>
                <version>2.4.0</version>
            </dependency>

            <dependency>
                <groupId>wsdl4j</groupId>
                <artifactId>wsdl4j</artifactId>
                <version>1.6.1</version>
            </dependency>

            <dependency>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2</artifactId>
                <version>1.3</version>
            </dependency>

            <dependency>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
                <version>1.3</version>
            </dependency>

            <dependency>
                <groupId>org.apache.ws.commons.schema</groupId>
                <artifactId>XmlSchema</artifactId>
                <version>1.4.5</version>
            </dependency>

            <dependency>
                <groupId>backport-util-concurrent</groupId>
                <artifactId>backport-util-concurrent</artifactId>
                <version>3.1</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${spring.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>${spring.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${spring.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context-support</artifactId>
                <version>${spring.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
                <version>${spring.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${spring.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${spring.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>${spring.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-tx</artifactId>
                <version>${spring.version}</version>
            </dependency>

            <!-- Apache CXF -->
            <dependency>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
                <version>2.1</version>
            </dependency>

            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-core</artifactId>
                <version>${cxf.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-frontend-jaxws</artifactId>
                <version>${cxf.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-databinding-jaxb</artifactId>
                <version>${cxf.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-transports-http</artifactId>
                <version>${cxf.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-management</artifactId>
                <version>${cxf.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-common-utilities</artifactId>
                <version>${cxf.version}</version>
            </dependency>

            <!-- JSP Libraries -->
            <dependency>
                <groupId>org.ajaxtags</groupId>
                <artifactId>ajaxtags</artifactId>
                <version>1.3-beta-rc7</version>
                <exclusions>
                    <exclusion>
                        <groupId>taglibs</groupId>
                        <artifactId>standard</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.apache.xmlgraphics</groupId>
                <artifactId>fop</artifactId>
                <version>0.95</version>
            </dependency>

            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>1.1.2</version>
            </dependency>

            <dependency>
                <groupId>taglibs</groupId>
                <artifactId>standard</artifactId>
                <version>1.1.2</version>
            </dependency>


            <!-- Java Mail -->
            <dependency>
                <groupId>javax.mail</groupId>
                <artifactId>mail</artifactId>
                <version>1.4</version>
            </dependency>

            <!-- Apache Commons -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-httpclient</artifactId>
                <version>3.0-beta1</version>
            </dependency>

            <dependency>
                <groupId>commons-httpclient</groupId>
                <artifactId>commons-httpclient</artifactId>
                <version>3.1</version>
            </dependency>

            <dependency>
                <groupId>org.apache.poi</groupId>
                <artifactId>poi</artifactId>
                <version>3.2-FINAL</version>
            </dependency>

            <!-- XML Serialization -->
            <dependency>
                <groupId>com.thoughtworks.xstream</groupId>
                <artifactId>xstream</artifactId>
                <version>1.3.1</version>
            </dependency>

            <!-- JPA Persistence Annotations -->
            <dependency>
                <groupId>javax.persistence</groupId>
                <artifactId>ejb</artifactId>
                <version>3.0-public-draft-20060502</version>
            </dependency>

            <!-- GeoIP -->
            <dependency>
                <groupId>net.sf</groupId>
                <artifactId>javainetlocator</artifactId>
                <version>1.0</version>
            </dependency>

            <!-- MySQL JDBC Connector -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.36</version>
            </dependency>

            <!-- Servlet API -->
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
                <version>2.4</version>
            </dependency>

            <!-- Logging -->
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.14</version>
            </dependency>

            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
                <version>1.4.2</version>
            </dependency>

            <!-- Unit testing -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.11</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.jmock</groupId>
                <artifactId>jmock</artifactId>
                <version>2.5.1</version>
            </dependency>

            <dependency>
                <groupId>org.jmock</groupId>
                <artifactId>jmock-parent</artifactId>
                <version>2.5.1</version>
            </dependency>

            <dependency>
                <groupId>org.jmock</groupId>
                <artifactId>jmock-junit4</artifactId>
                <version>2.4.0</version>
            </dependency>

            <dependency>
                <groupId>com.oreilly</groupId>
                <artifactId>fileupload</artifactId>
                <version>1.0</version>
            </dependency>
             <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging-api</artifactId>
                <version>1.0.4</version>
            </dependency>
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>1.3</version>
            </dependency>

            <dependency>
                <groupId>org.antlr</groupId>
                <artifactId>stringtemplate</artifactId>
                <version>3.2</version>
            </dependency>

            <!--  GWT deps  -->
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-servlet</artifactId>
                <version>${gwtVersion}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-user</artifactId>
                <version>${gwtVersion}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-dev</artifactId>
                <version>${gwtVersion}</version>
                <classifier>${platform}-libs</classifier>
                <type>zip</type>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-dev</artifactId>
                <version>${gwtVersion}</version>
                <classifier>${platform}</classifier>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>javax.media</groupId>
                <artifactId>jai_core</artifactId>
                <version>1.1.2_01</version>
            </dependency>

            <dependency>
                <groupId>com.sun.media</groupId>
                <artifactId>jai_codec</artifactId>
                <version>1.1.2_01</version>
            </dependency>

            <dependency>
                <groupId>xstream</groupId>
                <artifactId>xstream</artifactId>
                <version>1.2</version>
            </dependency>

            <dependency>
                <groupId>jstl</groupId>
                <artifactId>jstl</artifactId>
                <version>1.1.2</version>
            </dependency>

            <dependency>
                <groupId>net.sourceforge.jtds</groupId>
                <artifactId>jtds</artifactId>
                <version>1.2.2</version>
            </dependency>

            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>18.0</version>
            </dependency>

            <dependency>
                <groupId>org.glassfish.jersey.core</groupId>
                <artifactId>jersey-client</artifactId>
                <version>2.4.1</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.glassfish.hk2.external</groupId>
                        <artifactId>cglib</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.media</groupId>
                <artifactId>jersey-media-moxy</artifactId>
                <version>2.4.1</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jettison</groupId>
                <artifactId>jettison</artifactId>
                <version>1.3.7</version>
            </dependency>

            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-core</artifactId>
                <version>${org.spring.security.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-web</artifactId>
                <version>${org.spring.security.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-config</artifactId>
                <version>${org.spring.security.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-acl</artifactId>
                <version>${org.spring.security.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-taglibs</artifactId>
                <version>${org.spring.security.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>


    <!--  profiles (with activation per platform) -->
    <profiles>
        <profile>
            <id>gwt-dev-windows</id>
            <properties>
                <platform>windows</platform>
            </properties>
            <activation>
                <activeByDefault>false</activeByDefault>
                <os>
                    <family>windows</family>
                </os>
            </activation>
        </profile>
        <profile>
            <id>gwt-dev-mac</id>
            <properties>
                <platform>mac</platform>
            </properties>
            <activation>
                <activeByDefault>false</activeByDefault>
                <os>
                    <family>mac</family>
                </os>
            </activation>
        </profile>
        <profile>
            <id>gwt-dev-linux</id>
            <properties>
                <platform>linux</platform>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
                <os>
                    <name>linux</name>
                </os>
            </activation>
        </profile>
    </profiles>
</project>
  • fügen Sie Ihren vollständigen pom mit ${..} Marker entfernt/version ersetzt
  • alle relevanten Informationen sind unter der <properties> – tags. Alles entfernt sind irrelevant interne Module/Eigenschaften.
InformationsquelleAutor Comforse | 2016-10-23



One Reply
  1. 1

    Fix

    ClassNotFoundException: net.sf.cglib.proxy.MethodInterceptor

    müssen Sie cglib:cglib Abhängigkeit:

    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2</version>
    </dependency>

    Diese cglib:cglib war transitiv abgeholt durch org.glassfish.hk2.external:cglib, aber jetzt fehlt da Sie ausgeschlossen ist.

    die cglib-version zu verwenden

    Mit @SteveC s Vorschlag (version 2.2 statt 3.2.4), überprüfte ich, welche version verwendet wurde, durch jersey-client:2.4.1. Es ist cglib:cglib:2.2.0-b21.

    Nun, auf der Suche auf https://mvnrepository.com/artifact/cglib/cglib, das ist nicht verfügbar (vermutlich ein eigenes Umpacken 2.2 erfolgt für org.glassfish). Ich denke, es ist fair zu sagen 2.2 ist der beste match.

    • Ich würde für cglib 2.2 wie ist es alten code
    • Danke @SteveC, habe ich Fix die Antwort mit einer Erklärung
    • Ich tatsächlich verwendet die version 3.2.4.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.