Deployment error

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Deployment error

Geert Van Muylem-2
I have a webapplication based on Stripes and stripersist
having the following deployment errors on JBOSS6


17:05:44,617 INFO  [org.hibernate.tool.hbm2ddl.SchemaUpdate] schema
update complete
17:05:44,617 INFO  [org.hibernate.util.NamingHelper] JNDI
InitialContext properties:{}
17:05:44,619 INFO  [org.stripesstuff.stripersist.Stripersist]
checking jar file from url:
vfs:/home/geert/Temp/eid-dss-mysql-distribution/jboss/server/default/deploy/
MarketPlace-1.0-SNAPSHOT.war/WEB-INF/classes/META-INF/persistence.xml
17:05:44,619 INFO  [org.stripesstuff.stripersist.Stripersist] urlPath =
/home/geert/Temp/eid-dss-mysql-distribution/jboss/server/default/deploy
/MarketPlace-1.0-SNAPSHOT.war/WEB-INF/classes/META-INF/persistence.xml
17:05:44,619 ERROR [org.stripesstuff.stripersist.Stripersist] Could not search
jar file
'/home/geert/Temp/eid-dss-mysql-distribution/jboss/server/default/deploy/
MarketPlace-1.0-SNAPSHOT.war/WEB-INF/classes/META-INF/persistence.xml'
for entities due to an IOException:
/home/geert/Temp/eid-dss-mysql-distribution/jboss/server/default/deploy/
MarketPlace-1.0-SNAPSHOT.war/WEB-INF/classes/META-INF/persistence.xml
(Not a directory)
17:05:44,619 ERROR [org.stripesstuff.stripersist.Stripersist] :
java.lang.NullPointerException
        at java.util.AbstractCollection.addAll(AbstractCollection.java:303)
[:1.6.0_31]
        at org.stripesstuff.stripersist.Stripersist.init(Stripersist.java:294)
[:151:153]
       

My persistence.xml
<!--<?xml version="1.0" encoding="UTF-8"?>-->
<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 
        http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
   version="2.0">  
   <persistence-unit name="MarketPlace" transaction-type="JTA">
      <jta-data-source>java:/MarketPlaceDS</jta-data-source>
      <class>be.zetes.marketplace.entity.User</class>
     
      <properties>
         <property name="hibernate.hbm2ddl.auto" value="update" />
         <property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
         <property name="hibernate.jdbc.use_streams_for_binary"
value="true" />
       
         <property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.JTATransactionFactory"/>
      </properties>      
   </persistence-unit>
</persistence>

My data-source:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <xa-datasource>
    <jndi-name>MarketPlaceDS</jndi-name>
    <track-connection-by-tx>true</track-connection-by-tx>
   
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
</xa-datasource-class>
    <xa-datasource-property name="ServerName">localhost
</xa-datasource-property>
    <xa-datasource-property name="DatabaseName">marketplace
</xa-datasource-property>
    <xa-datasource-property name="User">mp</xa-datasource-property>
    <xa-datasource-property name="Password">mp</xa-datasource-property>
    <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml
(optional) -->
    <metadata>
       <type-mapping>mySQL</type-mapping>
    </metadata>
  </xa-datasource>
</datasources>

What is happening?

Regards,
Geert




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Deployment error

Ben Gunter
Can you explode the war during deployment? It looks like Stripersist is unable to handle the resource URLs that point to entries within the war file.

On Mon, Jun 4, 2012 at 11:50 AM, Geert Van Muylem <[hidden email]> wrote:
I have a webapplication based on Stripes and stripersist
having the following deployment errors on JBOSS6


17:05:44,617 INFO  [org.hibernate.tool.hbm2ddl.SchemaUpdate] schema
update complete
17:05:44,617 INFO  [org.hibernate.util.NamingHelper] JNDI
InitialContext properties:{}
17:05:44,619 INFO  [org.stripesstuff.stripersist.Stripersist]
checking jar file from url:
vfs:/home/geert/Temp/eid-dss-mysql-distribution/jboss/server/default/deploy/
MarketPlace-1.0-SNAPSHOT.war/WEB-INF/classes/META-INF/persistence.xml
17:05:44,619 INFO  [org.stripesstuff.stripersist.Stripersist] urlPath =
/home/geert/Temp/eid-dss-mysql-distribution/jboss/server/default/deploy
/MarketPlace-1.0-SNAPSHOT.war/WEB-INF/classes/META-INF/persistence.xml
17:05:44,619 ERROR [org.stripesstuff.stripersist.Stripersist] Could not search
jar file
'/home/geert/Temp/eid-dss-mysql-distribution/jboss/server/default/deploy/
MarketPlace-1.0-SNAPSHOT.war/WEB-INF/classes/META-INF/persistence.xml'
for entities due to an IOException:
/home/geert/Temp/eid-dss-mysql-distribution/jboss/server/default/deploy/
MarketPlace-1.0-SNAPSHOT.war/WEB-INF/classes/META-INF/persistence.xml
(Not a directory)
17:05:44,619 ERROR [org.stripesstuff.stripersist.Stripersist] :
java.lang.NullPointerException
       at java.util.AbstractCollection.addAll(AbstractCollection.java:303)
[:1.6.0_31]
       at org.stripesstuff.stripersist.Stripersist.init(Stripersist.java:294)
