java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer - eclipse

I am trying to build a simple hello world application for two days using Jersey + Google app engine. For simple AppEngine project I followed these tutorials and both works just fine
https://developers.google.com/appengine/docs/java/gettingstarted/creating
https://developers.google.com/appengine/docs/java/webtoolsplatform
But now I am trying to add Jersey and following this tutorial http://www.vogella.com/articles/REST/article.html.
But server keeps giving me
java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
when I add these lines in web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>TestServer</display-name>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.test.myproject</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
I have downloaded Jersey JAX-RS 2.1 RI bundle from here and have added all jar files in WEB-INF/lib folder as described in tutorial. And even after two days nothing is working. I have searched several times on Google and apparently people who are using Maven have solved it somehow but I am not using Maven neither did the guy who wrote that tutorial.
Just to check if even com.sun.jersey.spi.container.servlet.ServletContainer exists in imported Jersey jars I tried to just write this fully qualified name in Java and let the intellisense finish names but I couldn't get any intellisense after com.sun.je so my last guess is that there have been some package rearrangement in latest Jersey build and jersey is no longer inside com.sun. I am exhausted and I would appreciate any kind of help.

You have downloaded Jersey 2 (which RI of JAX-RS 2). The tutorial you're referring to uses Jersey 1. Download Jersey 1.17.1 from (here), should be sufficient for you.
Jersey 1 uses com.sun.jersey, and Jersey 2 uses org.glassfish.jersey hence the exception.
Also note that also init-param starting with com.sun.jersey won't be recognized by Jersey 2.
Edit
Registering Resources and Providers in Jersey 2 contains additional info on how to register classes/instances in Jersey 2.

If you are using jersey 2.x then you need different configuration in web.xml as servlet class is change in it. you can update your web.xml with following configuration.
<servlet>
<servlet-name>myrest</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>your.package.path</param-value>
</init-param>
<init-param>
<param-name>unit:WidgetPU</param-name>
<param-value>persistence/widget</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myrest</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

Add this in pom
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.17.1</version>
</dependency>

It's an eclipse setup issue, not a Jersey issue.
From this thread ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
Right click your eclipse project Properties -> Deployment Assembly -> Add -> Java Build Path Entries -> Gradle Dependencies -> Finish.
So Eclipse wasn't using the Gradle dependencies when Apache was starting .

I also faced a similar issue. Resolved the problem by going through the step step tutorial from the below link.
http://examples.javacodegeeks.com/enterprise-java/rest/jersey/jersey-hello-world-example/
The main thing to notice is that the jersey libraries should be placed correctly in TOMCAT WEB-INF/lib folder. It is done automatically by the Eclipse settings mentioned in the above link. It will create a WAR file with the dependent JAR Files. Else, you will run into problems with ClassNotFound Exception.
apache-tomcat-7.0.56-windows-x64\apache
-tomcat-7.0.56\webapps\JerseyJSONExample\WEB-INF\lib
"11/23/2014 12:06 AM 130,458 jersey-client-1.9.jar
11/23/2014 12:06 AM 458,739 jersey-core-1.9.jar
11/23/2014 12:06 AM 147,952 jersey-json-1.9.jar
11/23/2014 12:06 AM 713,089 jersey-server-1.9.jar"
4 File(s) 1,450,238 bytes
The second tutorial explains about how to create a Webservice which produces and consumes JSON output.
http://examples.javacodegeeks.com/enterprise-java/rest/jersey/json-example-with-jersey-jackson/
Both the links gave a good picture on how things work and save a lot of time.

try this :
org.glassfish.jersey.servlet.ServletContainer
on servlet-class

I had the same problem as you though I have followed a different guide: http://www.mkyong.com/webservices/jax-rs/jersey-hello-world-example/
The strange part is that, in this guide I have used, I should not have any problem with compatibility between versions (1.x against 2.x) because following the guide you use the jersey 1.8.x on pom.xmland in the web.xmlyou refer to a class (com.sun.jersey.spi.container.servlet.ServletContainer) as said before of 1.x version. So as I can infer this should be working.
My guess is because I'm using JDK 1.7 this class does not exist anymore.
After, I tried to resolve with the answers before mine, did not helped, I have made changes on the pom.xmland on the web.xml the error changed to: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
Which supposedly should be exist!
As result of this error, I found a "new" solution: http://marek.potociar.net/2013/06/13/jax-rs-2-0-and-jersey-2-0-released/
With Maven (archetypes), generate a jersey project, likes this:
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.0
And it worked for me! :)

We get this error because of build path issue. You should add "Server Runtime" libraries in Build Path.
"java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer"
Please follow below steps to resolve class not found exception.
Right click on project --> Build Path --> Java Build Path --> Add Library --> Server Runtime --> Apache Tomcat v7.0

