12 Replies Latest reply on Jan 6, 2012 6:28 AM by swiderski.maciej

    JBPM and WebLogic - someone with success?

    thomastn

      Hi

       

      We have trouble with Jpbm5.1 on Weblogic 10.3.4 and Oracle database. The problem is with HumanTask and persistent. For the moment we are able to create HumanTasks, but not able to "fetch" them and complete them. Does someone have a workling sample of jbpm5.1 (or 5.2) for Weblogic. Interestet in looking at at persistence.xml file and the code to setup the HumanTask server. Adding our files here, so if some smart jbpm people can se what we are doing wrong, we wold have a happy X-mas..

       

      Config from persistance.xml

       

      <property name="hibernate.connection.datasource" value="jdbc/jbpm" />

      <property name="hibernate.max_fetch_depth" value="3" />

        <property name="hibernate.hbm2ddl.auto" value="create-drop" />

        <property name="hibernate.show_sql" value="true" />

        <property name="hibernate.transaction.manager_lookup_class"  value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />

       

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

                                               <property name="hibernate.connection.autocommit" value="false" />

        • 1. Re: JBPM and WebLogic - someone with success?
          thomastn

          was hitting return before the post was finished..

           

          code to setup task server:

           

              EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.task");

              Environment env = KnowledgeBaseFactory.newEnvironment();

              env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

                 SystemEventListener systemEventListener = SystemEventListenerFactory.getSystemEventListener();

               TaskService taskService = new TaskService(emf, systemEventListener);

               TaskServiceSession taskSession = taskService.createSession();

              Group group = new Group("saksbehandler");

               taskSession.addGroup(group);

              for (String user : usersToAdd)

              {

                 ttlog.logDebug("Adding user......:" + user);

                taskSession.addUser(new User(user));

                ttlog.logDebug("User added:" + user);

              }

              ttlog.logDebug("Starting MinaTaskServer...");

              MinaTaskServer server = new MinaTaskServer(taskService);

              Thread thread = new Thread(server);

              thread.start();

            

              try

              {

              

                Thread.sleep(1000);

                //taskSession.dispose();

              }

               catch (Exception e)

              {

                ttlog.logApplicationWarning("Unable to sleep (wait) when setting up TaskServer", e);

              }

              ttlog.logDebug("Started MinaTaskServer!");

             }

           

          code to get tasks:

          BlockingTaskSummaryResponseHandler summaryHandler = new BlockingTaskSummaryResponseHandler();

                client.getTasksAssignedAsPotentialOwner(user, "en-UK", summaryHandler);

                List<TaskSummary> tasks = summaryHandler.getResults();

           

               

           

           

          Error messeage when running code to get active tasks (when seleting in orcle db we find the tasks..)

           

          Server-side Exception: org.hibernate.exception.GenericJDBCException: could not execute query sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) java.lang.reflect.Constructor.newInstance(Constructor.java:513) org.jbpm.task.service.responsehandlers.AbstractBaseResponseHandler.createSideException(AbstractBaseResponseHandler.java:74) org.jbpm.task.service.responsehandlers.AbstractBlockingResponseHandler.waitTillDone(AbstractBlockingResponseHandler.java:48) org.jbpm.task.service.responsehandlers.BlockingTaskSummaryResponseHandler.getResults(BlockingTaskSummaryResponseHandler.java:38) no.vegvesen.tt.service.jbpm.controller.ProcessController.getAllTasksForUser(ProcessController.java:162) no.vegvesen.tt.service.jbpm.servelt.JbpmTestServlet.getAllTasksForUser(JbpmTestServlet.java:166) no.vegvesen.tt.service.jbpm.servelt.JbpmTestServlet.performTask(JbpmTestServlet.java:274) no.vegvesen.tt.service.jbpm.servelt.JbpmTestServlet.doGet(JbpmTestServlet.java:56) javax.servlet.http.HttpServlet.service(HttpServlet.java:707) javax.servlet.http.HttpServlet.service(HttpServlet.java:820) weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300) weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111) java.security.AccessController.doPrivileged(Native Method) oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313) oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413) oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94) oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161) oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71) weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136) weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715) weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681) weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277) weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183) weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454) weblogic.work.ExecuteThread.execute(ExecuteThread.java:207) weblogic.work.ExecuteThread.run(ExecuteThread.java:176) no.vegvesen.tt.service.jbpm.controller.ProcessController.getAllTasksForUser(ProcessController.java:175) no.vegvesen.tt.service.jbpm.servelt.JbpmTestServlet.getAllTasksForUser(JbpmTestServlet.java:166) no.vegvesen.tt.service.jbpm.servelt.JbpmTestServlet.performTask(JbpmTestServlet.java:274) no.vegvesen.tt.service.jbpm.servelt.JbpmTestServlet.doGet(JbpmTestServlet.java:56) javax.servlet.http.HttpServlet.service(HttpServlet.java:707) javax.servlet.http.HttpServlet.service(HttpServlet.java:820) weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300) weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111) java.security.AccessController.doPrivileged(Native Method) oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313) oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413) oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94) oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161) oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71) weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136) weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715) weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681) weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277) weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183) weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454) weblogic.work.ExecuteThread.execute(ExecuteThread.java:207) weblogic.work.ExecuteThread.run(ExecuteThread.java:176)

          • 2. Re: JBPM and WebLogic - someone with success?
            calca

            Isn't there any other error log? If not, you can debug the server classes (TaskServerHandler for example) and check the cause of the error.

             

            Demian

            • 3. Re: JBPM and WebLogic - someone with success?
              thomastn

              Hi again..

               

              I am not able to see more than the message above, sorry.

              • 4. Re: JBPM and WebLogic - someone with success?
                calca

                Strange.. I have configured jbpm into weblogic into the past. I recommend debugging the server (from TaskServerHandler, TaskServiceSession) classes, as you will find our the root cause of this "could not execute query "

                 

                Demian

                • 5. Re: JBPM and WebLogic - someone with success?
                  thomastn

                  Can you share som files with us? I am VERY interested in seeing your persistance.xml, your code to setup HumanTask server and dependencies in your pom. Mybe you can save our x-mas holyday....

                  • 6. Re: JBPM and WebLogic - someone with success?
                    swiderski.maciej

                    How do you start the task server - is it deployed to the WLS as well?

                     

                    The exception (stack trace) that you attached is from client side (task client) and the error happened on server side (task server). Maybe you can take a look at the sysout and syserr of the task server process if it is not deployed to WLS.

                     

                    HTH

                    • 7. Re: JBPM and WebLogic - someone with success?
                      calca

                      Hi Thomas, I'd be glad to share it, but honestly I don't have it, it was in client's repository.

                       

                      Anyway, to solve this issue, you should check the server exception checkinhg the sysout and syserr as Maciej said, or debugging this code to check the exception.

                       

                      Demian

                      • 8. Re: JBPM and WebLogic - someone with success?
                        thomastn

                        We can now start up a new porcess with HumanTaks and Session persistence, but... SessionInfo never gets written to the database (HumanTask is persisted ok). The result is that when we try to load the session again it fails - this is excpected since we can not wrtite to the database.

                        (We are starting Jbpm5 for a EJB context)

                         

                        The problem now (which we can se in the Hibernate log)

                        [05/01/12 03:33:12:012 CET] DEBUG ast.ErrorCounter: throwQueryException() : no errors

                        [05/01/12 03:33:12:012 CET] DEBUG impl.SessionFactoryImpl: Checking 0 named SQL queries

                        [05/01/12 03:33:12:012 CET] DEBUG persistence.SingleSessionCommandService: Instantiating  JtaTransactionManager

                        [05/01/12 03:33:12:012 CET] DEBUG jta.JtaTransactionManager: No JTA TransactionManager found at fallback JNDI location [java:comp/TransactionManager]

                        javax.naming.NameNotFoundException: While trying to look up comp/TransactionManager in /app/ejb/svv-tt-service-3.0.0.jar#ProcessControllerFacadeBean.; remaining name 'comp/TransactionManager'

                                at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)

                                at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:144)

                                at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)

                                at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)

                                at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)

                                at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)

                                at javax.naming.InitialContext.lookup(InitialContext.java:392)

                         

                        I think this come for the setup of the Environment:

                        ttlog.logDebug("Creating EntityManagerFactory for persistant session");

                            EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.session");

                            Environment env = KnowledgeBaseFactory.newEnvironment();

                            env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

                         

                           

                              When running i Junit mode (java SE we can use Bitronix and the line under works fine

                                      env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());

                           

                        Do someone now how we can do the same in WLS? Or must we do someting else to tell Jbpm where to find the transaction manager?

                        • 9. Re: JBPM and WebLogic - someone with success?
                          swiderski.maciej

                          Thomas, seems like transaction manager can't be obtained with out of the box mechanism, what you could try is to set transaction manager in environment in the same way as for JUnit tests:

                          • use initial context look up if you know JNDI name where transaction manager is bound to on WebLogic
                          • use TransactionHelper class from WebLogic to obtain it

                           

                          BTW, can you find following log entry just after exception that you shared with us:

                           

                          JTA TransactionManager found at fallback JNDI location
                          

                           

                          HTH

                          • 10. Re: JBPM and WebLogic - someone with success?
                            thomastn

                            Thansk for tips, we will try.

                             

                            BTW: We can NOT se any line in the log where JTA TransactionManager is found

                            • 11. Re: JBPM and WebLogic - someone with success?
                              thomastn

                              Hi again..

                               

                              After some more log study it looks like WebLogic transaction manager is avaliable at jta.TransactionManager: java:weblogic/TransactionManager

                               

                              So the question is how to tell Jpbm to look at this location.

                               

                              do you know?

                               

                              Thomas

                              • 12. Re: JBPM and WebLogic - someone with success?
                                swiderski.maciej

                                I am afraid jBPM does not have such functionality at the moment, I mean just to inform it about JNDI name for transaction manager. It has several fallback names configured but they are final. With slight modification to the code base it could be done, but probably you are interested in changing the code base, at least not at the moment, right?

                                 

                                Since you know the exact JNDI name you can just look it up and set on the environment when creating sessions.

                                 

                                P.S.

                                Could be a good candidate for an enhancement to provide a mechanism that will allow to set custom JNDI names for some runtime components, such as transaction manger.