maven - java.lang.NoClassDefFoundError: javax/el/ELManager -
i'm working on webapp in spring using spring tool suite. if build , deploy application there using ide onto provided pivotal tc server, works fine. however, if manual "mvn clean package" build , attempt deploy standalone tomcat server (using newest tomcat 7), throws following exception:
2017-08-23 15:24:13 warn annotationconfigwebapplicationcontext:551 - exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.beancreationexception: error creating bean name 'requestmappinghandleradapter' defined in org.springframework.web.servlet.config.annotation.delegatingwebmvcconfiguration: bean instantiation via factory method failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter]: factory method 'requestmappinghandleradapter' threw exception; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mvcvalidator' defined in org.springframework.web.servlet.config.annotation.delegatingwebmvcconfiguration: invocation of init method failed; nested exception java.lang.noclassdeffounderror: javax/el/elmanager 2017-08-23 15:24:13 error dispatcherservlet:502 - context initialization failed org.springframework.beans.factory.beancreationexception: error creating bean name 'requestmappinghandleradapter' defined in org.springframework.web.servlet.config.annotation.delegatingwebmvcconfiguration: bean instantiation via factory method failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter]: factory method 'requestmappinghandleradapter' threw exception; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mvcvalidator' defined in org.springframework.web.servlet.config.annotation.delegatingwebmvcconfiguration: invocation of init method failed; nested exception java.lang.noclassdeffounderror: javax/el/elmanager
upon further inspection, complain few lines higher above not loading jars:
sie 23, 2017 3:24:12 pm org.apache.catalina.startup.hostconfig deploywar info: deploying web application archive d:\apache-tomcat-7.0\webapps\testapp-0.0.1-snapshot.war sie 23, 2017 3:24:12 pm org.apache.catalina.loader.webappclassloader validatejarfile info: validatejarfile(d:\apache-tomcat-7.0\webapps\testapp-0.0.1-snapshot\web-inf\lib\el-api-2.2.jar) - jar not loaded. see servlet spec 2.3, section 9.7.2. offending class: javax/el/expression.class sie 23, 2017 3:24:12 pm org.apache.catalina.loader.webappclassloader validatejarfile info: validatejarfile(d:\apache-tomcat-7.0\webapps\testapp-0.0.1-snapshot\web-inf\lib\javax.servlet-api-3.1.0.jar) - jar not loaded. see servlet spec 2.3, section 9.7.2. offending class: javax/servlet/servlet.class sie 23, 2017 3:24:12 pm org.apache.catalina.loader.webappclassloader validatejarfile info: validatejarfile(d:\apache-tomcat-7.0\webapps\testapp-0.0.1-snapshot\web-inf\lib\tomcat-el-api-8.0.21.jar) - jar not loaded. see servlet spec 2.3, section 9.7.2. offending class: javax/el/expression.class 2017-08-23 15:24:13 info contextloader:304 - root webapplicationcontext: initialization started
my 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>com.exmaple.mvc</groupid> <artifactid>testapp</artifactid> <version>0.0.1-snapshot</version> <packaging>war</packaging> <dependencies> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>4.3.10.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-webmvc</artifactid> <version>4.3.10.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> <version>4.3.10.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-test</artifactid> <version>4.3.10.release</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.6.6</version> </dependency> <dependency> <groupid>log4j</groupid> <artifactid>log4j</artifactid> <version>1.2.17</version> <exclusions> <exclusion> <artifactid>jms</artifactid> <groupid>javax.jms</groupid> </exclusion> <exclusion> <artifactid>jmxri</artifactid> <groupid>com.sun.jmx</groupid> </exclusion> <exclusion> <artifactid>jmxtools</artifactid> <groupid>com.sun.jdmk</groupid> </exclusion> </exclusions> </dependency> <dependency> <groupid>jstl</groupid> <artifactid>jstl</artifactid> <version>1.2</version> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.12</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/org.mockito/mockito-all --> <dependency> <groupid>org.mockito</groupid> <artifactid>mockito-all</artifactid> <version>1.9.5</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang --> <dependency> <groupid>commons-lang</groupid> <artifactid>commons-lang</artifactid> <version>2.3</version> </dependency> <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator --> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-validator</artifactid> <version>6.0.1.final</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>javax.servlet-api</artifactid> <version>3.1.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> </project>
what's reason behavior , how can solve this?
edit more information:
adding <scope>provided</scope>
javax.servlet-api
seems fix warning javax.servlet-api
not being loaded @ start. problem el-api
still remains.
i've checked tomcat/lib directory , contains el-api.jar
in it, why tells me it's not going load 1 list in pom.xml. thing is, adding <scope>provided</scope>
doesn't fix either. whatever do, still complains gives me same java.lang.noclassdeffounderror: javax/el/elmanager
error.
solution
in addition part in edit above regarding javax.servlet-api
problem el-api
was running tomcat 7 provided el-api
jar in version 2.2. missing class introduced in el-api 3.0. running same webapp in tomcat 8 (with el-api 3.0 jar) works properly.
you miss javax.el-api
dependency. add:
<dependency> <groupid>javax.el</groupid> <artifactid>javax.el-api</artifactid> <version>3.0.0</version> </dependency>
to pom.xml
wiki
Comments
Post a Comment