Touchkit w/ JEE6 Support - Application not specified in servlet parameters


I would like to integrate a Touchkit application with JEE/EJB support.

I have this working with a standard Vaadin project by extending the application servlet and injecting an instance of the application (and using the @SessionScoped notation on the application class itself). I am also adding application authentication via a redirect to a login screen (as described in the wiki:

For the TouchKit application, I followed the above approach but extended the TouchKitApplicationServlet as such:

import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;

import com.vaadin.Application;
import com.vaadin.addon.touchkit.server.TouchKitApplicationServlet;

@WebServlet(urlPatterns={"/ui/*", "/VAADIN/*"})
public class GoogleApiTestApplicationServlet extends TouchKitApplicationServlet {
	Instance<GoogleApiTestApplication> application;
	protected Class<? extends Application> getApplicationClass()
			throws ClassNotFoundException {
	 return GoogleApiTestApplication.class;

	protected Application getNewApplication(HttpServletRequest request)
			throws ServletException {
		GoogleApiTestApplication app = application.get();
		Principal principal = request.getUserPrincipal();
		if (principal == null) {
			throw new ServletException("Access denied");
		app.setLogoutURL(request.getContextPath() + "/logout.jsp");
		return app;


After the authentication proceeds, I am getting an “Application not specified in servlet parameters” error from Glassfish:

: PWC1382: Allocate exception for servlet com.xpodigital.GoogleApiTestApplicationServlet
javax.servlet.ServletException: Application not specified in servlet parameters
at com.vaadin.terminal.gwt.server.ApplicationServlet.init(
at com.vaadin.addon.touchkit.server.TouchKitApplicationServlet.init(

After getting the Glassfish error page, if I then refresh the page, I do in fact get the touchkit application.

In the process of troubleshooting the issue, I added the following to my servlet code:

public void init(ServletConfig servletConfig) throws ServletException {

…and at first it seemed that the error stopped being thrown when using the iPhone – however, as I added more code to my application it came back (or is this just a coincidence?!) Nevertheless, when testing from within Eclipse (with the built in browser), I would consistently get the error.

Unfortunately, I don’t really know what I’m doing here, so I’m not sure what the above init method is doing (it is not necessary in my standard Vaadin application). Does anyone know of the proper way to extend the TouchKitApplicationServlet so as to be able to inject the application and utilize EJBs?

BTW, I have set this up as a standard Vaadin application (rather than a Maven project).

Thanks kindly!

Just a bit more of clarification on this issue:

The “Application not specified” error is thrown only after the initial login (the web.xml file points to a login.jsp file to handle user authentication). After the login is successful, the error is thrown. Hitting “refresh” then brings up the touchkit application. If the browser is then refreshed with the ?restartApplication parameter appended to the url, the application loads without issue. To get the problem to occur again, the session needs to time out. Of course, if the application is redeployed the issue pops up again, as a re-authentication will be necessary.


I ended up purchasing Vaadin support to resolve this issue.

Here’s what team member Johannes Häyry came up with as the solution:

*Note that the application class differs from what was in my previous post (I ended up sending a more simplified application)

BTW, the Vaadin support experience was excellent. Johannes not only solved the issue, but did so very quickly. I definitely found the support service to be worth the money.