JPAContainer, Problem to define the entity manager

Hi! I have a vaadin project that uses the JPAcontainer 2.1 version in order to implement ssom simpler and some more advanced CRUD views.

I am getting grey hair (to say the least!) on this… I follow the instructions that I found at (
https://vaadin.com/web/matti/blog/-/blogs/1127463
) but I have hit snags.

From what I understand I should quite simply add the following:


<persistence-context-ref>
    <description>Persistence context for JndiProviders. 
		Unit name should be same as in your persistence.xml</description>
    <persistence-context-ref-name>persistence/em</persistence-context-ref-name>
    <persistence-unit-name>myapp</persistence-unit-name>
</persistence-context-ref>

to my web.xml and then I can use the jndi versions of the containers. However So far I am not able to discern where I should put the persistence-context-ref tag… In eclipse I am using dynamic web version 2.4 (and I have experimented with 2.5). From book of vaadin (
https://vaadin.com/book/-/page/application.environment.html
) they use version 2.4.

My web.xml looks like:


<?xml version="1.0" encoding="UTF-8"?>
<!-- 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"-->
<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/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<!-- <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>UnityGui</display-name>
	<context-param>
		<description>Vaadin production mode</description>
		<param-name>productionMode</param-name>
		<param-value>false</param-value>
	</context-param>
	<servlet>
		<servlet-name>Unitygui 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>se.point.unity.unitygui.UnityguiApplication</param-value>
		</init-param>
		<init-param>
			<description>
			Application widgetset</description>
			<param-name>widgetset</param-name>
			<param-value>se.point.unity.unitygui.widgetset.UnityguiWidgetset</param-value>
		</init-param>
	</servlet>
	<servlet-mapping>
		<servlet-name>Unitygui 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>

As can be noted I have tested 2.4 and 2.5. After fooling around on oracles documentation pages I found:
http://docs.oracle.com/cd/E16439_01/doc.1013/e13981/servjndi010.htm
, which lead me to believe that the tag should be put in the servlet container. However, Eclipse (Juno) fails to recognize this tag and fails the validation of the web.xml. Changing the servlet contents by hand in the deployed project seems to make the project undeployable. So obviously I am doing something wrong here.

Here comes my maven file. Just for the sake of it.


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>se.point.unity</groupId>
  <artifactId>UnityGui</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  
  <repositories>
  
    <repository>
      <id>vaadin-addons</id>
      <url>http://maven.vaadin.com/vaadin-addons</url>
    </repository>
  
    <repository>
     <id>EclipseLink</id>
     <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
    </repository>
  
  </repositories>
  
  <dependencies>
    
      <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator-annotation-processor</artifactId>
        <version>4.1.0.Final</version>
      </dependency>
    
      <dependency>
	    <groupId>com.vaadin.addon</groupId>
	    <artifactId>jpacontainer-addon-agpl-3.0</artifactId>
	    <version>2.1.0</version> <!-- ${jpacontainer.version} -->
	    <exclusions>
	      <exclusion>
	        <groupId>com.vaadin</groupId>
	        <artifactId>vaadin</artifactId>
	      </exclusion>
	    </exclusions>
	  </dependency>
  	
  	  <dependency>
  		<groupId>com.vaadin</groupId>
  		<artifactId>vaadin</artifactId>
  		 <version>6.8.4</version>
  	  </dependency>
  	  
  	  <dependency>
        <groupId>org.vaadin.addons</groupId>
        <artifactId>vaadin-application-server-class-loader-workaround</artifactId>
        <version>1.0.0</version> 
      </dependency>

      <dependency>
	    <groupId>com.vaadin.addon</groupId>
	    <artifactId>beanvalidation-addon</artifactId>
	    <version>1.0.0</version>
	  </dependency>
	  
	  <!--<dependency>
	    <groupId>org.eclipse.persistence</groupId>
	    <artifactId>javax.persistence</artifactId>
	    <version>2.0.0</version>
	  </dependency>-->
      
      <dependency>
  		<groupId>org.eclipse.persistence</groupId>
  		<artifactId>eclipselink</artifactId>
  		<version>2.4.1</version>
  		<scope>provided</scope>
  	  </dependency>
  	  
  	     <!-- <dependency>
  		  <groupId>javax</groupId>
  		  <artifactId>javaee-api</artifactId>
  		  <version>6.0</version>
  	  </dependency>  -->
  	  
  	  <dependency>
  	    <groupId>se.point.unity</groupId>
  	    <artifactId>persistenceunit</artifactId>
  	    <version>0.0.1-SNAPSHOT</version>
  	    <scope>provided</scope>
  	  </dependency>
  	  
  	  <dependency>
  	    <groupId>javax.validation</groupId>
	    <artifactId>validation-api</artifactId>
	    <version>1.0.0.GA</version>
	    <type>java-source</type>
  	  </dependency>
  	  
  	  <dependency>
  	    <groupId>javax.validation</groupId>
	    <artifactId>validation-api</artifactId>
	    <version>1.0.0.GA</version>
  	  </dependency>
  	  
  	  <dependency>
	    <groupId>javax.transaction</groupId>
	    <artifactId>jta</artifactId>
	    <version>1.1</version>
	    <scope>provided</scope>
      </dependency>
      
      <dependency>
	    <groupId>com.google.gwt</groupId>
	    <artifactId>gwt-user</artifactId>
	    <version>2.3.0</version>
      </dependency>
  	  <!-- <dependency>
	    <groupId>com.google.gwt</groupId>
	    <artifactId>gwt-dev</artifactId>
	  <version>2.3.0</version>
    </dependency> -->
  </dependencies>
  
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.3.0</version>
        <executions>
          <execution>
            <configuration>
              <!-- <module>com.mycompany.gwt.Module</module> -->
            </configuration>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version> 
        <configuration>
        	<webResources>
					<resource>
						<directory>${basedir}/src/main/java</directory>
						<targetPath>WEB-INF/classes</targetPath>
						<includes>
							<include>**/*.properties</include>
							<include>**/*.xml</include>
							<include>**/*.css</include>
							<include>**/*.html</include>
						</includes>
					</resource>
					<resource>
						<directory>${basedir}/src/main/resources/configfiles</directory>
						<targetPath>WEB-INF/configfiles</targetPath>
						<includes>
							<include>**/*.xsd</include>
							<include>**/*.xml</include>
						</includes>
					</resource>
				</webResources>
          <!--<webXml>WebContent/WEB-INF/web.xml</webXml>-->
        </configuration> 
      </plugin>
      
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Any ideas folks? My goals is simply to use the JPAcontainer for some simple crud views in a jboss 7.1 environment using eclipselink. And it fails miserably so far… I am fairly convinced this is due to lack of knowledge on my part, could someone point me in the right direction?