[ERROR] javax.servlet.ServletException: Failed to load application class

Hi all,

I used vaadin to make an applcation and on my computer, all works fine …

But i want to upload the application in professionnal host i paid …

The host is running with Tomcat 5.5 and JAVA 6 …

I have this error :

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: Failed to load application class: com.proresil.views.ProresilApplication
	com.vaadin.terminal.gwt.server.ApplicationServlet.init(ApplicationServlet.java:71)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
	org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
	org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
	org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
	org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
	org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	java.lang.Thread.run(Thread.java:619)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs.

I upload the content of “WebContent” directory on the server, i upload all class files too …

The structure is :


+ MyProject
   + VAADIN
   + WEB-INF
      + classes (my application)
         + com.........
         - hibernate.cfg.xml
         - log4j.properties
      + lib
         - (All my libs, vaadin, gwt, log4j, etc ...)
      - web.xml

Following is the content of my “web.xml” file :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp_ID">
	<display-name>ProResil</display-name>
	<context-param>
		<param-name>productionMode</param-name>
		<param-value>true</param-value>
		<description>ProResil production mode</description>
	</context-param>
	<servlet>
		<servlet-name>Proresil Application</servlet-name>
		<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
		<init-param>
			<param-name>application</param-name>
			<param-value>com.proresil.views.ProresilApplication</param-value>
			<description>Proresil application class to start</description>
		</init-param>
	</servlet>
	<servlet-mapping>
		<servlet-name>Proresil Application</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
</web-app>

I don’t know what is the problem, i read some threads in this forum and in internet but no way to find a solution …

Thanks for your help !

Couple of tips:

  • Try to package you application as WAR (in eclipse, try “export to war”)

  • Try to deploy you application to a (cleanly installed) tomcat in localhost

Thanks …

After new try, i haven’t any errors in TOMCAT logs (catalina.out) …

The application works fine in my computer (eclipse + tomcat) but when i upload my application in my host (rent in professionnal) i have an error when i tried to access …

The error is :

Can you help me to solve that please ?

Thanks by advance !

Hi,

Your application is not finding the default widgetset (a.k.a the client-side GWT components). Quite often this happens when running the application as root (/) locally, and then under a specified path on the server (e.g /myapp/). If this is indeed the case, you have two options:

a) Let tomcat serve the resources statically: Extract the widgetsets and themes from the JAR - they are in a directory called VAADIN, which should be placed right next to WEB-INF (i.e /some/path/WEB-INF and /some/path/VAADIN).

