geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Geronimo 2.0/openejb/postgresql
Date Wed, 09 Jan 2008 18:40:33 GMT
I recommend you set up a second postgres datasource with no tx  
support, say DefaultNoTxDS (pointing to the same postgres db as  
DefaultDS)

Then in persistence.xml

    <jta-data-source>DefaultDS</jta-data-source>
    <non-jta-data-source> DefaultNoTxDS </non-jta-data-source>

and leave out

      <property name="openjpa.ConnectionDriverName"  
value="org.postgresql.Driver" />
      <property name="openjpa.ConnectionUserName" value="postgres" />
      <property name="openjpa.ConnectionPassword" value="postgres" />
      <property name="openjpa.jdbc.ConnectionURL"  
value="jdbc:postgresql://localhost:5432/video" />

and tell us what problems if any you get.

thanks
david jencks


On Jan 9, 2008, at 3:38 AM, Mario Kofler wrote:

> hello,
>
> i searched the web for the solution but i did not find :(
>
> my setup:
>
> i want to get my application running on Geronimo 2.0 with openejb  
> as entity manager and postgresql as underlying database.
>
> things i already did:
>
> i did create a new database pool called "DefaultDS" through the  
> admin-console
>
> then for my application i modified the persistence.xml file  
> according to mails i found in the web:
>
> <persistence 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/ 
> persistence_1_0.xsd"
>         version="1.0">
>  <persistence-unit name="valhalla" transaction-type="JTA">
>    <description>videothek</description>
>     
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</ 
> provider>
>    <!-- <jta-data-source>DefaultDS</jta-data-source>
>    <non-jta-data-source>NoTxDatasource</non-jta-data-source> -->
>     <jar-file>videothek.jar</jar-file>
>    <!--class>vt.bean.entity.Person</class>
>    <class>vt.bean.entity.Actor</class>
>    <class>vt.bean.entity.Director</class>
>    <class>vt.bean.entity.Movie</class>
>    <class>vt.bean.entity.Dvd</class> -->
>    <exclude-unlisted-classes />
>    <properties>
>      <property name="openjpa.jdbc.DBDictionary" value="postgres"/>
>      <property name="openjpa.ConnectionDriverName"  
> value="org.postgresql.Driver" />
>      <property name="openjpa.ConnectionUserName" value="postgres" />
>      <property name="openjpa.ConnectionPassword" value="postgres" />
>      <property name="openjpa.jdbc.ConnectionURL"  
> value="jdbc:postgresql://localhost:5432/video" />
>      <property name="openjpa.jdbc.SynchronizeMappings" value="false"/>
>    </properties>
>  </persistence-unit>
> </persistence>
>
> my geronimo-web.xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app
>    xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
>   xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
>   xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
>   xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
>    <sys:environment>
>        <sys:moduleId>
>            <sys:artifactId>videothek</sys:artifactId>
>        <sys:type>war</sys:type>
>        </sys:moduleId>
>
>        <sys:dependencies>
>          <sys:dependency>
>            <sys:groupId>console.dbpool</sys:groupId>
>            <sys:artifactId>DefaultDS</sys:artifactId>
>          </sys:dependency>
>    </sys:dependencies>
>    </sys:environment>
>      <context-root>/valhalla</context-root>
>
>    <!-- security settings, if any, go here -->
>
>    <resource-ref>
>        <ref-name>jdbc/valhalla</ref-name>
>        <resource-link>DefaultDS</resource-link>
>    </resource-ref>
> </web-app>
>
> then it is possible to deploy the application to the geronimo server.
>
> the problem is as soon as i want to create an entity manager in my  
> application:
>
> /*code snippet*/
>  @PersistenceUnit(unitName="valhalla")
>    private EntityManagerFactory emf;
>    private EntityManager em;     em = emf.createEntityManager();
> /*code snippet*/
>
> i get the following error:
>
>    [exec] Caused by: java.lang.Exception:  
> java.lang.RuntimeException: There were errors initializing your  
> configuration: <1.0.0-r561970-r561970 fatal store error>  
> org.apache.openjpa.util.StoreException: org.postgresql.Driver in  
> classloader org.apache.geronimo.configs/openjpa/2.0.1/car
>
> root cause:
>
> javax.ejb.NoSuchEJBException: reference is invalid
> 	org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke 
> (BaseEjbProxyHandler.java:208)
> 	org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke 
> (Jdk13InvocationHandler.java:49)
> 	$Proxy68.getNewData(Unknown Source)
> 	org.apache.jsp.addTool_jsp._jspService(addTool_jsp.java:165)
> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> 	org.apache.jasper.servlet.JspServletWrapper.service 
> (JspServletWrapper.java:388)
> 	org.apache.jasper.servlet.JspServlet.serviceJspFile 
> (JspServlet.java:320)
> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>
>
> please help me, i am stuck for days now with this problem and i  
> dont find nothing new anymore on the net. i tried mayn different  
> kinds of deployment descriptors. this error is the farthest i get.
>
> thank you very much for your help,
>
> greetings,
>
> mario


Mime
View raw message