[JBoss Messaging] - Re: False negatives and jms
by timfox
If the call to send a persistent message to a persistent destination returns successfully with no exception, then you can be sure that the message was persisted.
However if the call doesn't return successfully e.g. if an exception is thrown, then you *can't be sure the message wasn't persisted*. Since the failure might have occurred after persisting the message but before writing the response to the caller.
So, yes you are correct. This is a common attribute of any RPC type call: You can't tell by the call not returning that the call didn't actually succeed. Whether it's a web services call, an HTTP get request, an ejb invocation the same applies.
The trick is to code your application so your operations are *idempotent* - i.e. they can be repeated without getting the system into an inconsistent state.
With a message system you can do this on the application level, by checking for duplicate messages, and discarding them if they arrive.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095417#4095417
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095417
18Â years, 9Â months
[JBoss Messaging] - Re: LoadBalancingFactory - JBoss Messaging 1.4
by timfox
If the call to send a persistent message to a persistent destination returns successfully with no exception, then you can be sure that the message was persisted.
However if the call doesn't return successfully e.g. if an exception is thrown, then you *can't be sure the message wasn't persisted*. Since the failure might have occurred after persisting the message but before writing the response to the caller.
So, yes you are correct. This is a common attribute of any RPC type call: You can't tell by the call not returning that the call didn't actually succeed. Whether it's a web services call, an HTTP get request, an ejb invocation the same applies.
The trick is to code your application so your operations are *idempotent* - i.e. they can be repeated without getting the system into an inconsistent state.
With a message system you can do this on the application level, by checking for duplicate messages, and discarding them if they arrive.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095416#4095416
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095416
18Â years, 9Â months
[JNDI/Naming/Network] - javax.naming.NameNotFoundException whe doing jndi lookup
by patwary_shiva
I have written a small program to do jndi lookup .I call this program form struts action class.This class is in jar file under the server/lib directory of jboss.The strut action class is in war under the deploy directory.It throws javax.naming.NameNotFoundException: com.abc.DistributedScheduler not bound exception.Below is the code Not much logic in this program.It works under weblogic but throws error in jboss..
// Standard Java classes
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
// Third-party classes
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* JNDISchedulerResolver
*
*
*/
public class JndiSchedulerResolver
{
// Public data ////////////////////////////////////////////////////////
// Public methods /////////////////////////////////////////////////////
public JndiSchedulerResolver()
{
Hashtable props = new Hashtable();
// Turn on binding replication for clustering
try
{
WebServerFactory.getSingleton().addJNDIProperties(props);
}
catch (Exception e)
{
}
try
{
this.context = new InitialContext(props);
}
catch (NamingException e)
{
logger.error("An error occurred", e);
}
}
public void setLocalScheduler(Scheduler scheduler)
throws SchedulerException
{
bindScheduler(LOCAL_SCHEDULER_JNDI_NAME, scheduler);
}
public Scheduler getLocalScheduler()
throws SchedulerException
{
return lookupScheduler(LOCAL_SCHEDULER_JNDI_NAME);
}
public void setDistributedScheduler(Scheduler scheduler)
throws SchedulerException
{
bindScheduler(DISTRIBUTED_SCHEDULER_JNDI_NAME, scheduler);
}
public Scheduler getDistributedScheduler()
throws SchedulerException
{
return lookupScheduler(DISTRIBUTED_SCHEDULER_JNDI_NAME);
}
// Protected methods //////////////////////////////////////////////////
// Private methods ////////////////////////////////////////////////////
private void bindScheduler(String jndiName, Scheduler scheduler)
throws SchedulerException
{
try
{
this.context.bind(jndiName, scheduler);
}
catch (NamingException e)
{
throw new SchedulerException(e);
}
}
private Scheduler lookupScheduler(String jndiName)
throws SchedulerException
{
try
{
return (Scheduler) this.context.lookup(jndiName);
}
catch (NamingException e)
{
throw new SchedulerException(e);
}
}
// Private data ///////////////////////////////////////////////////////
private Context context;
private static final String LOCAL_SCHEDULER_JNDI_NAME =
"com.abc.LocalScheduler";
private static final String DISTRIBUTED_SCHEDULER_JNDI_NAME =
"com.abc.DistributedScheduler";
private static final Log logger =
LogFactory.getLog(JndiSchedulerResolver.class);
}
Error:
com.abc.common.scheduler.SchedulerException: javax.naming.NameNotFoundException: com.abc.DistributedScheduler not bound
at com.abc.common.scheduler.JndiSchedulerResolver.lookupScheduler(JndiSchedulerResolver.java:108)
at com.abc.common.scheduler.JndiSchedulerResolver.getDistributedScheduler(JndiSchedulerResolver.java:79)
at com.abc.drm.webapp.test.ListScheduledTasksAction.doExecute(ListScheduledTasksAction.java:56)
at com.abc.common.webapp.struts.BasicAction.execute(BasicAction.java:180)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.abc.drm.servlet.CheckUriAccessFilter.doFilter(CheckUriAccessFilter.java:120)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.abc.drm.servlet.InitializationFilter.doFilter(InitializationFilter.java:135)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.naming.NameNotFoundException: com.abc.DistributedScheduler not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.abc.common.scheduler.JndiSchedulerResolver.lookupScheduler(JndiSchedulerResolver.java:104)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095415#4095415
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095415
18Â years, 9Â months
[JBossWS] - Multithreading in Jboss 4.0.1
by pranav.akiri
Hi,
We are trying to connect to a third party webservice to propagate the changes to the thirdparty system(in the suggeted JNDI look up pattern described in the jboss-webservice tutorial and it is working fine)
Since the number of propagation updates are large,now we wanted to have parallel updates to the third party system,which is like having a master thread creaing few child threads,each will take,say 1000 records and updates in the 3rd party system using the webservices in parallel.
Now,we are having an issue while using multiple threads.If I understand correctly,I guess the issue is because,we are sharing websevice client name registered in the JNDI,and it is giving exceptions.
Has anyone have any idea of how can invoke multi threading with webservices.In the other way,we are trying to have multiple threads connecting the same webservice concurrently in the same appserver.
we are using JBoss 4.0.1 and jdk 1.4
Any suggestions would be appreciated.Following is the code snippet for conencting to webservices:
==========================================
private boolean connect() throws Exception
{
if(!isConnected)
{
Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client:org.jboss.naming");
env.setProperty(Context.PROVIDER_URL, JNDI_URL);
env.setProperty("j2ee.clientName", "nn-ws4ee-client");
try
{
InitialContext iniCtx = new InitialContext(env);
Service service = (Service)iniCtx.lookup(NN_CLIENT_JNDI_NAME);
nrdInterface = (NRD)service.getPort(NRD.class);
((Stub)nrdInterface)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, url);
isConnected = true;
}
catch(Exception exc)
{
logger.fatal("NN Client Wrapper initialization exception. " +
"The JNDI may not be correctly configured as follows: JNDI Location: " + JNDI_URL +
" NN Client JNDI Name: " + NN_CLIENT_JNDI_NAME);
logger.fatal("NN Client Wrapper initialization exception:", exc);
isConnected = false;
throw exc;
}
}
return isConnected;
}
============================
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095404#4095404
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095404
18Â years, 9Â months