5 Replies Latest reply on Oct 18, 2005 5:35 PM by aguizar

    EJB help

    lvdberg

      I am close to a nervous breakdown. I tried the examples from the tutorial and everything works fine. But the application (an traffic management incident viewer) is divided in a "fat client", running the presentation software and a JBoss server as the backend server, controlling the whole process. A number of session facade beans communicate with the clients and add and remove "incidents" from the database.

      One of the requirements of the application is to start off automtic processes to interact with the "troopers" (police, firebrigade ambulance etc.) A realy nice job for jBPM...

      But now to the problem. My first attempt to use jBPM behind a sessionbean fails completely.

      In the sessionbean I create a bean using the jndi: reference.
      jbpmSessionFactory = (JbpmSessionFactory) ctx.lookup("java:/jbpm/JbpmSessionFactory");

      And I can create a session with JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession();

      After that everything resulting in a db interaction fails. Even when I change the settings to use the singleton result in a error.
      I can see in te startup screen that all Hibernate configurations are created, so I presume that I would be able to interact with it.

      The question is: What are the basic steps needed to make JBPM work in the EJB-container.

      Additionally: I use the SAR from the starterkit and deploy that together with the HAR-deployer in my 4.0.0 deployed server (maybe I should upgrade but I would like to understand why)

      Please, any help would be ver appreciated.

      P.S. I really need to compliment the JBPM people, it's great stuff....




      It gives no error, but when I try to do something with

        • 1. Re: EJB help
          aguizar

          I really hate to give short answers to long questions, but... in what error do your database accesses result?

          JBoss 4.0.0 was released way back in Sep 20, 2004. The fact that it does not include the HAR deployer implies that the QA team did not take it into account at that time. This reason alone is, IMO, enough to consider upgrading if your environment permits it.

          • 2. Re: EJB help
            lvdberg

            Thanks for your answer! Although still struggling with JBPM I am getting the pieces of the puzzle clearer now.

            When I look at the examples I see that the database schema is created "on the fly". I see Hibernate doing a lot of stuff in my application, but I am not sure if there is an actual database created. It should be something in that direction because one of the errors is dbase related.

            When I include code to create the DB-scheme it gives me the error:

            "You cannot commit during a managed transaction!"

            So, I am not sure if I am talking to an existing database, because I don't use: jbpmSessionFactory.getJbpmSchema().createSchema();
            When I do that, my ejb-container complains..

            I checked the Kit and looked at the startup code, because I am using the JBPM SAR in my app-server (and also replaced the HAR-deployer) which works fine with my existing application.

            The included piece of logging outpt comes from starting up the starter kit, which I do NOT see in my own log when I start up the server. it makes me wonder because it's all about creating the server and binding 'java:/jbpm/JbpmSessionFactory'. There is no error when I look up this name in my application , so it seems like there is a name, but there is no usable service behind it.

            One of the things I am thinking of is running my application in the toolkit server and see what happens...

            11:23:26,164 DEBUG [JbpmService] Creating jboss.jbpm:name=DefaultJbpm,service=Jb
            pmService
            11:23:26,164 DEBUG [JbpmService] Created jboss.jbpm:name=DefaultJbpm,service=JbpmService
            11:23:27,476 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=DataSourceBinding,name=Defa
            ultDS to JNDI name 'java:DefaultDS'
            11:23:27,686 DEBUG [JbpmService] Starting jboss.jbpm:name=DefaultJbpm,service=Jb
            pmService
            11:23:27,686 DEBUG [JbpmService] starting jbpmSessionFactory for 'java:/jbpm/Jbp
            mSessionFactory'...
            11:23:27,706 DEBUG [JbpmConfiguration] jbpm.files.dir=c:/jbpm.data
            11:23:27,706 DEBUG [JbpmConfiguration] jbpm.task.instance.class=org.jbpm.taskmgm
            t.exe.TaskInstance
            11:23:27,706 DEBUG [JbpmConfiguration] jbpm.hibernate.cfg.xml=jbpm.hibernate.cfg
            .xml
            11:23:27,706 DEBUG [JbpmConfiguration] jbpm.scheduler.service.factory=org.jbpm.s
            cheduler.impl.SchedulerServiceImpl
            11:23:27,706 DEBUG [JbpmConfiguration] jbpm.hibernate.properties=jbpm.hibernate.
            properties

            • 3. Re: EJB help
              alal007

              any luck with this issue? I forsee myself have the same requirement

              • 4. Re: EJB help
                lvdberg

                Sorry I am still working on the subject. I have decided to get things working with POJO´s and JMS to interact with the system and - in parallel - keep looking for a more EJB-ish solution.

                I have read that JBPM 2 has EJB-examples, but I can't find them anymore. Some clues would be appreciated. I promise to share my solution with the community...

                • 5. Re: EJB help
                  aguizar

                   

                  not sure if there is an actual database created

                  The jBPM service archive uses the default datasource, which is a hypersonic in-process database. You can't access it from other processes. TCP connections from other processes are disabled for security reasons.

                  The starters kit starts a standalone hypersonic database, creates the schema, saves a sample definition, stops the database, then takes the resulting files. You can use this approach for ease of development. When you move to production, you can switch to an external database. After that you will use the db compatibility package included in the starters kit to generate the SQL scripts and then execute them in your DBMS.

                  If you use container-managed transactions, you need to modify the Hibernate configuration. See the Hibernate reference, section 4.8 for details. Open file JBPM_HOME/src/resources/jbpm.sar/jbpm.hibernate.properties and make the needed changes. Finally, rebuild the service archive by running target build.service.archive of the Ant build file in the base directory of your jBPM installation.