Error 500 - Internal server error java.lang.NoClassDefFoundError: javax / servlet / jsp / jstl / core / Config

I get the following error when deploying a war file on a weblogic server. I created this using Maven.

java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config at org.springframework.web.servlet.support.JstlUtils.exposeLocalizationContext(JstlUtils.java:97) at org.springframework.web.servlet.view.JstlView.exposeHelpers(JstlView.java:135) at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:211) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208) at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:184) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3750) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:252) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) 

I have jstl-1.2 in lib and jstl-1.2 in weblogic too. But I get the same exception.

I also tried removing jstl-1.2 from the war lib.Even folder, although I got the same Exception.

What could be the reason?

This is my pom

 <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>se.jo.joassivosWebApp</groupId> <artifactId>MApp</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>MApp Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>antlr</groupId> <artifactId>antlr</artifactId> <version>2.7.7</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.6.1</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>3.2.6.ga</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.3.0.ga</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-commons-annotations</artifactId> <version>3.3.0.ga</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.6.3</version> </dependency> <dependency> <groupId>javax.transaction</groupId> <artifactId>jta</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.12</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>3.1.0.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>3.1.0.RELEASE</version> </dependency> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc14</artifactId> <version>10.2.0.2.0</version> </dependency> </dependencies> <!-- <build> <finalName>MApp</finalName> </build> --> <build> <finalName>MApp</finalName> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.0</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory> <packagingExcludes>WEB-INF/lib/xercesImpl-2.0.2.jar,WEB-INF/lib/xml-apis-1.0.b2.jar</packagingExcludes> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.17</version> <configuration> <argLine>-XX:-UseSplitVerifier</argLine> </configuration> </plugin> </plugins> </build> </project> 

This is the folder of my military library

enter image description here

enter image description here

+5
source share
4 answers

The problem is in weblogic.xml.I did not add weblogic.xml. After adding weblogic.xml with the prefer-web-inf-classes tag. Now the application works fine. I added spring and hibernate based weblogic.xml with the prefer-web-inf-classes tag.

0
source

Set the dependency scope in maven for servlet-api in pom.xml for "provided". Do the same for jstl dependency. They are already logged in as part of your weblogic. There is absolutely no reason for packing servlets in your bank.

Make sure that they are not present in the folder of your military library. If you still need to check for transient dependencies. You can find them with the command "mvn dependency: tree".

+8
source

java.lang.NoClassDefFoundError: This error will be raised if there is no .class file during classloader loading, which will dynamically load classes at runtime. This exception also occurs when there is a class file. These are situations

  • When initializing static variables.
  • The exception that occurs when initializing static blocks.

In your case, declare "granted" in your "servlet-api" and "jstl". If you have no problem, declare the same for most dependencies. when you declare a specific dependency in POM.XML, you should check if other dependencies are compatible with it or not.

0
source

It is mainly looking for the main taglib from jstl jar. Try adding below to your pom or replace the existing jstl dependency:

 <dependency> <groupId>javax.servlet.jsp.jstl</groupId> <artifactId>jstl-api</artifactId> </dependency> You can also add <version>4.0.0-b01</version> if it needs. Hope this helps. 
-1
source

All Articles