You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by briantd <br...@gmail.com> on 2008/07/03 03:55:55 UTC
Maven dependency quandary: apache xml-rpc + servlet-api-2.4.jar =
javax not found?
Hi, I am a recent maven user.
The Good:
* Servlet code compiles after adding pom.xml dependencies for group_ids
"javax.servlet" (server-api) and "org.apache.xmlrpc" (xmlrpc-*).
The Bad:
* Executing "java -jar MyNewServletService-1.0-SNAPSHOT.jar" yields --
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/servlet/http/HttpServlet
>From the pom.xml...
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
I'm guessing that the problem is related to the scope. Perhaps OSX Leopard
doesn't include EE javax jars?
Changing the scope to "runtime" yields a compile-time error:
"cannot access javax.servlet.http.HttpServlet file
javax/servlet/http/HttpServlet.class not found"
Why I'm perplexed:
* maven automatically downloads
~/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar -- which
appears to include all the "missing" classes.
For example:
jar -tf ~/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar
...
javax/servlet/http/HttpServlet.class
...
Any suggestions?
Thanks!
-B
--
View this message in context: http://www.nabble.com/Maven-dependency-quandary%3A-apache-xml-rpc-%2B-servlet-api-2.4.jar-%3D-javax-not-found--tp18250354p18250354.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven dependency quandary: apache xml-rpc + servlet-api-2.4.jar = javax not found?
Posted by Wayne Fay <wa...@gmail.com>.
You're specifying scope provided which means "I will provide this jar
when it is needed". And then in your command line, you're not
providing it. So you get the NPE.
Add the servlet-api-2.4.jar to the classpath and try again, it should
work. And review what the various scopes mean on the Maven homepage if
you haven't already.
Wayne
On 7/2/08, briantd <br...@gmail.com> wrote:
>
> Hi, I am a recent maven user.
>
> The Good:
> * Servlet code compiles after adding pom.xml dependencies for group_ids
> "javax.servlet" (server-api) and "org.apache.xmlrpc" (xmlrpc-*).
>
> The Bad:
> * Executing "java -jar MyNewServletService-1.0-SNAPSHOT.jar" yields --
> Exception in thread "main" java.lang.NoClassDefFoundError:
> javax/servlet/http/HttpServlet
>
> From the pom.xml...
> <dependency>
> <groupId>javax.servlet</groupId>
> <artifactId>servlet-api</artifactId>
> <version>2.4</version>
> <scope>provided</scope>
> </dependency>
>
> I'm guessing that the problem is related to the scope. Perhaps OSX Leopard
> doesn't include EE javax jars?
>
> Changing the scope to "runtime" yields a compile-time error:
> "cannot access javax.servlet.http.HttpServlet file
> javax/servlet/http/HttpServlet.class not found"
>
> Why I'm perplexed:
> * maven automatically downloads
> ~/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar -- which
> appears to include all the "missing" classes.
>
> For example:
> jar -tf ~/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar
> ...
> javax/servlet/http/HttpServlet.class
> ...
>
> Any suggestions?
>
> Thanks!
> -B
> --
> View this message in context: http://www.nabble.com/Maven-dependency-quandary%3A-apache-xml-rpc-%2B-servlet-api-2.4.jar-%3D-javax-not-found--tp18250354p18250354.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org