java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext; - java

I am trying to set a variable that I will refer to in a custom JSP tag, so I have something like this in my JSP:
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="test"/>
However, I am getting this error when The JSP runs:
java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
at org.apache.taglibs.standard.tag.common.core.SetSupport.doEndTag(SetSupport.java:140)
I am running Tomcat 5.5, and Java 1.5, with JSTL 1.2.
Am I doing something wrong here?
Thanks!

This seems to come up quite a bit. We had Hadoop as a dependency and had to do multiple exclusions. Some of these are probably redundant, but this finally worked. I should note that there was no change until I started excluding Jasper at the bottom.
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api-2.1</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api-2.5</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
</exclusion>
<exclusion>
<groupId>tomcat</groupId>
<artifactId>jasper-compiler</artifactId>
</exclusion>
<exclusion>
<groupId>tomcat</groupId>
<artifactId>jasper-runtime</artifactId>
</exclusion>
</exclusions>

Looks like you may have some versioning problem, maybe a conflicting jar file of some sort. Look here, maybe it'll help. You need to supply some more info about your runtime environment if you can't solve it.

Tomcat 5.5 does not support Servlet API 2.5 which is used by JSTL 1.2.
Upgrade to Tomcat 6.0 or downgrade the Servlet / JSP / JSTL versions.
see http://tomcat.apache.org/whichversion.html

Related

Exclude folder from dependency in maven

Is it possible to define the directory exclusion for the dependency in maven?
I have a dependency defined in pom.xml. When compiled, this dependency is added into META-INF/lib. The problem is, the library contains about 40 MB of XML files I do not need, so I want to get rid of them.
Something like this:
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<scope>test</scope>
<exclusions>
<exclusion>
<exclude>**/xml/*</exclude>
</exclusion>
...
This is what I want to use as a dependency:
Jira Func Tests
The folder with XMLs is in the compiled jar in META-INF/lib/jira-func-tests-6.4.6.jar/XML
Before compilation, the XML folder is in resources folder of the jira-func-tests I guess?
those XML files have to be "attached to something". Here is an example what usualy works and should work even in maven-2. So finding connections between those XML files and groupIDs and artifactIDs.
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>

Error deploying plugin to jira

I'm trying to deploy my custom plugin to jira and then the error occurs:
java.lang.ClassCastException: org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl cannot be cast to javax.xml.datatype.DatatypeFactory
The project is build with Maven and if I remove and exclude every
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
dependency
// I just paniced :)
logs inform about ClassNotFoundException
I have no idea what to do, so can anybody help?
Actually, I have no idea why this bug occured, but I rolled back and reconfigured all my pom files, and I believe that the issue was in incorrect api dependency. It concerns QuickBooks API v3, and now it works fine with
<dependency>
<groupId>com.intuit.code.devkit.v3</groupId>
<artifactId>ipp-v3-java-devkit</artifactId>
<version>2.3.2</version>
<scope>compile</scope>
</dependency>
And, probably, the problem was in one one these dependencies
<dependency>
<groupId>com.intuit</groupId>
<artifactId>ipp-java-devkit</artifactId>
<version>2.0.13</version>
</dependency>
<dependency>
<groupId>com.intuit.code.devkit</groupId>
<artifactId>ipp-java-qbhelper</artifactId>
<version>1.1.0</version>
</dependency>

Error on EJB upgrade to JBoss AS 7

I'm trying to upgrade the EJB module to work with JBoss AS 7 and after including all the libraries I thought might make a difference I'm sitll getting this error:
Error(20,33): package org.jboss.ejb3.annotation does not exist
on:
import org.jboss.ejb3.annotation.TransactionTimeout;
Can anyone tell me how to fix this?
Are you using Maven? If so, adding these dependencies to your POM may be helpful:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>crc-jboss-client-all</artifactId>
<type>pom</type>
<version>5.1.0.GA</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.slf4j</groupId>
<artifactId>slf4j-jboss-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
Although you were using JDeveloper; I had the same issue doing a build with Maven. The dependency comes from jboss-annotations-ejb3.
Jon's answer didn't match the dependencies for jboss-annotations-ejb3. Therefore for Maven I added this to the pom.xml. May help some others.
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-annotations-ejb3</artifactId>
<version>4.2.2.GA</version>
</dependency>

Jsp servlet exception

I've seen some similar answer to this question perhaps but I feel my situation is different. I'm developing a spring MVC app working great so far, that is I included hadoop api in my project, when I included hadoop this exception started happening when I am trying to open the initial dashboard page which worked previously :
java.lang.AbstractMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/
ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
org.apache.jsp.ServerInfo_jsp._jspInit(ServerInfo_jsp.java:63)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:158)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:9
Here is how my hadoop dependency looks like :
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>0.23.1-mr1-cdh4.0.0b2</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.23.1-mr1-cdh4.0.0b2</version>
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
Once I add this to my app it's no longer usable and naturally without these dependecies things run very smooth. What am I missing here?
I think that your problem is that hadoop is including a version of the servlet API which is coming before the "correct" servlet API in the classpath. Hadoop has dependencies on Jetty, and jetty will in turn try to include a servlet API.
I have a project with a very similar setup, Spring MVC and Hadoop. I have the below exclusions for the hadoop dependency. Note that this might vary slightly depending on your hadoop distribution, I am using cloudera's. Since the servlet container you are using will usually ship with its own javax.servlet dependency, your exclusion needs to catch this case. I have only tested the below configuration with Jetty:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>${hadoop.version}</version>
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api-2.1</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api-2.1</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>tomcat</groupId>
<artifactId>jasper-compiler</artifactId>
</exclusion>
<exclusion>
<groupId>tomcat</groupId>
<artifactId>jasper-runtime</artifactId>
</exclusion>
<!-- other exclusions snipped for brevity -->
I recently had a similar experience with hadoop-core 1.2.1 in my web application. On top of the dependencies Paul Sanwald indicated, I excluded some org.eclipse.jetty dependendencies:
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
</exclusion>
It's not completely clear to me whether every one of these had to be excluded, but I wanted to be sure no unneeded dependencies were getting in - I'm using Tomcat, which provides JSP and servlet libraries. jetty-servlet definitely had to go.

Maven dependency log4j error

Hello everyone I have error which breaks up my build for no reason, here is the error message :
error: error reading
/.m2/repository/com/sun/jdmk/jmxtools/1.2.1/jmxtools-1.2.1.jar;
error in opening zip file error: error
reading
/.m2/repository/com/sun/jmx/jmxri/1.2.1/jmxri-1.2.1.jar;
error in opening zip file
I'm using this dependency :
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<scope>provided</scope>
</dependency>
How can I fix this ?
You most likely don't need jmxtools or jmxri, so you can probably exclude them from your dependencies:
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
Seriously, these dependencies on JMX, JMS, Java Mail are ridiculous and having to deal with exclusions to do some logging makes me speechless. So, I'd rather use the previous version of log4j (1.2.14) or just switch to logback.

Categories