Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
140 views
in Technique[技术] by (71.8m points)

eclipse - Absent Code attribute in method that is not native or abstract in class file javax/persistence/InheritanceType

Hi i try to write a pomfile wich supports running unittests + running on server in eclipse. But m2eclipse ignores the scopes and always deployes everything to the server.

either i get

java.lang.NoClassDefFoundError: javax/servlet/jsp/el/ELException

because i've not included the "javaee-web-api" with code or i get

Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type avax/el/ExpressionFactory; used in the signature

because ive included them with code but tomcat7 includes them too, so i tried to add "provided":

    <dependency>
        <groupId>org.jboss.spec</groupId>
        <artifactId>jboss-javaee-6.0</artifactId>
        <version>1.0.0.Final</version>
        <type>pom</type>
        <scope>provided</scope>
    </dependency>

But when i run it on server from eclipse anyway the jars are included on classpath.

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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Lythgmbh</groupId>
<artifactId>Sociato</artifactId>
<version>0.0.1-SNAPSHOT</version>
<repositories>
    <repository>
        <id>central</id>
        <name>Maven Repository Switchboard</name>
        <url>http://repo1.maven.org/maven2</url>
        <layout>default</layout>
    </repository>
    <repository>
        <id>central2</id>
        <name>Maven Repository Switchboard2</name>
        <url>http://repo2.maven.org/maven2</url>
        <layout>default</layout>
    </repository>
    <repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
    </repository>
    <repository>
        <id>fuse-repo</id>
        <name>Fuse open source community</name>
        <url>http://repo.fusesource.com/maven2</url>
        <layout>default</layout>
    </repository>
    <repository>
        <id>jahia.org</id>
        <name>jahia.org</name>
        <url>http://maven.jahia.org/maven2</url>
        <layout>default</layout>
    </repository>
    <repository>
        <id>asf-snapshot</id>
        <name>ASF Maven Repository</name>
        <layout>default</layout>
        <url>http://people.apache.org/maven-snapshot-repository</url>
    </repository>
    <repository>
        <id>org.springframework.security.taglibs.facelets</id>
        <url>http://spring-security-facelets-taglib.googlecode.com/svn/repo/</url>
    </repository>
    <repository>
        <id>repository.jboss.org-public</id>
        <name>JBoss repository</name>
        <url>https://repository.jboss.org/nexus/content/groups/public</url>
    </repository>
</repositories>
<dependencies>

    <!-- ADDITIONAL -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.1-901-1.jdbc4</version>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>jfree</groupId>
        <artifactId>jfreechart</artifactId>
        <version>1.0.13</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20090211</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
        <type>jar</type>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <groupId>com.sun.jmx</groupId>
                <artifactId>jmxri</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jdmk</groupId>
                <artifactId>jmxtools</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.jms</groupId>
                <artifactId>jms</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>net.htmlparser.jericho</groupId>
        <artifactId>jericho-html</artifactId>
        <version>3.2</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
    </dependency>
    <dependency>
        <groupId>org.supercsv</groupId>
        <artifactId>supercsv</artifactId>
        <version>1.20</version>
    </dependency>
    <dependency>
        <groupId>com.octo.captcha</groupId>
        <artifactId>jcaptcha</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium</artifactId>
        <version>2.0rc2</version>
        <type>pom</type>
        <exclusions>
            <exclusion>
                <artifactId>httpclient</artifactId>
                <groupId>org.apache.httpcomponents</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.openid4java</groupId>
        <artifactId>openid4java-consumer</artifactId>
        <version>0.9.6</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>com.lowagie</groupId>
        <artifactId>itext</artifactId>
        <version>2.1.7</version>
    </dependency>
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>1.8.6</version>
    </dependency>
    <dependency>
        <groupId>net.sf.ehcache</groupId>
        <artifactId>ehcache</artifactId>
        <version>2.5.1</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>com.sun.mail</groupId>
        <artifactId>javax.mail</artifactId>
        <version>1.4.5</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-core</artifactId>
        <version>3.3.0</version>
    </dependency>

    <!-- JSF -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.1.7</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.1.7</version>
    </dependency>
    <dependency>
        <groupId>org.richfaces.ui</groupId>
        <artifactId>richfaces-components-api</artifactId>
        <version>4.2.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.richfaces.core</groupId>
        <artifactId>richfaces-core-api</artifactId>
        <version>4.2.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>3.2</version>
    </dependency>
    <dependency>
        <groupId>commons-el</groupId>
        <artifactId>commons-el</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.richfaces.ui</groupId>
        <artifactId>richfaces-components-ui</artifactId>
        <version>4.2.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.richfaces.core</groupId>
        <artifactId>richfaces-core-impl</artifactId>
        <version>4.2.0.Final</version>
    </dependency>

    <!-- SPRING -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.1.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.1.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>3.1.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
        <version>3.1.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>3.1.0.RELEASE</version>
    </dependency>
    <dependency>
      

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You must install m2e-wtp, the Maven Integration for Eclipse WTP ( https://github.com/sonatype/m2eclipse-wtp/wiki).

The eclipse update site is available at http://download.jboss.org/jbosstools/updates/m2eclipse-wtp/

Once installed, it'll make sure the provided and test dependencies are not deployed to your server (you might run "Maven > Update Project Configuration" first)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...