2 Replies Latest reply on Jan 9, 2006 10:26 PM by jimmy

    Struts with JBPM problem

    Tiago Silva Newbie

      Hi,

      After soffering a little i achieved on configuring my JBPM server to Mysql. The websale app ran just fine on mysql.

      My problems started again when i tried to build my own struts application very similar to websale app.

      I made a simple Action to retrieve the JBPM users and send them into request, but it's throwing this exception: couldn't fetch JbpmSessionFactory from jndi 'java:/jbpm/JbpmSessionFactory'.

      There goes the source.

      public class ListarGruposAction extends Action {
       JbpmSessionFactory bpmSessionFactory;
       public ActionForward execute(
       ActionMapping mapping,
       ActionForm form,
       HttpServletRequest request,
       HttpServletResponse response) throws Exception{
      
       bpmSessionFactory = JbpmSessionFactory.getInstance();
       JbpmSession bpmSession = bpmSessionFactory.openJbpmSession();
       IdentitySession identity = new IdentitySession(bpmSession.getSession());
      
       Collection users = identity.getUsers();
      
      
       Iterator i = users.iterator();
       User user= null;
       while (i.hasNext()){
       user = (User)i.next();
       System.out.println("Nome: " + user.getName());
       }
      
       request.setAttribute("users",users);
       return mapping.findForward("success");
       }
      
      }
      


      There goes the stack trace


      11:06:20,181 DEBUG [JbpmSessionFactory] fetching JbpmSessionFactory from 'java:/
      jbpm/JbpmSessionFactory'
      11:06:20,181 WARN [RequestProcessor] Unhandled Exception thrown: class java.lan
      g.RuntimeException
      11:06:20,181 ERROR [[action]] Servlet.service() for servlet action threw excepti
      on
      java.lang.RuntimeException: couldn't fetch JbpmSessionFactory from jndi 'java:/j
      bpm/JbpmSessionFactory'
      at org.jbpm.db.JbpmSessionFactory.getInstance(JbpmSessionFactory.java:64
      )
      at com.struts.action.ListarGruposAction.execute(Unknown Source)
      at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
      tProcessor.java:421)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
      va:226)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:116
      4)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      icationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      ilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
      lter.java:81)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      icationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      ilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
      alve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
      alve.java:178)
      at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrinc
      ipalValve.java:39)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
      yAssociationValve.java:153)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
      e.java:59)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
      ava:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
      ava:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
      ve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
      a:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
      :856)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
      ssConnection(Http11Protocol.java:744)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
      int.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWor
      kerThread.java:112)
      at java.lang.Thread.run(Thread.java:534)


      If someone could help.

        • 1. Re: Struts with JBPM problem
          msegvich Newbie

          Looks like it's trying to look up the session through JNDI and you don't have JNDI setup. For example, Tomcat doesn't support JNDI. To disable JNDI just comment out the following in your jbpm.properties file:

          jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory

          Doing so prevent a JNDI lookup for the object as opposed to creating one.

          If you want to use JNDI then you have to create an entry for the JbpmSessionFactory. Hope that helps.

          • 2. Re: Struts with JBPM problem
            jimmy Newbie

            how to create an entry for the JbpmSessionFactory ?
            can you give me a sample ? thanks !