el-api-1.0.jar - jar not loaded - 违规类:javax / el / Expression.class

时间:2013-03-24 16:27:23

标签: java-ee maven tomcat7 resteasy

我正在尝试使用RestEasy运行简单的restful服务。以下是我的设置。

Tomcat7 Eclipse& Maven的 我Maven安装war文件并将其复制到webapps文件夹。

部署war文件时,catalina.out文件会显示此信息并且未部署应用程序。

    Mar 24, 2013 9:44:38 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/share/tomcat7/webapps/buzzcore-1.0/WEB-INF/lib/el-api-1.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class
Mar 24, 2013 9:44:40 PM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/buzzcore-1.0]]

我不确定导致问题的原因。以下是我的pom.xml和web.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>
    <groupId>buzzcore</groupId>
    <artifactId>buzzcore</artifactId>
    <packaging>war</packaging>
    <version>1.0</version>  
    <name>buzzcore</name>    

    <repositories>

        <repository>
         <id>org.jboss.resteasy</id>
         <url>http://repository.jboss.org/maven2/</url>
        </repository>

        <repository>
            <id>eap</id>
            <url>http://maven.repository.redhat.com/techpreview/all</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>eap</id>
            <url>http://maven.repository.redhat.com/techpreview/all</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.6</maven.compiler.source>
        <maven.compiler.target>1.6</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-6.0</artifactId>
            <version>3.0.0.Final-redhat-1</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>

        <dependency>
             <groupId>org.jboss.resteasy</groupId>
             <artifactId>resteasy-jaxrs</artifactId>
             <version>2.3.5.Final</version>
        </dependency>

        <dependency>
             <groupId>org.jboss.resteasy</groupId>
             <artifactId>resteasy-jaxb-provider</artifactId>
             <version>2.3.5.Final</version>
        </dependency>

        <dependency>
              <groupId>org.jboss.resteasy</groupId>
              <artifactId>resteasy-jettison-provider</artifactId>
              <version>2.3.5.Final</version>
        </dependency>

    </dependencies>
    <profiles>
        <profile>
            <!-- When built in OpenShift the 'openshift' profile will be used when 
                invoking mvn. -->
            <!-- Use this profile for any OpenShift specific customization your app 
                will need. -->
            <!-- By default that is to put the resulting archive into the 'webapps' 
                folder. -->
            <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
            <id>openshift</id>
            <build>
                <finalName>buzzcore</finalName>
                <plugins>
                    <plugin>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>2.1.1</version>
                        <configuration>
                            <outputDirectory>webapps</outputDirectory>
                            <warName>ROOT</warName>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

的web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="3.0"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         metadata-complete="false">


</web-app>

这是一个OpenShift应用程序,因此是openshift条目。我已将RestEasy中的lib复制到src \ main \ webapp \ WEB-INF \ lib。

2 个答案:

答案 0 :(得分:0)

尝试将以下内容添加到您的pom文件并再次打包:

        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>el-api</artifactId>
            <scope>provided</scope>
            <version>1.0</version>
        </dependency>

答案 1 :(得分:0)

当我在Java 1.6上设置项目时,遇到了这个问题。当我将Java版本更改为1.8并在tomcat中部署时,我遇到了同样的问题。我没有花太多时间在上面。但是恢复到1.6版可以解决此问题。