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.
Problem with AddressBook demo
Hi everyone! This is most likely a newbie question but it nevertheless got me stumped; I have Eclipse Indigo and a jBoss entity running on-top of an windows 7 64 bit OS.
I want to learn as much as possible about vaadin as I intend to use it in a larger project and it looks like it have what I want. Anyhow; I installed the vaadig plugins in eclipse, and created my very first vaadin application (hello world). Everything went smoothly. I expanded on that application and created som enifty buttons, labels etc. And everything went well and deployed nicely on the jboss entity.
I then decided to take the plunge and add some JPA functionality. Now thing went downhill. I took the AddressBook demo enhanced with JPA (as found in https://vaadin.com/wiki/-/wiki/Main/Adding%20JPA%20to%20the%20Address%20Book%20Demo) and created a new project in Eclipse.
The project looks Ok. I run a clean and build (just for the sake of it). I then deploy to the jboss entity (so far so good). Then I get;
=================================================================
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.
=================================================================
16:39:07,702 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/AddressBook].[Addressbook Application]] (http--127.0.0.1-8080-2) Servlet.service() for s
ervlet Addressbook Application threw exception: java.lang.InstantiationException: com.vaadin.demo.tutorial.addressbook.AddressBookApplication
at java.lang.Class.newInstance0(Unknown Source) [:1.6.0_30]
at java.lang.Class.newInstance(Unknown Source) [:1.6.0_30]
at com.vaadin.terminal.gwt.server.ApplicationServlet.getNewApplication(ApplicationServlet.java:82) [vaadin-6.7.6.jar:]
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:978) [vaadin-6.7.6.jar:]
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:801) [vaadin-6.7.6.jar:]
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:456) [vaadin-6.7.6.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.7.Final.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151) [jboss-as-web-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.7.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.7.Final.jar:]
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) [jbossweb-7.0.7.Final.jar:]
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) [jbossweb-7.0.7.Final.jar:]
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033) [jbossweb-7.0.7.Final.jar:]
at java.lang.Thread.run(Unknown Source) [:1.6.0_30]
The code which should run and produce an application looks like;
@WebServlet (urlPatterns = "/*")
public static class Servlet extends AbstractApplicationServlet
{
@EJB
PersonManager personManager;
@Override
protected Application getNewApplication (HttpServletRequest request) throws ServletException
{
return new AddressBookApplication (personManager);
}
@Override
protected Class<? extends Application> getApplicationClass () throws ClassNotFoundException
{
return AddressBookApplication.class;
}
}
Obviously it seems to fail in getNewApplication. It is just silent, I have no clue why it fails to instantiate the project...
The deployed system looks Ok, from what I can say with my limited experience.
web.xml looks ok.
<?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>AddressBook</display-name>
<context-param>
<description>
Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>
<servlet>
<servlet-name>Addressbook 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.vaadin.demo.tutorial.addressbook.AddressBookApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Addressbook 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>
Its just not starting... For whatever reason. The vaadin revision is 6.7.6 (in the /lib).
This is driving me crazy... :-) It should just work... After all it is a demonstration example :-).
Persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence
version = "2.0"
xmlns = "http://java.sun.com/xml/ns/persistence"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="My_descriptor" transaction-type="JTA">
<!--provider>org.eclipse.persistence.jpa.PersistenceProvider</provider-->
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
<!-- jar-file>lib/AddressBook.jar</jar-file -->
<properties>
<property name = "hibernate.dialect" value = "org.hibernate.dialect.HSQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<!-- property name = "hibernate.dialect" value = "org.hibernate.dialect-PostgreSQLDialect" / -->
<!-- property name = "eclipselink.ddl-generation" value = "create-tables"/ -->
</properties>
</persistence-unit>
</persistence>
I add the complete project in the attachements... (as is).
I think Vaadin ApplicationServlet fails to find your application class, because it's not provided as an init-param in the @WebServlet annotation. Set it there and try if that helps.