[Clustering/JBoss] - JBoss NullPointerException when custom Interceptor is being
by azheludkov
Hi everybody,
I already published this question in previous topic http://www.jboss.com/index.html?module=bb&op=viewtopic&t=128146 but did not received any responses.
Does anybody have any idea why it happens?
According to FAQ http://wiki.jboss.org/wiki/Wiki.jsp?page=ClusteringFAQ in order to get load balancing I created my custom InvokerInterceptor and modified standardjboss.xml to replace JBoss's invoker by my custom one.
Load balancing works almost fine, but sometimes when my client makes ejb calls via threads I'm getting exceptions like this.
java.lang.NullPointerException
at org.jboss.invocation.unified.interfaces.UnifiedInvokerHAProxy.invoke(UnifiedInvokerHAProxy.java:186)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
at org.jboss.proxy.ejb.RetryInterceptor.invoke(RetryInterceptor.java:176)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy74.submitJob(Unknown Source)
at com.framework.system.cluster.ClusterJobSubmitter$RunInThread.run(ClusterJobSubmitter.java:111)
at java.lang.Thread.run(Thread.java:595)
It looks like client fails to get through a chain of interceptors.
Here is a code:
1. Custom Invoker (Jar with compiled invoker was placed in jboss-4.2.2.GA\server\all\lib).
package com.framework.jboss;
import org.jboss.invocation.*;
public class CustomInvokerInterceptor extends InvokerInterceptor {
public boolean hasLocalTarget(Invocation invocation) {
return false;
}
}
2. Modified piece of standardjboss.xml
<invoker-proxy-binding>
clustered-stateless-unified-invoker
<invoker-mbean>jboss:service=invoker,type=unifiedha</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactoryHA</proxy-factory>
<proxy-factory-config>
<client-interceptors>
org.jboss.proxy.ejb.HomeInterceptor
org.jboss.proxy.SecurityInterceptor
org.jboss.proxy.TransactionInterceptor
org.jboss.proxy.ejb.SingleRetryInterceptor
<interceptor call-by-value="false">org.jboss.invocation.InvokerInterceptor
<interceptor call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor
org.jboss.proxy.ejb.StatelessSessionInterceptor
org.jboss.proxy.SecurityInterceptor
org.jboss.proxy.TransactionInterceptor
org.jboss.proxy.ejb.SingleRetryInterceptor
<interceptor call-by-value="false"> com.framework.jboss.CustomInvokerInterceptor
<interceptor call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor
</client-interceptors>
</proxy-factory-config>
</invoker-proxy-binding>
3. Client's code snippet:
public class ClusterJobSubmitter {
private JobSubmitterHome m_home = null; // ejb home
. . . . . .
public void runJob(Ticket jt) throws Exception {
synchronized (this){
if (m_home==null) {
createEjbHome();
}
}
RunInThread runner = new RunInThread(jt);
Thread thread = new Thread(runner);
thread.start();
}
class RunInThread implements Runnable {
Ticket m_jt=null;
public RunInThread(Ticket jt) {
m_jt= jt;
}
public void run() {
JobSubmitter execute = null; \\ ejb remote stab
try {
synchronized (m_home){
execute = (JobSubmitter) m_home.create();
}
execute.submitJob(m_jt);
} catch (Exception ex) {
ex.printstacktrace();
}
}
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124117#4124117
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124117
18 years, 3 months
[JBoss jBPM] - Exception the close jbpm context.
by danieltamiosso
Hello guys,
When I use only one signal, the process works normally. It has all the three nodes. If I use two signals followed the following error occurs:
| 14:07:06,937 ERROR [JDBCTransaction] exception calling user Synchronization
| org.hibernate.QueryParameterException: could not locate named parameter [processInstance]
| at org.hibernate.engine.query.ParameterMetadata.getNamedParameterDescriptor(ParameterMetadata.java:75)
| at org.hibernate.engine.query.ParameterMetadata.getNamedParameterExpectedType(ParameterMetadata.java:81)
| at org.hibernate.impl.AbstractQueryImpl.determineType(AbstractQueryImpl.java:413)
| at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:383)
| at org.jbpm.db.JobSession$DeleteJobsSynchronization.beforeCompletion(JobSession.java:191)
| at org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsBeforeTransactionCompletion(JDBCTransaction.java:228)
| at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:109)
| at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:256)
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:214)
| at org.jbpm.svc.Services.close(Services.java:225)
| at org.jbpm.JbpmContext.close(JbpmContext.java:139)
|
The code:
|
| ...
| try{
| GraphSession graphSession = jbpmContext.getGraphSession();
| ProcessDefinition processDefinition = graphSession.findLatestProcessDefinition("analise-lancamentos-em-aberto");
|
| if (processDefinition == null) {
| processDefinition = ProcessDefinition.parseXmlResource("com/human/crm/jbpm/process/lancamento/processdefinition.xml");
| jbpmContext.deployProcessDefinition(processDefinition);
| }
|
|
| final List<Lancamento> lancamentosEmAberto = getLancamentoDAO().listLancamentosEmAberto();
| for (Lancamento lancamentoEmAberto : lancamentosEmAberto) {
| String key = String.valueOf(lancamentoEmAberto.getId());
| ProcessInstance processInstance = graphSession.getProcessInstance(processDefinition, key);
| if (processInstance == null) {
| processInstance = processDefinition.createProcessInstance();
| processInstance.setKey(key);
| }
|
| Token token = processInstance.getRootToken();
| token.signal();
| token.signal();
|
| jbpmContext.save(processInstance);
|
|
| }
|
| jbpmConfiguration.close();
| } catch (Exception ex) {
| log.error("", ex);
| } finally {
| jbpmContext.close();
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124110#4124110
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124110
18 years, 3 months
[JBoss Portal] - Re: Clear/reset render parameters or re-initialise all portl
by Antoine_h
Hi,
in the JSR-168, the portlets of a portal are not supposed to know what the other portlets are doing...
so, this cannot be done with the jboss portal (or any) that is compliant with jsr 168.
well, you can go further than the jsr.
looking at the api of jboss portal may be a way.
but looks to me quite tricky... as you must be sure not to disturb the whole mechanism, and it may be a problem when you upgrade etc...
you can do it with some communication between portlets of a portal : IPC (Inter Portlet Communication).
with this, you modify things only at the portlet level : you don't modify the inner engine...
IPC is planned for version 2 of the jsr.
some things have been done yet in jboss portal and in some add on libraries.
so, the way I would do that :
- set some IPC (Inter Portlet Communication) between the selector portlet and the portlets that need to reset their state and render the new state.
- in the action phase of the portlet, send a message to the involved portlets, so they re-initialize their state
- in their render phase, the catch the message, and reset the parameter (that is where you are out of the jsr : this kind of thing should be done only in the action phase of the portlet... )
- then they will render, with the new state definition.
- also, think to clear the cache
- be aware that with ajax feature, the whole page rendering is not triggered, that is some portlet rendering is not triggered (with JB Portal 2.6 and pages/portlets with ajax feature...like the dashboard, etc...)
about the IPC :
You need IPC "by message", and not by triggering an event.
You need to dispatch the signal to several portlets, so message can do that, and as far as I remember, event cannot (only one portlet for destination).
I don't know how far the JB Portal is now about IPC.
look at the samples (version 2.6 recommended...).
for what was in the very begining of it with 2.4, it was some IPC by events.
look at the Michelle Osmond feature and library :
http://mus.purplecloud.net/portlets/thesis/ipc.php
I use it... it is a very good help for IPC (both theory and library).
It is better to implement your own storage mechanism of messages, but you can still start with the things she provide... (and later make your own strong feature for production reliability).
look for the posts on this forum about that.
for the cache :
It is necessary to keep some cache feature : would be bad for performance to get rid of it in the portlet descriptor.
so, you have to implement a way to clear the cache of all the portlets.
I have not done it yet (stand by for this feature in my portal), but I had seen how to do it... it can be done... and not so complicated.
you must override the cache management JMX service with yours, and add your feature (clear all portlet cache when asked by the selector).
may be you do that as a contribution to the jboss portal ?
ask Thomas Heute for advice for that (or may be developper forum).
I would appreciate... less to do for me...
idem : look for the posts on this forum on how to manage the cache of portlets.
ajax features : idem, the ajax features may add some complication if you want all the portlet to be re-rendered with the new state...
don't know exactly how to manage that... it will depend on your portal and portlets...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124107#4124107
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124107
18 years, 3 months