To trace the execution of the process, the DefaultStart and DefaultEnd actions uses an EJB to write some information into a database.
The code is the following (Manager and ManagerHome are remote/local interfaces of the EJB):
public class DefaultStart implements ActionHandler {
Override
public void execute(ExecutionContext executionContext) throws Exception {
Manager manager = Utils.getManager(executionContext);
manager.startJob(...); // some trace parameters like node name, etc.
}
}
public class Utils {
private static final Log log = LogFactory.getLog(Utils.class);
private static String MANAGER_HOME_JNDI_NAME = "..."; // jndi name of ejb home interface
public static Manager getManager(ExecutionContext executionContext) throws Exception {
InitialContext context = null;
try {
context = new InitialContext(getJndiProperties());
Object homeObject = context.lookup(MANAGER_HOME_JNDI_NAME);
ManagerHome home = (ManagerHome) PortableRemoteObject.narrow(homeObject, ManagerHome.class);
Manager manager = home.create();
return manager;
} catch (Exception e) {
log.error("cannot create manager", e);
throw new RuntimeException(e);
} finally {
if (context != null) {
try {
context.close();
} catch (Exception e) {
// ok
}
}
}
}
}
(the same for DefaultEnd but with the invocation of manager.endJob(...). )
The problem arise at line
Manager manager = home.create()
in the DefaultEnd action.
Here it is the complet stack trace:
2009-12-14 10:51:43,192 ERROR [org.process.Utils] cannot create manager
java.rmi.AccessException: SecurityException; nested exception is:
javax.security.auth.login.LoginException: no login for this user: null
at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:388)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:136)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:637)
at org.jboss.ejb.Container.invoke(Container.java:981)
at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocalMarshalled(InvokerInterceptor.java:295)
at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(MarshallingInvokerInterceptor.java:61)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy86.create(Unknown Source)
at org.process.Utils.getManager(Utils.java:36) --> LINE "Manager manager = home.create();"
at org.process.DefaultEnd.execute(DefaultEnd.java:21) --> LINE "Manager manager = Utils.getManager(executionContext);"
at org.jbpm.graph.def.Action.execute(Action.java:122)
at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:259)
at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:215)
at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:185)
at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:169)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
at org.jbpm.taskmgmt.def.Task_$$_javassist_29.fireEvent(Task_$$_javassist_29.java)
at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:452)
at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:393)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
at org.jbpm.taskmgmt.exe.TaskInstance_$$_javassist_26.end(TaskInstance_$$_javassist_26.java)
at org.jbpm.graph.node.TaskNode.removeTaskInstanceSynchronization(TaskNode.java:273)
at org.jbpm.graph.node.TaskNode.leave(TaskNode.java:208)
at org.jbpm.graph.def.Node.leave(Node.java:368)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
at org.jbpm.graph.def.Node_$$_javassist_80.leave(Node_$$_javassist_80.java)
at org.process.AutomaticCheckAction.execute(AutomaticCheckAction.java:37)
at org.jbpm.graph.def.Action.execute(Action.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
at org.jbpm.graph.def.Action_$$_javassist_34.execute(Action_$$_javassist_34.java)
at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
at org.jbpm.taskmgmt.def.Task_$$_javassist_29.executeAction(Task_$$_javassist_29.java)
at org.jbpm.job.Timer.execute(Timer.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
at org.jbpm.job.Job_$$_javassist_84.execute(Job_$$_javassist_84.java)
at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:173)
at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:64)
Caused by: javax.security.auth.login.LoginException: no login for this user: null
...
The jbpm-cfg.xml file is:
<jbpm-configuration>
<jbpm-context>
<service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
<service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
<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" />
</jbpm-context>
<!-- configuration property used by persistence service impl org.jbpm.persistence.db.DbPersistenceServiceFactory -->
<string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" />
<!-- configuration resource files pointing to default configuration files in jbpm-jpdl.jar -->
<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.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
<string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />
<string name="resource.mail.templates" value="jbpm.mail.templates.xml" />
<int name="jbpm.byte.block.size" value="1024" singleton="true" />
<string name="jbpm.mail.smtp.host" value="localhost" />
<bean name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" />
<bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
<bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
<bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
<field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
<field name="name"><string value="JbpmJobExecutor" /></field>
<field name="nbrOfThreads"><int value="1" /></field>
<field name="idleInterval"><int value="5000" /></field>
<field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->
<field name="historyMaxSize"><int value="20" /></field>
<field name="maxLockTime"><int value="600000" /></field> <!-- 10 minutes -->
<field name="lockMonitorInterval"><int value="60000" /></field> <!-- 1 minute -->
<field name="lockBufferTime"><int value="5000" /></field> <!-- 5 seconds -->
</bean>
</jbpm-configuration>