1 2 Previous Next 20 Replies Latest reply on Jul 4, 2006 10:48 AM by goddam Go to original post
      • 15. Re: Process Instantiation
        goddam

        Hi shiv

        Shiv:
        well.. i have that class "instanciacao" in the JBOSS Server like a "Web Service".. and i am invoking her from a client:

        Here is the code of the cliente..
        <% // includes necessários para ligar a um web service em AXIS %>
        <%@ page import="org.apache.axis.client.Call" %>
        <%@ page import="org.apache.axis.client.Service" %>
        <%@ page import="org.apache.axis.encoding.XMLType" %>
        <%@ page import="javax.xml.rpc.ParameterMode" %>
        <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">








        Introduza o nome do processo a ser instanciado:
        Introduza o valor da encomenda que deseja efectuar:







        <%


        if (!(request.getParameter("num1")==null))
        {
        if(!(request.getParameter("num1").equals("")))
        {
        String n1 = request.getParameter("num1");
        Integer n2 = new Integer(request.getParameter("num2"));

        String endpoint = "http://localhost:8080/axis/instanciacao.jws";

        //instânciar axis e call
        Service service = new Service();
        Call call = (Call) service.createCall();

        //url de ligação
        call.setTargetEndpointAddress( new java.net.URL(endpoint) );

        //nome do método a chamar
        call.setOperationName( "inst" );

        //definir nomes do parametros a enviar
        // configg=2;
        call.addParameter( "i", XMLType.XSD_INT, ParameterMode.IN );
        call.addParameter( "numero", XMLType.XSD_INT, ParameterMode.IN );




        //definir o tipo de retorno
        call.setReturnType(XMLType.XSD_ANYTYPE);

        //invocar o web service e imprimir o resultado na pagina
        call.invoke(new Object[]{n1,n2});
        // out.println("Resultado: "+ret);
        }
        }

        %>




        Shiv please take note that i am already changed the service.. so at this time the client choose the process name to instanciate and chage the value of one variable of that process..but you only have to change one or to thing to work with that class that i put here..if you have any more questions..please ask...
        I don´t make any changes to the configuration file... that service and this client(with a few changes) is enough to make the process start..


        • 16. Re: Process Instantiation
          goddam

          Hi ronald!!

          Well regarding my error..

          I made many tests and it only apears that error when the process have tasks to be done by a user..like write the value of a variable..or something like this...

          When the task is to a user read a thing only.. and the process doesn´t have any more tasks, it finishs.. the error don´t appears...
          But on this final case i have to always shutdown the server and restart it.. to works..(is seems very strange)

          On one of your last posts you tell me to put here the logging regist of JBPM server..
          and think u are thinking on the : \jbpm-starters-kit-3.1\jbpm-server\server\jbpm\log right?

          where.. here ot comes.. i truly don´t understand this error..it can be because of some autentication process?.. because.. with the instantiation true java code..i am passing the process of "login" on the JBPM Web app.




          FILE:


          17:04:44,468 DEBUG [JRMPProxyFactory] added interceptor type: class org.jboss.proxy.ClientMethodInterceptor
          17:04:44,468 DEBUG [JRMPProxyFactory] added interceptor type: class org.jboss.invocation.InvokerInterceptor
          17:04:44,468 DEBUG [ServiceController] recording that jboss:service=proxyFactory,target=ClientUserTransactionFactory depends on jboss:service=invoker,type=jrmp
          17:04:44,468 DEBUG [ServiceConfigurator] considering with object name jboss:service=invoker,type=jrmp
          17:04:44,468 DEBUG [ServiceController] recording that jboss:service=ClientUserTransaction depends on jboss:service=proxyFactory,target=ClientUserTransactionFactory
          17:04:44,468 DEBUG [ServiceConfigurator] considering with object name jboss:service=proxyFactory,target=ClientUserTransactionFactory
          17:04:44,468 DEBUG [ServiceCreator] About to create bean: jboss:service=proxyFactory,target=ClientUserTransaction with code: org.jboss.invocation.jrmp.server.JRMPProxyFactory
          17:04:44,500 DEBUG [ServiceCreator] Created bean: jboss:service=proxyFactory,target=ClientUserTransaction
          17:04:44,500 DEBUG [ServiceConfigurator] InvokerName set to jboss:service=invoker,type=jrmp in jboss:service=proxyFactory,target=ClientUserTransaction
          17:04:44,515 DEBUG [ServiceConfigurator] TargetName set to jboss:service=ClientUserTransaction in jboss:service=proxyFactory,target=ClientUserTransaction
          17:04:44,531 DEBUG [ServiceConfigurator] ExportedInterface set to interface org.jboss.tm.usertx.interfaces.UserTransactionSession in jboss:service=proxyFactory,target=ClientUserTransaction
          17:04:44,531 DEBUG [ServiceConfigurator] ClientInterceptors set to [interceptors: null] in jboss:service=proxyFactory,target=ClientUserTransaction
          17:04:44,546 DEBUG [JRMPProxyFactory] added interceptor type: class org.jboss.proxy.ClientMethodInterceptor
          17:04:44,546 DEBUG [JRMPProxyFactory] added interceptor type: class org.jboss.invocation.InvokerInterceptor
          17:04:44,546 DEBUG [ServiceController] recording that jboss:service=proxyFactory,target=ClientUserTransaction depends on jboss:service=invoker,type=jrmp
          17:04:44,546 DEBUG [ServiceConfigurator] considering with object name jboss:service=invoker,type=jrmp
          17:04:44,546 DEBUG [ServiceController] recording that jboss:service=ClientUserTransaction depends on jboss:service=proxyFactory,target=ClientUserTransaction
          17:04:44,546 DEBUG [ServiceConfigurator] considering TxProxyName with object name jboss:service=proxyFactory,target=ClientUserTransaction
          17:04:44,546 DEBUG [ServiceCreator] About to create bean: jboss:service=invoker,type=jrmp with code: org.jboss.invocation.jrmp.server.JRMPInvoker
          17:04:44,734 DEBUG [ServiceCreator] Created bean: jboss:service=invoker,type=jrmp
          17:04:44,734 DEBUG [ServiceConfigurator] RMIObjectPort set to 4444 in jboss:service=invoker,type=jrmp
          17:04:44,734 DEBUG [ServiceConfigurator] ServerAddress set to 0.0.0.0 in jboss:service=invoker,type=jrmp
          17:04:44,750 DEBUG [ServiceController] recording that jboss:service=invoker,type=jrmp depends on jboss:service=TransactionManager
          17:04:44,750 DEBUG [ServiceConfigurator] considering with object name jboss:service=TransactionManager
          17:04:44,750 DEBUG [ServiceCreator] About to create bean: jboss:service=invoker,type=local with code: org.jboss.invocation.local.LocalInvoker
          17:04:44,781 DEBUG [ServiceCreator] Created bean: jboss:service=invoker,type=local
          17:04:44,781 DEBUG [ServiceController] recording that jboss:service=invoker,type=local depends on jboss:service=TransactionManager
          17:04:44,781 DEBUG [ServiceConfigurator] considering with object name jboss:service=TransactionManager
          17:04:44,781 DEBUG [ServiceCreator] About to create bean: jboss:service=invoker,type=pooled with code: org.jboss.invocation.pooled.server.PooledInvoker
          17:04:44,875 DEBUG [ServiceCreator] Created bean: jboss:service=invoker,type=pooled
          17:04:44,875 DEBUG [ServiceConfigurator] NumAcceptThreads set to 1 in jboss:service=invoker,type=pooled
          17:04:44,875 DEBUG [ServiceConfigurator] MaxPoolSize set to 300 in jboss:service=invoker,type=pooled
          17:04:44,875 DEBUG [ServiceConfigurator] ClientMaxPoolSize set to 300 in jboss:service=invoker,type=pooled
          17:04:44,890 DEBUG [ServiceConfigurator] SocketTimeout set to 60000 in jboss:service=invoker,type=pooled
          17:04:44,890 DEBUG [ServiceConfigurator] ServerBindAddress set to 0.0.0.0 in jboss:service=invoker,type=pooled
          17:04:44,890 DEBUG [ServiceConfigurator] ServerBindPort set to 4445 in jboss:service=invoker,type=pooled
          17:04:44,906 DEBUG [ServiceConfigurator] ClientConnectAddress set to 0.0.0.0 in jboss:service=invoker,type=pooled
          17:04:44,906 DEBUG [ServiceConfigurator] ClientConnectPort set to 0 in jboss:service=invoker,type=pooled
          17:04:44,921 DEBUG [ServiceConfigurator] EnableTcpNoDelay set to false in jboss:service=invoker,type=pooled
          17:04:44,921 DEBUG [ServiceController] recording that jboss:service=invoker,type=pooled depends on jboss:service=TransactionManager
          17:04:44,921 DEBUG [ServiceConfigurator] considering TransactionManagerService with object name jboss:service=TransactionManager
          17:04:44,937 DEBUG [ServiceCreator] About to create bean: jboss.jdbc:service=metadata with code: org.jboss.ejb.plugins.cmp.jdbc.metadata.MetaDataLibrary
          17:04:44,968 DEBUG [ServiceCreator] Created bean: jboss.jdbc:service=metadata
          17:04:44,984 DEBUG [ServiceCreator] About to create bean: jboss.deployment:flavor=URL,type=DeploymentScanner with code: org.jboss.deployment.scanner.URLDeploymentScanner
          17:04:45,046 DEBUG [ServiceCreator] Created bean: jboss.deployment:flavor=URL,type=DeploymentScanner
          17:04:45,062 DEBUG [ServiceController] recording that jboss.deployment:flavor=URL,type=DeploymentScanner depends on jboss.system:service=MainDeployer
          17:04:45,062 DEBUG [ServiceConfigurator] considering Deployer with object name jboss.system:service=MainDeployer
          17:04:45,062 DEBUG [ServiceConfigurator] URLComparator set to org.jboss.deployment.DeploymentSorter in jboss.deployment:flavor=URL,type=DeploymentScanner
          17:04:45,093 DEBUG [ServiceConfigurator] FilterInstance set to org.jboss.deployment.scanner.DeploymentFilter@1fa6d18 in jboss.deployment:flavor=URL,type=DeploymentScanner
          17:04:45,093 DEBUG [ServiceConfigurator] ScanPeriod set to 5000 in jboss.deployment:flavor=URL,type=DeploymentScanner
          17:04:45,093 DEBUG [ServiceConfigurator] ScanEnabled set to true in jboss.deployment:flavor=URL,type=DeploymentScanner
          17:04:45,109 DEBUG [ServiceConfigurator] URLs set to deploy/ in jboss.deployment:flavor=URL,type=DeploymentScanner
          17:04:45,109 DEBUG [URLDeploymentScanner] Adding URL from spec: deploy/
          17:04:45,109 DEBUG [URLDeploymentScanner] URL: file:/C:/jbpm-starters-kit-3.1/jbpm-server/server/jbpm/deploy/
          17:04:45,109 DEBUG [URLDeploymentScanner] Added url: file:/C:/jbpm-starters-kit-3.1/jbpm-server/server/jbpm/deploy/
          17:04:45,109 DEBUG [URLDeploymentScanner] URL list: [file:/C:/jbpm-starters-kit-3.1/jbpm-server/server/jbpm/deploy/]
          17:04:45,109 DEBUG [ServiceConfigurator] RecursiveSearch set to true in jboss.deployment:flavor=URL,type=DeploymentScanner
          17:04:45,109 DEBUG [ServiceController] Creating service jboss.management.local:j2eeType=J2EEDomain,name=Manager
          17:04:45,203 DEBUG [LocalJBossServerDomain] Registering with all deployers, mainDeployer=jboss.system:service=MainDeployer
          17:04:45,203 DEBUG [LocalJBossServerDomain] Getting current deployers
          17:04:45,203 DEBUG [LocalJBossServerDomain] Registering as listener of deployer: jboss.system:service=ServiceDeployer
          17:04:45,203 DEBUG [LocalJBossServerDomain] Registering as listener of deployer: jboss.system:service=JARDeployer
          17:04:45,218 DEBUG [LocalJBossServerDomain] handleNotification: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=7,timeStamp=1150243485218,message=null,userData=jboss.management.local:j2eeType=J2EEDomain,name=Manager]
          17:04:45,218 DEBUG [DefaultManagedObjectFactoryMap] Failed to find factory for event: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=7,timeStamp=1150243485218,message=null,userData=jboss.management.local:j2eeType=J2EEDomain,name=Manager]
          17:04:45,218 DEBUG [ServiceController] Creating dependent components for: jboss.management.local:j2eeType=J2EEDomain,name=Manager dependents are: []
          17:04:45,218 DEBUG [ServiceController] Creating service jboss:service=AttributePersistenceService
          17:04:45,218 DEBUG [AttributePersistenceService] Creating jboss:service=AttributePersistenceService
          17:04:45,218 DEBUG [AttributePersistenceService] Created jboss:service=AttributePersistenceService
          17:04:45,218 DEBUG [LocalJBossServerDomain] handleNotification: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=8,timeStamp=1150243485218,message=null,userData=jboss:service=AttributePersistenceService]
          17:04:45,218 DEBUG [DefaultManagedObjectFactoryMap] Failed to find factory for event: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=8,timeStamp=1150243485218,message=null,userData=jboss:service=AttributePersistenceService]
          17:04:45,218 DEBUG [ServiceController] Creating dependent components for: jboss:service=AttributePersistenceService dependents are: []
          17:04:45,218 DEBUG [ServiceController] Creating service jboss.system:service=ThreadPool
          17:04:45,218 DEBUG [LocalJBossServerDomain] handleNotification: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=9,timeStamp=1150243485218,message=null,userData=jboss.system:service=ThreadPool]
          17:04:45,218 DEBUG [DefaultManagedObjectFactoryMap] Failed to find factory for event: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=9,timeStamp=1150243485218,message=null,userData=jboss.system:service=ThreadPool]
          17:04:45,218 DEBUG [ServiceController] Creating dependent components for: jboss.system:service=ThreadPool dependents are: [ObjectName: jboss:service=WebService
          State: CONFIGURED
          I Depend On:
          jboss.system:service=ThreadPool
          , ObjectName: jboss:service=Naming
          State: CONFIGURED
          I Depend On:
          jboss.system:service=ThreadPool
          ]
          17:04:45,218 DEBUG [ServiceController] Creating service jboss:service=WebService
          17:04:45,218 DEBUG [WebService] Creating jboss:service=WebService
          17:04:45,281 INFO [WebService] Using RMI server codebase: http://inesc-c1d62edc8:8083/
          17:04:45,281 DEBUG [WebService] Created jboss:service=WebService
          17:04:45,281 DEBUG [LocalJBossServerDomain] handleNotification: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=10,timeStamp=1150243485281,message=null,userData=jboss:service=WebService]
          17:04:45,281 DEBUG [DefaultManagedObjectFactoryMap] Failed to find factory for event: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=10,timeStamp=1150243485281,message=null,userData=jboss:service=WebService]
          17:04:45,281 DEBUG [ServiceController] Creating dependent components for: jboss:service=WebService dependents are: []
          17:04:45,281 DEBUG [ServiceController] Creating service jboss:service=Naming
          17:04:45,281 DEBUG [NamingService] Creating jboss:service=Naming
          17:04:45,281 DEBUG [NamingService] Created jboss:service=Naming
          17:04:45,281 DEBUG [LocalJBossServerDomain] handleNotification: javax.management.Notification[source=jboss.system:service=ServiceController,type=org.jboss.system.ServiceMBean.create,sequenceNumber=11,timeStamp=1150243485281,message=null,userData=jboss:service=Naming]
          17:04:45,328 DEBUG [JNDIResource] Service name: jboss:service=Naming
          17:04:45,359 DEBUG [JNDIResource] postRegister(), parent: jboss.management.local:j2eeType=J2EEServer,name=Local
          17:04:45,359 DEBUG [JNDIResource] Created JSR-77 JNDIResource: LocalJNDI
          17:04:45,359 DEBUG [ServiceController] Creating dependent components for: jboss:service=Naming dependents are: []
          17:04:45,359 DEBUG [ServiceController] Creating service jboss.system:service=Logging,type=Log4jService
          17:04:45,359 DEBUG [Log4jService] Creating jboss.system:service=Logging,type=Log4jService
          17:04:45,375 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml

          • 17. Re: Process Instantiation
            ssquare

            Thanks Ronald and Pedro,

            Your help is much appreciated.

            I am trying the code you have posted with default configuration using hibernate3.jar. And I am using the default configuration for HSQL database only. If I connect to the HSQL manager I could see the process definition "simple":

            select * from jbpm_processdefinition;

            However I get the following error "table not found" sql exception when I execute the code: This suggests that the jbpm_processdefinition table is not in the query. Am I missing something. If it is a trivial issue, please post any pointers that help me progress.

            (1)
            Exception in thread "main" org.jbpm.JbpmException: couldn't find process definition 'simple'
            at org.jbpm.db.GraphSession.findLatestProcessDefinition(GraphSession.java:155)
            at instanciacao.inst(instanciacao.java:78)
            at instanciacao.main(instanciacao.java:97)
            Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
            at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
            at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
            at org.hibernate.loader.Loader.doList(Loader.java:2153)
            at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
            at org.hibernate.loader.Loader.list(Loader.java:2024)
            at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369)
            at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:300)
            at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:146)
            at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1093)
            at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
            at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:745)
            at org.jbpm.db.GraphSession.findLatestProcessDefinition(GraphSession.java:138)
            ... 2 more
            Caused by: java.sql.SQLException: Table not found in statement [select top ? processdef0_.ID_ as ID1_4_, processdef0_.NAME_ as NAME2_4_, processdef0_.VERSION_ as VERSION3_4_, processdef0_.ISTERMINATIONIMPLICIT_ as ISTERMIN4_4_, processdef0_.STARTSTATE_ as STARTSTATE5_4_ from JBPM_PROCESSDEFINITION processdef0_ where processdef0_.NAME_=? order by processdef0_.VERSION_ desc]
            at org.hsqldb.jdbc.Util.throwError(Unknown Source)
            at org.hsqldb.jdbc.jdbcPreparedStatement.(Unknown Source)


            Your code to make sure I have not missed any thing:

            import java.io.Serializable;
            import java.util.ArrayList;
            import java.util.Collection;
            import java.util.Date;
            import java.util.HashMap;
            import java.util.Iterator;
            import java.util.List;
            import java.util.Map;

            import junit.framework.TestCase;

            import org.jbpm.db.*;
            import org.jbpm.graph.def.*;
            import org.jbpm.graph.exe.*;
            import org.jbpm.*;
            import org.jbpm.db.JbpmSession;
            import org.jbpm.db.JbpmSessionFactory;
            import org.jbpm.graph.def.DelegationException;
            import org.jbpm.graph.exe.Token;


            public class instanciacao{
            static JbpmConfiguration jbpmConfiguration = null;

            static {

            jbpmConfiguration = JbpmConfiguration.parseXmlString(
            "<jbpm-configuration>" +

            " <jbpm-context>" +

            " <service name='persistence' " +
            " factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
            " <service name='message' " +
            " factory='org.jbpm.msg.db.DbMessageServiceFactory' />" +
            " <service name='scheduler' " +
            " factory='org.jbpm.scheduler.db.DbSchedulerServiceFactory' />" +
            " <service name='logging' " +
            " factory='org.jbpm.logging.db.DbLoggingServiceFactory' />" +
            " <service name='authentication' " +
            " factory='org.jbpm.security.authentication.DefaultAuthenticationServiceFactory' />" +
            " <service name='persistence' " +
            " factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
            " </jbpm-context>" +

            " <string name='resource.hibernate.cfg.xml' " +
            " value='hibernate.cfg.xml' />" +
            " <string name='resource.business.calendar' " +
            " value='org/jbpm/calendar/jbpm.business.calendar.properties' />" +
            " <string name='resource.default.modules' " +
            " value='org/jbpm/graph/def/jbpm.default.modules.properties' />" +
            " <string name='resource.converter' " +
            " value='org/jbpm/db/hibernate/jbpm.converter.properties' />" +
            " <string name='resource.action.types' " +
            " value='org/jbpm/graph/action/action.types.xml' />" +
            " <string name='resource.node.types' " +
            " value='org/jbpm/graph/node/node.types.xml' />" +
            " <string name='resource.varmapping' " +
            " value='org/jbpm/context/exe/jbpm.varmapping.xml' />" +
            "</jbpm-configuration>"
            );
            }



            public void inst(int i)
            {

            JbpmContext jbpmContext = this.jbpmConfiguration.getInstance().createJbpmContext(); //how u tell me to do=)

            try {

            GraphSession graphSession = jbpmContext.getGraphSession();

            ProcessDefinition processDefinition =
            graphSession.findLatestProcessDefinition("simple");

            ProcessInstance processInstance =
            new ProcessInstance(processDefinition);

            jbpmContext.save(processInstance);

            System.out.println("Ended");

            } finally {

            jbpmContext.close();
            }
            }


            public static void main(String[] args)
            {
            instanciacao i = new instanciacao();
            i.inst(1);


            }

            }


            thanks
            Regards
            -Shiv

            • 18. Re: Process Instantiation
              ssquare

              It looks like the sql statement has jbpm_processdefinition, but the error message says table not found in the statement. does it refer that the table is not found in the database?

              Regards
              -Shiv

              • 19. Re: Process Instantiation
                goddam

                can anyone give m a help?

                • 20. Re: Process Instantiation
                  goddam

                  maybe it´s something like autentication missing somewhere.. i don´t know.. but it´s strange tha t i have to shutdown and restart the server...

                  1 2 Previous Next