Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Can't Run Vaadin Enterprise Application(EJB3) in GlassFish V3
I created simple Vaadin Enterprise application(EJB3) using Netbeans 6.8, if I run that project using Glassfish V3, below exception happen. Below show my code.
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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">
<servlet>
<servlet-name>VaadinApplication</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>com.example.vaadin.MyApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>VaadinApplication</servlet-name>
<url-pattern>/vaadin/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VaadinApplication</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file/>
</welcome-file-list>
</web-app>
MyApplication.java
import com.vaadin.Application;
import com.vaadin.ui.*;
/**
*
* @author dinesh
* @version
*/
public class MyApplication extends Application {
@Override
public void init() {
Window mainWindow = new Window("MyApplication");
Label label = new Label("Hello Vaadin user");
mainWindow.addComponent(label);
setMainWindow(mainWindow);
}
}
This is only code I wrote.
Below show exception
This error show IDE output
SEVERE: =================================================================
Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.
=================================================================
WARNING: StandardWrapperValve[VaadinApplication]: PWC1382: Allocate exception for servlet VaadinApplication
javax.servlet.ServletException: Failed to load application class: com.example.vaadin.MyApplication
at com.vaadin.terminal.gwt.server.ApplicationServlet.init(ApplicationServlet.java:71)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1060)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:187)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
Firefox Show this
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Failed to load application class: com.example.vaadin.MyApplication
note The full stack traces of the exception and its root causes are available in the GlassFish v3 logs.
If I run this same code using GlassFish V2.1 it Run perfectly, Why I can't run it GlassFish V3 Please explain how to correct this problem.
Note - If I run web application separately using Glassfish V3 or V2.1 it work, I developed application using j2ee 5
This is a bug in the Glassfish v3 classloader.
There is a partial workaround in Vaadin 6.2.1 (see e.g. this forum post), but it does not cover all cases. Glassfish v3.1 nightly builds include a fix to the issue.
Thanks for reply. That mean I can't use GlassFish V3 to run vaadin enterprise application. So in order to run that application I have to use Glassfish v3.1 or GlassFish V3. Please Confirm this is true or false.
I did same example using J2ee6 and Glassfish V3. It worked perfectly below show that code
package helloworld;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import com.vaadin.Application;
import com.vaadin.terminal.gwt.server.AbstractApplicationServlet;
import com.vaadin.ui.*;
public class HelloWorldApp extends Application {
@WebServlet(urlPatterns="/*")
public static class Servlet extends AbstractApplicationServlet {
@Override
protected Class<? extends Application> getApplicationClass() {
return HelloWorldApp.class;
}
@Override
protected Application getNewApplication(HttpServletRequest request) throws ServletException {
return new HelloWorldApp();
}
}
@Override
public void init() {
Window mainWindow = new Window("Hello World Application");
Label label = new Label("Greetings, Vaadin user!");
mainWindow.addComponent(label);
setMainWindow(mainWindow);
}
}
Please give some comments.
It is probably sufficient as a workaround to include your client side code and the gwt-user.jar in the WAR you deploy on GlassFish.
Another alternative would be to use Vaadin 6.1.x, which is not impacted by the GlassFish bug - the bug causes problems with the new widgetset packaging and composition mechanism.
Below show my project structure.
I used gwt-user.jar and glassfish v3.1 but same exception happen. I think this this problem related to this link http://vaadin.com/forum/-/message_boards/message/17184 It also didn't have answer.
Note ;- I have set the relative URL of the Main Enterprise application(Hooo) like "/vaadin" .
If i not setted it runs the index.jsp page in the Web Application module(Hooo.war)
I post my question skype chat yesterday, I got below answers
henri.sara: The classloader of the ApplicationServlet class is unable to load your application class - this looks like some kind of a classpath issue, but I cannot really say much more Does it work if instead of using ApplicationServlet, you subclass AbstractApplicationServlet?
public Class<? extends Application> getApplicationClass() { return HooApplication.class; }
public Application getNewApplication(HttpServletRequest request) { return new HooApplication(); }
samiekblad: As Henri said. But I the line numbers do not match to 6.4: http://dev.vaadin.com/browser/versions/6.4/src/com/vaadin/terminal/gwt/server/ApplicationServlet.java)
ah... thats because of the generated headers I suppose.
ClassNotFoundException at line 58 in this src
Using above help I modified my code like below
create new servelt
package web;
import com.example.hoo.HooApplication;
import com.vaadin.Application;
import com.vaadin.terminal.gwt.server.ApplicationServlet;
import javax.servlet.http.HttpServletRequest;
/**
*
* @author dinesh
*/
public class Test extends ApplicationServlet {
@Override
public Class<? extends Application> getApplicationClass() {
return HooApplication.class;
}
@Override
public Application getNewApplication(HttpServletRequest request) {
return new HooApplication();
}
}
edit my web.xml
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
to this
<servlet-class>web.Test</servlet-class>
Using that i can run my ejb3 application in glassfish v3,
I'm going to use above code to develop my banking application, Is it good to use above code ?
please give you're precious comments.
Thank You.
I have the same problem but the sub-classing didn't work, any other work around?
Thanks.
Michael.
This is a very old thread, and both Vaadin and GlassFish have evolved since then. I believe your problem might be somewhat different from the original one.
Posting a more detailed description of what you are trying to do, what happens and the exact version numbers of GlassFish and Vaadin might help.