Unable to deploy on Tomcat.

After completing a small Vaadin project I tried to deploy it on Tomcat, but I get repeating
errors from tomcat. The projects works find under Exlipse but I can’t install on standalone
local server. I produced the war through Eclipse Export War File. Here are the errors
I get.

INFO: Deploying configuration descriptor ps-hzplan.xml
Jun 6, 2010 7:09:29 PM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor ps-hzplan.xml
Jun 6, 2010 7:09:29 PM org.apache.catalina.startup.HostConfig deployWAR

(Errors are repeated seems tomcat tries contantly to deploy, but no further
message of why fails).

Here is my deployment descriptor:

<?xml version="1.0" encoding="UTF-8"?> ps-hzplan Vaadin production mode productionMode false hzplan com.vaadin.terminal.gwt.server.ApplicationServlet Vaadin application class to start application net.cbsolution.ps.hzplan.Main Application widgetset widgetset net.cbsolution.ps.hzplan.widgetset.Ps_hzplanWidgetset hzplan /* index.html index.htm index.jsp default.html default.htm default.jsp

I tried to check it and it seems correct. But since everything is produced by Eclipse I am unable to track what is actually going wrong.

Any idea of what can be wrong?

Which Tomcat version are you using?

Your deployment descriptor refers to the Servlet API version 2.5, which is not supported by Tomcat 5.5 and older, so this might be the issue. You could try something like (I did not test this):

<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/j2ee/web-app_2_4.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	version="2.4">

If this is the problem, unfortunately, Eclipse WTP does not allow downgrading the Dynamic Web Module facet version. To downgrade, you either have to create a new project or manually edit some files in the .settings directory of your project - at least org.eclipse.common.project.facet.core.xml - as well as the web.xml DTD references and version number.

Thank you very much Henry,

I upgraded and digested to a minimum web.xml but the problem persists. Here is it now, with same schema
used by other applications:


<web-app xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5"> 

<display-name>ps-hzplan</display-name>
  <servlet>
  	<servlet-name>hzplan</servlet-name>
  	<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
  	<init-param>
  		<description>Vaadin application class to start</description>
  		<param-name>application</param-name>
  		<param-value>net.cbsolution.ps.hzplan.Main</param-value>
  	</init-param>
  	<init-param>
  		<description>Application widgetset</description>
  		<param-name>widgetset</param-name>
  		<param-value>net.cbsolution.ps.hzplan.widgetset.Ps_hzplanWidgetset</param-value>
  	</init-param>
  </servlet>
  <servlet-mapping>
  	<servlet-name>hzplan</servlet-name>
  	<url-pattern>/ps-hzplan/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  	<servlet-name>hzplan</servlet-name>
  	<url-pattern>/VAADIN/*</url-pattern>
  </servlet-mapping>
</web-app>

I have also added a second servlet mapping for widgetset after a similar problem I found in another post,
but in that case there was a clear “class not found” error, but I added it, just in case…

I am not packaging the war each time but directly editing the file in /tomcat/webapps/ directory and restarting tomcat (that should be the same).

I also tried to remove context.xml file (from META-INF) thai I used an a (failed) attempt to avoid serialization
errors constantly issued by Tomcat at startup (from another Vaadin post):


<!-- Turn off session serialization -->
    <Manager className="org.apache.catalina.session.PersistentManager"
      debug="0" distributable="false" saveOnRestart="false">
        <Store className="org.apache.catalina.session.FileStore"/>
    </Manager>

I also removed it from tomcat/conf. Same result: no stack trace.

If there would be a stack trace I would at least have a starting point to locate the problem, like some class
missing.

What I really do not understand (it is not a Vaadin problem) how Tomcat can produce a severe error and not stack trace. Should I possibly report the error to tomcat mailing list?

Another alternative would be to deploy on another container, like jetty or glassfish, but since all project was developed under Tomcat I wouldn’t like to change many things at the same time.

Thank you anyway very much for your so quick reply!

Not sure what you mean by this - but you tried re-packaging and deploying from scratch too though, right?

I’ve never had any problems with the process 1. eclipse export as WAR 2. copy to servers webapps folder (3. tomcat redeploys in a moment).

Sucks if tomcat does not produce more detail, kind of hard to pinpoint the problem then… Does the same WAR work if you install a brand new tomcat (locally for testing purposes) and drop the WAR in the webapps folder?

Best Regards,
Marc

Thanks Mark,

What I intended is I was not repackaging the war but editing web.xml directly in an expanded
subdirectory as Tomcat (should) expand it. Actually Tomcat does NOT expand the war
cause deployment fails.

Anyway, after your suggestion I repackaged the WAR and removed the expanded directory,
but the problem is still the same. Here is catalina.out, where you can see the error but no stack trace.


Jun 7, 2010 11:22:06 AM org.apache.catalina.startup.HostConfig deployDescriptor
[color=#E91345]
SEVERE: Error deploying configuration descriptor ps-hzplan.xml
[/color]
Jun 7, 2010 11:22:06 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Jun 7, 2010 11:22:06 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive ps-hzplan.war
Jun 7, 2010 11:22:06 AM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying configuration descriptor ps-hzplan.war
Jun 7, 2010 11:22:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Jun 7, 2010 11:22:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT

What is curious is that the application under Eclipse works and any other servlet works
(I also deployed a simple servlet with no problem).

My Tomcat 6 is freshly installed (I also tried a remote server - same result).

By the way, a generic question about Vaadin support if anybody knows the answer.

I visited Vaadin paid support pages but I did not find a way to buy one single “ticket”
to submit a problem. All starts with a single developer plan, but I am still evaluating
Vaadin: I would like to know if there is a way to solve this problem to see the
application actually running and complete evaluation. I am ready to pay for solving
this issue but it is too early for a single developer plan.

Well, I’m fresh out of ideas based on this information. Is there any way you could provide a WAR that exhibits this problem?

Best Regards,
Marc

Hi Franco and thanks for you feedback!

You have a very good point. It is naturally possible to sponsor the development of Vaadin either to fix some bugs faster or to have new features added or new components made e.g. in the Vaadin Add-on Directory. This “Support the Vaadin development” should be its own product on the webpage as well. Currenlty we have had that under our “Expert Days” support.

In any case, please contact me directly and let’s sort out what specifically you were looking for and we can give you either support in evaluating, fix some bugs you would like to see fixed quickly or add new features you were looking for.

Best regards,
Fredrik

fredrik.ronnlund@itmill.com

I finally solved the problem. Was surely some conflict between content.xml and web.xml to which only Tomcat was sensible (and only when not started form Eclipse), in fact I was able to deploy under both Jetty and Glassfish. I edited content.xml in an attempt to get rid of serialization warnings, but I am now unable to exactly identify what Tomcat “did not like”.

Problem solved!

Many thanks to the very active Vaadin community, Vaadin has really surprised me an a great framework!

How did you redeploy your application? The safest way would be to do it this way:

  1. Stop Tomcat
  2. Remove the deployed application folder and the .war file from the last deployement from inside the webapp folder
  3. copy the new war file into the webapp folder
  4. restart the Tomcat and wait for the application to be deployed

If you have access to the the directory of the Tomcat server the webapps folder is inside the Tomcat folder. Inside it there is a folder for each applications and sometimes also an old .war file if not removed after deployement.
To remove them you just select them in your Explorer and delete them. If the server is not running and no other programm is locking them it should work without a problem.

Hi,

I am evaluating Vaadin for a couple of projects at work. I am using IntelliJ and Tomcat. I followed the instructions to setup a Vaadin project in IntelliJ and when I run Tomcat to launch the index.jsp page, I received the following exception.

javax.servlet.ServletException: Servlet.init() for servlet VaadinApplicationServlet threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655) org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)


java.lang.Thread.run(Thread.java:745)root causejava.lang.NoClassDefFoundError: org/json/JSONException
com.vaadin.server.VaadinServlet.createServletService(VaadinServlet.java:188) com.vaadin.server.VaadinServlet.init(VaadinServlet.java:96) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655) org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745)

The problem seems to center around the class not found for json. I am using the Vaadin Client and Vaadin Server jar files, so I am not sure what is missing. I have attached a screenshot of my simple project.

Any ideas?

Thanks,

Michael
15973.png

Michael,

From the screenshot it looks like you have just added the client and server jars to the project, is this correct? Which instructions did you follow?

The two ways I recommend setting up a vaadin project in IDEA are:

  1. Use the Vaadin plugin for IDEA, which will generate a project for you using Maven
  2. Generate the project using our vaadin-archetype-application maven archetype

Both methods create maven projects, where maven takes care of downloading all dependencies, including org.json.

HTH,
/Jonatan