I encountered the same error today although I was using Jersey 1.x, and had the right jars in my classpath. For those who'd like to follow the vogella tutorial to the letter, and use the 1.x jars, you'd need to add the jersey libraries to WEB-INF/lib folder. This will certainly resolve the problem.

you need to add jersey-bundle-1.17.1.jar to lib of project
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<!-- <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> -->
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<!-- <param-name>jersey.config.server.provider.packages</param-name> -->
<param-value>package.package.test</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

You must replace in your web.xml:
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.test.myproject</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
for this:
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.test.myproject</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
this is Jersey 2.x uses org.glassfish.jersey packages instead of com.sun.jersey (which is used by Jersey 1.x) and hence the exception. Note that also init-param starting with com.sun.jersey won't be recognized by Jersey 2.x once you migrate to JAX-RS 2.0 and Jersey 2.x
if at any moment you use maven, your pom.xml would be this:
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.X</version>
</dependency>
replace 2.X for your desire version, e.g. 2.15

A simple workaround is , check whether you have dependencies or libs in deployment assembly of eclipse.probably if you are using tomcat , the server might not have identified the libs we are using . in that case specify it explicitly in deployment assembly.

Coming back to the original problem - java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
As rightly said above, in JAX 2.x version, the ServletContainer class has been moved to the package - org.glassfish.jersey.servlet.ServletContainer. The related jar is jersey-container-servlet-core.jar which comes bundled within the jaxrs-ri-2.2.1.zip
JAX RS can be worked out without mvn by manually copying all jars contained within zip file jaxrs-ri-2.2.1.zip (i have used this version, would work with any 2.x version) to WEB-INF/lib folder. Copying libs to right folder makes them available at runtime.
This is required if you are using eclipse to build and deploy your project.

In pom.xml file we need to add
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.8</version>
</dependency>

The same error and wasted 2+ hours debugging and trying all options. I was not using the Maven/POM, so I could not leverage that solution given by few.
Finally the following resolved it: Adding the jars directly to the tomcat/lib (NOT WEB-INF\lib) folder and restarting the tomcat.

If anyone is trying to build a hello world application using Jersey, I think one of the easiest ways is to follow Jersey documentation.
https://jersey.github.io/download.html
If you are already using maven, it'd take only a few minutes to see the result.
I used below.
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.26

It basically depends on which version jersey you are using. If you are using Jersey ver.1.X.X you need to add
Jersey 1 uses "com.sun.jersey", and Jersey 2 uses org.glassfish. on servlet class tag.
Also, note that also init-param starting with com.sun.jersey won't be recognized by Jersey 2.
And Add all the jar file into WEB-INF lib folder

In my case, it worked after adding the jersey-bundle jar in my tomcat lib.

Related

HTTP Status 404 when running simple RESTful web service in Java using Jersey

