[JBoss jBPM] - Re: Bizarro jBPMException when trying to create a new JbpmCo
by brado
cpob,
Thanks for the very helpful reply and answer. I greatly appreciate it. Your answer brings up another question I have had, which is when should new JbpmContext be created, and when should the current context be obtained instead?
The reason that this question hasn't been completely clear to me is because of a couple reasons:
1) It appears that any saving of data to the database (such as process instance state) doesn't commit until the JbpmContext is closed. This then seemed to suggest that a JbpmContext needed to be created and closed each time data needed to be saved to the database.
2) While I have seen documentation saying that JbpmConfiguration was re-entrant, I have seen no such indication that JbpmContext is. I wasn't sure that if I was working with a JbpmContext in a servlet (or several servlets) whether it would be safe for all of them to be operating simultaneously on the current jbpmContext, rather than all using their own jbpmContext instance for thread safety.
What is the recommended approach to using jbpmContexts? Can the "current" jbpmContext be used across multiple servlets and multiple threads without there being a problem, or does each one need to create its own jbpmContext, and how does this affect the committing of data to the database?
Thanks for your help,
Brad
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970131#3970131
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970131
19 years, 7 months
[Management, JMX/JBoss] - A question about injection vs. lookup of JMX service
by yair.zaslavsky
Hi all,
I have a pojo that tries to invoke a method on a service (i lookup the service and then perform the invocation).
I get the following exception:
14:31:00,125 INFO [STDOUT] Getting job
14:31:00,391 ERROR [AMSAddContentRequest] Error during adding content
java.lang.RuntimeException: Could not find type for operation 'add' on com.imag
ine.ams.logic.content_priority_manager.ContentPriorityManagerMBean
at org.jboss.ejb3.service.ServiceMBeanDelegate.getOperation(ServiceMBean
Delegate.java:374)
at org.jboss.ejb3.service.ServiceMBeanDelegate.invoke(ServiceMBeanDelega
te.java:165)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:1
64)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerA
daptorService.java:266)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
However, this pojo is used from inside a session bean. When I perform dependency injection inside the bean, and pass the injected service as parameter to the pojo, the method gets activated.
I have no ClassCastException or NullPointerException in the lookup, here is the lookup code:
String providerURL = AMSConfigurationProxy.getAMSConfiguration().getHost() + ":1099";
Hashtable props = new Hashtable();
props.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
props.put(InitialContext.PROVIDER_URL,providerURL);
InitialContext ctx = new InitialContext(props);
MBeanServerConnection mbsc = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor");
ObjectName objName = new ObjectName("ams:service=contentPriorityManager");
manager = (ContentPriorityManager)MBeanServerInvocationHandler.newProxyInstance(mbsc,
objName,ContentPriorityManager.class,false);
Can you please help me understand why i cannot activate the method "add" after the lookup?
(I'm using jboss 4.0.4GA)
Thanks
Yair Zaslavsky
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970126#3970126
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970126
19 years, 7 months