b) Have Vaadin serve the resources dynamically: This requires you to register ApplicationServlet to /VAADIN/* - just add another servlet-mapping for your application with the uri-pattern /VAADIN/*

Hope this helps!

Best Regards,
Marc

Thanks again …

Now there is new error, but VAADIN error.

I have popup that says “Communication problem”

More informations :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp_ID">
	<display-name>ProResil</display-name>
	<context-param>
		<param-name>productionMode</param-name>
		<param-value>true</param-value>
		<description>ProResil production mode</description>
	</context-param>
	<servlet>
		<servlet-name>Proresil Application</servlet-name>
		<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
		<init-param>
			<param-name>application</param-name>
			<param-value>com.proresil.views.ProresilApplication</param-value>
			<description>Proresil application class to start</description>
		</init-param>
	</servlet>
	<servlet-mapping>
		<servlet-name>Proresil Application</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>Proresil Application</servlet-name>
		<url-pattern>/VAADIN/*</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
</web-app>
  • I have all libraries correctly loaded, and i extract VAADIN/themes and VAADIN/widgetset like you told me previous answer.

I haven’t more things. Nothing in catalina.out …

Can you help me to solve the problem please ?

(If it miss informations tell me how find them and i will give them to you)

Thanks

Should the first url pattern be /Test/* instead of /* ?

I’ve tried …

With "/Test/* in first pattern, tomcat error, application cannot be found. And after reading vaadin doc about web.xml and contexts, url must be “/*”

Thanks for proposition ^^

New informations … The problem persists …

I activate debug and following the content :

Vaadin application servlet version: 6.0.1
Widget set is built on version: 6.0.1
Application version: NONVERSIONED
inserting load indicator
Making UIDL Request with params: init
Server visit took 276ms
Communication error: com.google.gwt.core.client.JavaScriptException: (SyntaxError): missing ) in parenthetical fileName: http://proresil.ch/Test/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/735127F5A96DFC6E554FCC69B8211878.cache.html lineNumber: 454 stack: Csb()@:0 eval("( HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n\n\n\n
Not Found
\n

The requested URL /Test/UIDL/ was not found on this server.
\n

Additionally, a 404 Not Found\nerror was encountered while trying to use an ErrorDocument to handle the request.
\n\n
Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_jk/1.2.25 mod_perl/2.0.4 Perl/v5.8.8 Server at proresil.ch Port 80
\n)")@:0 Csb(" HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n\n\n\n
Not Found
\n

The requested URL /Test/UIDL/ was not found on this server.
\n

Additionally, a 404 Not Found\nerror was encountered while trying to use an ErrorDocument to handle the request.
\n\n
Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_jk/1.2.25 mod_perl/2.0.4 Perl/v5.8.8 Server at proresil.ch Port 80
\n")@http://proresil.ch/Test/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/735127F5A96DFC6E554FCC69B8211878.cache.html:454 unc([object Object]
,[object Object]
)@http://proresil.ch/Test/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/735127F5A96DFC6E554FCC69B8211878.cache.html:1432 amc([object Object]
,[object Object]
)@http://proresil.ch/Test/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/735127F5A96DFC6E554FCC69B8211878.cache.html:1469 cmc([object Object]
,[object Object]
)@http://proresil.ch/Test/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/735127F5A96DFC6E554FCC69B8211878.cache.html:1471 anb([object Object]
,[object Object]
)@http://proresil.ch/Test/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/735127F5A96DFC6E554FCC69B8211878.cache.html:235 dnb([object Object]
)@http://proresil.ch/Test/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/735127F5A96DFC6E554FCC69B8211878.cache.html:237 ([object Event]
)@http://proresil.ch/Test/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/735127F5A96DFC6E554FCC69B8211878.cache.html:277 - Original JSON-text:
HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
Not Found

The requested URL /Test/UIDL/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_jk/1.2.25 mod_perl/2.0.4 Perl/v5.8.8 Server at proresil.ch Port 80

http://proresil.ch/Test/UIDL must be mapped to your servlet, otherwise it won’t work. Opening the
http://proresil.ch/Test/UIDL
URL in your browser should NOT give “404 Not Found”. Mapping /* to your servlet in your web.xml should be enough for both /VAADIN and /UIDL so I’m not sure where the problem is. If it works on a local Tomcat and not in your providers’ Tomcat, the providers’ Tomcat must be somehow configured differently. Of course you can also try to add a /UIDL mapping to your web.xml but I really do not see why it would help.

Thanks for the answer, but is it normal that i haven’t any file or folder named “UIDL” ???

A full description of my WebApp folder can help ???

Yes, it is normal.

ok so why vaadin is looking for unexisting folder ?

And how can i add servlet-mapping if folder doesn’t exist ???

I hope i will have solution …

UIDL urls are server by ApplicatioServlet dynamically.

Ok, so have you got and idea why it doesn’t wok in my case ???

Vaadin is run as a normal servlet (ApplicationServlet) and it requires you to either map /* to it or both /VAADIN/* and /yourapplication/* to it. As you already did that and have it properly running on local host, the problem is most likely in your the tomcat configuration of your service provider. Without seeing that configuration it is really hard to tell. Can you deploy some other servlets?

I haven’t other servlet or applications …

Do you have little vaadin application that i can deploy and that you know it work fine ? Thing like i juste send a folder and test …

You can deploy the demo application (not a small one, but should work):
http://vaadin.com/download/current/vaadin-demo-6.0.1.war

Ok i’ll try this evening (in France ^^) …

But sorry where must i upload the war, in the server i don’t know how i must do … i tried in the root folder, where i put my webapps, but nothing appends …

In tomcat you can put the war files into /tomcat/webapps/ and it will deploy it self there when the server is running. If successful, you can see a folder under webapps with the same name as your war.

I Try to below video using my STS IDE

Vaadin application development - step-by-step

But its not running correctly and occures this error

javax.servlet.ServletException: Failed to load application class: com.example.documentmanager.DocumentmanagerApplication
at com.vaadin.terminal.gwt.server.ApplicationServlet.init(ApplicationServlet.java:71)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:857)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

MY Web App Server is TOMCAT 7.0.23

Please Help me…

my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>DocumentManager</display-name>
	<context-param>
		<description>
		Vaadin production mode</description>
		<param-name>productionMode</param-name>
		<param-value>false</param-value>
	</context-param>
	<servlet>
		<servlet-name>Documentmanager Application</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>com.example.documentmanager.DocumentmanagerApplication</param-value>
		</init-param>
	</servlet>
	<servlet-mapping>
		<servlet-name>Documentmanager Application</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
</web-app>

in Application

package com.example.documentmanager;

import com.vaadin.Application;
import com.vaadin.ui.*;

public class DocumentmanagerApplication extends Application {
	@Override
	public void init() {
		Window mainWindow = new Window("Documentmanager Application");
		Label label = new Label("Hello Vaadin user");
		mainWindow.addComponent(label);
		setMainWindow(mainWindow);
	}

}