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.
Related
The pom for my main project declares a version of hadoop-client. A dependency declares a different version of hadoop-client. Which one actually ends up being used?
pom.xml for my main project:
<dependency>
<groupId>com.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.7.0</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.myown.group</groupId>
<artifactId>my-own-artifact</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
pom.xml for the library that my main project depends on:
<dependency>
<groupId>com.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.5.0</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Maven has a complex set of rules for version resolution, summarized as 'nearest wins'. One source of details is this post here. You can find out what Maven decided by using mvn dependency:list or mvn dependency:tree.
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>
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>
I have an existing dropwizard 0.7.0 service which I would like to document using Swagger. I am using the followind dependency for swagger from https://github.com/wordnik/swagger-core/wiki/JavaDropwizard-Quickstart
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
<version>1.3.0</version>
</dependency>
However when I add that dependency I get the following error:
java.lang.NoClassDefFoundError: com/google/common/collect/FluentIterable
at com.fasterxml.jackson.datatype.guava.GuavaTypeModifier.modifyType(GuavaTypeModifier.java:38)
The following post was helpful but my issue is with the dependencies.
How to use swagger with dropwizard .0.7.0
What should my POM contain? My dropwizard dependency is:
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>0.7.0</version>
</dependency>
Thank you
try this -
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
<version>1.3.5</version>
<exclusions>
<exclusion>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-annotations</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>paranamer</artifactId>
<groupId>com.thoughtworks.paranamer</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<artifactId>javassist</artifactId>
<groupId>org.javassist</groupId>
</exclusion>
<exclusion>
<artifactId>joda-time</artifactId>
<groupId>joda-time</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-core</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
</exclusions>
</dependency>
You need guava library during runtime, so add
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>17.0</version>
</dependency>
For swagger spec 2.0, please see the updated sample here:
https://github.com/swagger-api/swagger-core/tree/develop_2.0/samples/java-dropwizard
It has an updated application class for use with the 1.5.1-M1 swagger-core.
Use dropwizard-swagger.
Look at the Version Matrix in the Swagger's GitHub page. It includes this:
dropwizard-swagger Dropwizard Swagger API Swagger UI
----------------------------------------------------------
< 0.5 0.7.x 1.3.2 ?
0.5.x 0.7.x 1.3.12 v2.1.4-M1
0.6.x 0.8.0 1.3.12 v2.1.4-M1
0.7.x 0.8.0 1.5.1-M2 v2.1.4-M1
In your case you simply need :
<dependency>
<groupId>com.federecio</groupId>
<artifactId>dropwizard-swagger</artifactId>
<version>0.4</version>
</dependency>
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