3 Replies Latest reply on Aug 26, 2011 3:26 PM by Thomas Clifford

    stripersist example on JBoss

    Sidney Zurch Novice

      Would someone who is familiar with the intricacies of JBoss and JPA be interested in trying to get this .war to work in something later than JBoss 4.2.3.GA?


      Stripersist is a slick DAO layer that works with the increasingly popular Stripes framework.


      The attached .war is basically the stock example from http://sourceforge.net/projects/stripes-stuff/files/Stripersist/1.0.3/stripersist-1.0.3-example.war/download  with some jars in WEB-INF/lib removed for use with JBoss.


      The stock .war works in Tomcat, and the attached .war works fine in 4.2.3, but in anything after JBoss5, the deployer fails with a message stating that a JTA transaction is required for the persistence unit.


      I've tried (for days) using a <non-jta-data-source>, but then the deployer has problems trying to locate the datasource.  I'm sure it's probably me.


      This should be really simple for someone who knows what they're doing.


      One tip: I had to put the c3P0 jar in server/default/lib to get pooling to work on 4.2.3.  If you don't want to mess with pooling, just comment it out in persistence.xml

        • 1. Re: stripersist example on JBoss
          Thomas Clifford Newbie



          Did you ever get an answer for your question ?


          I'm trying to get the example working on JBoss 5.1.0, and it's telling me:


          12:38:35,772 INFO  [STDOUT] 12:38:35,769 ERROR Stripersist:82 -

          javax.persistence.PersistenceException: [PersistenceUnit: SPERPU] Unable to build EntityManagerFactory

                  at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:678)

                  at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:127)

                  at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)

                  at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)



          Caused by: org.hibernate.HibernateException: Could not find datasource: java:/SPER-DS

                  at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:8


                  at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.


                  ... 86 more


          My xxxxx-ds.xml:



          <?xml version="1.0" encoding="UTF-8"?>


          <!-- ===================================================================== -->

          <!--                                                                       -->

          <!--  stripersist JBoss db connection configuration                        -->

          <!--                                                                       -->

          <!-- ===================================================================== -->














              <!--set this any higher than max_connections on your

               MySQL server, usually this should be a 10 or a few

               of connections, not hundreds or thousands -->




              <!-- Don’t allow connections to hang out idle too long,

               never longer than what wait_timeout is set to on the

               server...A few minutes is usually okay here,

               it depends on your application

               and how much spikey load it will see -->




              <!-- If using Connector/J 3.1.8 or newer, you can use

                 our implementation of these to increase the robustness

                 of the connection pool. -->




              <connection-property name="autoReconnect">true</connection-property>









          And my persistence.xml:



          <persistence xmlns="http://java.sun.com/xml/ns/persistence"


             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"


             <persistence-unit name="TestPU">





                       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>

                       <property name="hibernate.hbm2ddl.auto" value="validate"/>








          In my base action bean:





          // ....and my method to get the list of records:


          public List<SimpleEntity> getSimpleEntities()


               ValidationErrors errors = getContext().getValidationErrors();


               ArrayList simpleEntities = new ArrayList<SimpleEntity>();




                    Query thisq = em.createQuery( "from SimpleEntity" );

                    simpleEntities = (ArrayList<SimpleEntity>) thisq.getResultList();


               catch( NullPointerException npe )


                    log.error("Could not get SimpleEntity list!");

                    return new ArrayList<SimpleEntity>();


               return simpleEntities;





          Thanks.....Tom C.

          • 2. Re: stripersist example on JBoss
            Sidney Zurch Novice

            "Not a peep" - in over two months.


            I think I even sent a msg to the stripersist author.


            The really sad thing is that it's probably something pretty simple.



            • 3. Re: stripersist example on JBoss
              Thomas Clifford Newbie

              Yeah....that figures.

              I've googled stripersist, but there appears little interest in it.

              If I find something I'll post it here.