I am getting HTTP Status 404 when running simple RESTful web service in Java using Jersey. I am following the tutorial REST with Java (JAX-RS) using Jersey. I have copied all the jars that I downloaded from Jersey download site to WEB-INF/lib folder of my project(please see the screenshot for jars).
When I run the application from eclipse development environment Eclipse Console shows that Tomcat was started successfully. My web-app is deployed and I can see index.html coming up. But hitting http://localhost:8080/com.kj.rest.jersey.first/ gives Http Status 404.
My Environment:
Spring Tool Suite as my eclipse dev environment
Jersey 2.22.2 jars
Apache Tomcat v8.0
Please note I am not using Maven in my project and I also looked at other similar questions here but none of them solved my issue.
What am I missing, where should I look for the issue, which logs?
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<!-- Register resources and providers under com.vogella.jersey.first package. -->
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.*******</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
The mistake that I was making was to not specify the service name(specified by #Path annotation) in the URL. After doing that it worked.
So essentially the URL to hit should be http://localhost:8080/com.kj.rest.jersey.first/rest/path_from_rest_class and I missed the path_from_rest_class earlier.

java.lang.IllegalArgumentException: The main resource set specified [...] is not valid

I'm having trouble starting my Tomcat server, it used to work, but I did something wrong and now it throws me this exception:
Caused by: java.lang.IllegalArgumentException: The main resource set specified [E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\workspace\j2eeapplication\target\j2eeapplication-0.0.1-SNAPSHOT] is not valid
at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:643)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
And this is my web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>J2EE Application Example</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>1</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>Resources Servlet</servlet-name>
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resources Servlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<filter>
<filter-name>charEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
I looked at different solutions over the forums, but nothing worked. Final option will be uninstalling tomcat and fresh installation, cause I read that might work. Thanks for the help in advance.
Seems like you have an outdated web application referenced in your Tomcat embeded server (You are using Tomcat As within Eclipse right?).
First checkout the deployed application within you server, and check the artifact name j2eeapplication-0.0.1-SNAPSHOT and version. You may need to remove it and clean your working directory the redeploy it and you should be safe.
For me, this was caused by a file permission issue. We use a different deployment strategy where I work (not something I can change) which means the webapp exists in a completely different directory to the normal Tomcat directory structure. The above exception occurred when the Tomcat runtime didn't have permission to access that directory.
I had this error when I was starting an application that was designed for Tomcat 8 using Tomcat 7.
A maven update did the trick for me.
Right click on your maven project:
Maven > Update Project...
Select All
Check "Force Update of Snapshots/Releases"
Click Ok
Now, right click on your server:
Clean...
Just in case this might help anyone who come later, I managed to start my tomcat8 server after close and reopen the front project in:
The main resource set specified [project-to-be-reopened]
In my case, it's maven dependency that's causing me this issue, updating maven-dependency will also help.
I had a similar issue. Just if someone else runs into this problem:
For me it was caused because I had an old project deployed, then closed that project. For several weeks, everything was fine, until I used the "Clean..." command of eclipse on that tomcat server. From that point on the famous The main resource set specified [...path to deployment location of this project...] is not valid was raised every time I tried to start Tomcat.
What solved this problem for me was just removing that old project from tomcat (Right click on that entry under Tomcat Server and choose "Remove").
I had a similar issue with one of the projects. I tried all the solutions to this question. None worked for me. I then double-clicked the Tomcat server to see the actual config. In there, under the tab "Modules", there is a list of projects currently associated with the Tomcat server. I could see that the "trouble-causing project" was listed there. I clicked on that and hit remove.
Then everything started to work just fine.
In my case with Tomcat 9 and using Eclipse under Windows, I somehow removed the application from the webapp directory under the Tomcat true server and could no longer start the standalone Tomcat server service. Got the same root cause text as the initial posted question. My solution was to copy the Eclipse version of the application (from the workspace's .metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps tree) to the C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps directory.
Note that I am not using Maven in my workspace, and it was just a standard Java Web project.
For me, the cause was another:
In .metadata.plugins\org.eclipse.wst.server.core\servers.xml the "server" element had no "list" element.
I added the "list" element:
<server auto-publish-setting="1" auto-publish-time="1" configuration-id="/Servers/Tomcat v9.0 Server 9091 ASM-config" deployDir="wtpwebapps" hostname="localhost" id="Tomcat v9.0 Server 9091 ASM" jrebel.old-auto-publish-setting="2" name="Tomcat v9.0 Server 9091 ASM" runtime-id="Apache Tomcat v9.0" server-type="org.eclipse.jst.server.tomcat.90" server-type-id="org.eclipse.jst.server.tomcat.90" start-timeout="9000" stop-timeout="30" testEnvironment="true" timestamp="4">
<list key="modules" value0="adsuite-market::org.eclipse.jst.j2ee.server:adsuite-market::jst.web::2.4"/>
and restarted Eclipse. Then it worked as normal again.

jersey 2.3.1 and spring integration compatibility issues

I am trying to create restful service project setup which will use jersey and spring. i downloaded initially jersey1.8 dependent jars also i got jersey-spring-1.8 and i used com.sun.jersey.spi.spring.container.servlet.SpringServlet as jersey servlet and this setup worked well without any issues.
Now i was asked to use latest jersey version that is jersey2.3.1, so i downloaded jersey2.3.1 dependent jars like (jersey-container-servlet-core-2.3.1,jersey-container-servlet-2.3.1 etc). Now the problem is with jersey-spring which will have com.sun.jersey.spi.spring.container.servlet.SpringServlet, i downloaded jar from maven repository ie jersey-spring3-2.3.1.jar but it does not contain that above SpringServlet.So can any one please tell me what is the corresponding jersey-spring jar or am i missing anything here.
Note i tried to use jersey2.3.1 related jars with jersey-spring-1.8, but now i got exception saying com.sun.jersey.spi.container.servlet.ServletContainer is missing. so there is some jar compatible issue.
Can anyone tell me how to proceed with jersey2.3.1 and spring integration?
The com.sun.jersey.spi.spring.container.servlet.SpringServlet has become now org.glassfish.jersey.servlet.ServletContainer
See this post https://www.codepedia.org/ama/restful-web-services-example-in-java-with-jersey-spring-and-mybatis/ for a complete explanation of Jersey2 and Spring 3 integration.
in jersey 2.x and spring integration we can not define resources and providers in spring beans as we used to do in jersey 1.x and spring integration.
look at the below links.
https://java.net/jira/browse/JERSEY-1957 https://jersey.java.net/documentation/latest/spring.html
so there is no com.sun.jersey.spi.spring.container.servlet.SpringServlet in jersey 2.x
With Jersey 2.x, org.glassfish.jersey.servlet.ServletContainer would be servlet class to be used.
In addition to javax.ws.rs.Application as an init-param option to the servlet, one can also have jersey.config.server.provider.packages as its parameter.
Below is a code snippet, how it would be in web.xml :
<!-- Jersey Servlet -->
<servlet>
<servlet-name>jersey-servlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<!-- Register resources and providers -->
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.jersey.series.spring.integration.service</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
And in Spring applicationContext.xml include :
<!-- scans packages to find and register beans within the application context -->
<context:component-scan base-package="com.jersey.series.spring.integration" />
Hope this helps.

Vaadin 7.1.0 - DefaultWidgetSet can't be found

I am new to Vaadin and I am trying to do some Tests with this technology.
I Set up my project as a Maven Project under Eclipse with a Tomcat 7 Server.
At first I started with Vaadin 7.0.0 and everything works fine. Now I change the Version from 7.0.0 to 7.1.0 because I like to test the push functionality.
With Vaadin 7.0.0 everything works fine, but since I changed the Version I get the error:
Requested resource [/VAADIN/widgetsets/com.vaadin.DefaultWidgetSet /com.vaadin.DefaultWidgetSet.nocache.js] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
I've read that the DefaultWidget is created by Vaadin but how can I do that?
Unless you add new client-side components to a Vaadin project, you don't need to compile a WidgetSet. However, the default configuration of Vaadin assumes that you have one. To get past this error simply remove the <init-param> tag for the widgetset in your web.xml.
<servlet>
<servlet-name>Your-SERVLET-NAME</servlet-name>
<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
<init-param>
<param-name>UI</param-name>
<param-value>com.example.MyUI</param-value>
</init-param>
<init-param>
<param-name>widgetset</param-name>
<param-value>another.path</param-value>
</init-param>
</servlet>
Alternatively, you can create an .xml file in the same package (e.g. MyWSet.xml) as your UI class, and reference it in your web.xml.
MyWSet.xml in com.example package:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
</module>
The right web.xml:
<servlet>
<servlet-name>Your-SERVLET-NAME</servlet-name>
<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
<init-param>
<param-name>UI</param-name>
<param-value>com.example.MyUI</param-value>
</init-param>
<init-param>
<param-name>widgetset</param-name>
<param-value>com.example.MyWSet</param-value>
</init-param>
</servlet>
Remember, you don't need the .xml suffix in your web.xml. Finally, run mvn vaadin:compile to compile this widgetset.
Adding vaadin-client-compiled worked for me as mentioned in https://vaadin.com/forum/thread/2485026/2496683
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>

gwt - problem accessing servlet in inherited module

I'm trying to divide my app into modules and I'm stuck with this problem:
I have a widget MapServiceWidget in one module called "webvisualisation" that uses the RPC to get the data from MapService Rpc interface. I'm inheriting this module in another GWT module called "led" (I packed "webvis..." into jar with sources, added in module "led" deffinition). Then I try to create this widget in the second ("led") module and get message
"Problem accessing /led/mapservice reason NOT FOUND".
And sure it can't find it cause mapservice is defined in inherited "webvisualisation" module.
The question is why it's looking for this servler implementation in "led" module not in "webvisualisation" where it's defined? I checked all module definitions and web.xml files several times and consulted documentations, it seems ok.. but it's not. If my description is not clear I can post some config/source files.
This is web.xml for webvisualisation module
<!-- Servlets -->
<servlet>
<servlet-name>mapservice</servlet-name>
<servlet-class>pl.gmike.webvis.server.MapServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mapservice</servlet-name>
<url-pattern>/webvisualisation/mapservice</url-pattern>
</servlet-mapping>
And for led it's just ordinary generated sample file
<!-- Servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>pl.led.server.GreetingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/led/greet</url-pattern>
</servlet-mapping>
Seems that you're bumping into a classpath problem. Maybe check that your webvisualisation.jar is in the WEB-INF/lib directory of your web application.
I got it working. I just added servlet and servlet mapping entries to "led" modules web.xml so it look like this now:
<!-- Servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>pl.led.server.GreetingServiceImpl</servlet-class>
</servlet>
<servlet>
<servlet-name>mapservice</servlet-name>
<servlet-class>pl.gmike.webvis.server.MapServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/led/greet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>mapservice</servlet-name>
<url-pattern>/led/mapservice</url-pattern>
</servlet-mapping>
As You can see the mapservice servlet is mapped here to /led/mapservice URL where GWT seems to look for it, unlike in original "webvisualisation" module web.xml where it was mapped to /wevisualisation/mapservice .
I'm not very satisfied with this solution, it works but it requires adding a servlet mapping in WebApps web.xml for every servlet in inherited module that I want to use or that is used somewhere in this inherited module.
Still I would like to know why servlet definitions and mappings from inherited modules are not included in WebApps web.xml during compilation/linking... I think it should work without such hacks, so there's something I'm doing wrong.