[:151:153]


My persistence.xml
<!--<?xml version="1.0" encoding="UTF-8"?>-->
<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
       http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
  version="2.0">
  <persistence-unit name="MarketPlace" transaction-type="JTA">
     <jta-data-source>java:/MarketPlaceDS</jta-data-source>
     <class>be.zetes.marketplace.entity.User</class>

     <properties>
        <property name="hibernate.hbm2ddl.auto" value="update" />
        <property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
        <property name="hibernate.jdbc.use_streams_for_binary"
value="true" />

        <property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.JTATransactionFactory"/>
     </properties>
  </persistence-unit>
</persistence>

My data-source:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
 <xa-datasource>
   <jndi-name>MarketPlaceDS</jndi-name>
   <track-connection-by-tx>true</track-connection-by-tx>

<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
</xa-datasource-class>
   <xa-datasource-property name="ServerName">localhost
</xa-datasource-property>
   <xa-datasource-property name="DatabaseName">marketplace
</xa-datasource-property>
   <xa-datasource-property name="User">mp</xa-datasource-property>
   <xa-datasource-property name="Password">mp</xa-datasource-property>
   <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml
(optional) -->
   <metadata>
      <type-mapping>mySQL</type-mapping>
   </metadata>
 </xa-datasource>
</datasources>

What is happening?

Regards,
Geert




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Deployment error

Geert Van Muylem-2

Hi,


I don't get the error anymore during deployment.

I've based my code on the stripesbook from F. Daoud

The Stripersist.getEntityManager() gives me the error


18:48:04,083 ERROR [net.sourceforge.stripes.exception.DefaultExceptionHandler]
Unhandled exception in exception handler.: java.lang.IllegalStateException:
A JTA EntityManager cannot use getTransaction()
        at
org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction
(AbstractEntityManagerImpl.java:818)
[:3.6.2.Final]
        at
org.stripesstuff.stripersist.Stripersist.getEntityManager(Stripersist.java:574)
[:151:153]
        at
org.stripesstuff.stripersist.Stripersist.getEntityManager(Stripersist.java:601)
[:151:153]


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Deployment error

Ben Gunter
It appears you've set your persistence.xml up for JTA and Stripersist doesn't support it (or something along those lines).

On Mon, Jun 4, 2012 at 1:02 PM, Geert Van Muylem <[hidden email]> wrote:

Hi,


I don't get the error anymore during deployment.

I've based my code on the stripesbook from F. Daoud

The Stripersist.getEntityManager() gives me the error


18:48:04,083 ERROR [net.sourceforge.stripes.exception.DefaultExceptionHandler]
Unhandled exception in exception handler.: java.lang.IllegalStateException:
A JTA EntityManager cannot use getTransaction()
       at
org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction
(AbstractEntityManagerImpl.java:818)
[:3.6.2.Final]
       at
org.stripesstuff.stripersist.Stripersist.getEntityManager(Stripersist.java:574)
[:151:153]
       at
org.stripesstuff.stripersist.Stripersist.getEntityManager(Stripersist.java:601)
[:151:153]


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Deployment error

Geert Van Muylem-2
Hi,

If I switch to a <non-jta-data-source>java:/MarketPlaceDS
</non-jta-data-source>

I get in the Stripersist.getEntityManager(PERSISTENCEUNIT).persist(object);
the following error
9:33:42,851 ERROR [org.apache.catalina.core.ContainerBase.
[jboss.web].[localhost].[/MarketPlace].[StripesDispatcher]]
Servlet.service() for servlet StripesDispatcher threw exception:
org.hibernate.PersistentObjectException:
detached entity passed to persist: be.zetes.marketplace.entity.User at

org.hibernate.event.def.DefaultPersistEventListener.onPersist

DefaultPersistEventListener.java:127) [:3.6.2.Final]

Geert


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Deployment error

Ben Gunter
That looks like a programming error on your part. If you don't understand what the error message is saying, then you should read up on general JPA concepts to get a better idea of how to manage your entities.

To me, it looks a lot like a very common error: storing a User entity in the HTTP session. When you put that entity in the HTTP session, it becomes detached at the end of the request cycle. If you really want to store the User entity itself in the HTTP session then you'll have to reattach it to the current JPA session (with EntityManager#merge) for each request. The simpler approach is to store the User's ID in the session instead and provide a getUser() in your base ActionBean or ActionBeanContext implementation that looks up the entity by ID.

-Ben

On Mon, Jun 4, 2012 at 1:41 PM, Geert Van Muylem <[hidden email]> wrote:
Hi,

If I switch to a <non-jta-data-source>java:/MarketPlaceDS
</non-jta-data-source>

I get in the Stripersist.getEntityManager(PERSISTENCEUNIT).persist(object);
the following error
9:33:42,851 ERROR [org.apache.catalina.core.ContainerBase.
[jboss.web].[localhost].[/MarketPlace].[StripesDispatcher]]
Servlet.service() for servlet StripesDispatcher threw exception:
org.hibernate.PersistentObjectException:
detached entity passed to persist: be.zetes.marketplace.entity.User at

org.hibernate.event.def.DefaultPersistEventListener.onPersist

DefaultPersistEventListener.java:127) [:3.6.2.Final]

Geert


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users