[JBoss Messaging] - Re: Clustered temporary queue problem
by nyeste
Hi Tim,
Thanks for the fast reply!
I've tried to wait 10 seconds or more after the creation of the temp queue.
The request/reply case, which is in the example, is working without any wait. So if I create a temp queue on the client side, create a message, set the replyTo property to the created queue and send immediately to the server. The client always got reply through the temp queue. In this case everything is working perfectly, so the server configuration seems good. I used this example only for testing, my goal is a bit different. Sorry, if it was confusing.
I would like to use temp queues without sending a request message to the server. Because on the server side, I have to process messages from other systems and then forward them to one of the temp queues. In this case I can't send a request message from the client. I store the name of the temp queue in a jboss cache and every time a message is received from one of the other systems, I want to create a producer to the temp queue and forward the message to the client. But the createQueue(tempQueueName) call returns in most cases the above mentioned error, however the client is running, there is no error on the client side and the consumer is on the temp queue. I've tried to wait a few seconds, but it didn't help.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226923#4226923
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226923
17 years
[EJB 3.0] - Re: NullPointerException in JavaEEComponentHelper with JBoss
by japase
An example of a bean declaration and injection with some other typical annotations (all our generated beans are more or less same):
| package ifs.application.administrateuserprofiles;
|
| import ifs.fnd.log.*;
| import ifs.fnd.record.*;
| import ifs.fnd.record.serialization.*;
| import ifs.fnd.remote.*;
| import ifs.fnd.remote.j2ee.*;
| import ifs.fnd.sf.j2ee.*;
| import ifs.fnd.sf.j2ee.meta.*;
| import ifs.fnd.base.*;
| import ifs.fnd.sf.*;
| import ifs.application.manageuserprofile.*;
|
| import java.util.Date;
| import javax.ejb.Stateless;
| import javax.ejb.EJB;
| import javax.annotation.PostConstruct;
| import javax.ejb.TransactionAttribute;
| import javax.ejb.TransactionAttributeType;
|
| @Stateless(name="AdministrateUserProfiles")
| public class AdministrateUserProfilesBean extends FndActivityBean implements AdministrateUserProfilesLocal {
|
| private AdministrateUserProfiles implementation;
|
| @EJB(mappedName="ifsapp/UserProfileService/local") private UserProfileServiceLocal userProfileService;
|
| @PostConstruct
| private void initialize() {
| // some code goes here â¦
| }
|
| @Override
| public String[] getOperations() {
| return operations;
| }
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public FndRecordResultWrapper clearClientProfile(ifs.application.manageuserprofile.ClientProfileExt inRecord, FndContext ctx) throws IfsException {
| // method code hereâ¦
| }
|
| // other methods
| }
|
All the generated beans extend indirectly the following class (complete code):
| package ifs.fnd.sf.j2ee;
|
| import ifs.fnd.base.SystemException;
| import ifs.fnd.base.IfsException;
| import ifs.fnd.base.FndConstants;
| import ifs.fnd.base.FndContext;
| import ifs.fnd.base.FndFramework;
| import ifs.fnd.log.*;
| //import ifs.fnd.service.IfsProperties;
|
| import javax.annotation.Resource;
| import javax.ejb.SessionContext;
| import javax.interceptor.AroundInvoke;
| import javax.interceptor.InvocationContext;
| import javax.sql.DataSource;
| import javax.annotation.security.DeclareRoles;
| import javax.annotation.security.RolesAllowed;
|
| /**
| * Base class for all EJB classes.
| */
| @DeclareRoles({FndConstants.USER_ROLE, FndConstants.TRUSTED_MODULE_ROLE})
| @RolesAllowed({FndConstants.USER_ROLE})
| abstract class FndAbstractBean {
|
| //private static final String DATASOURCE_JNDI_PREFIX = IfsProperties.getProperty("fndext.datasource.jndi.prefix");
|
| // this logger may be used during initialization of a bean; it is then recreated by @AroundInvoke method
| protected Logger log;
|
| // logger used for debugging of EJB specific events
| protected Logger clsLog;
|
| protected FndAbstractBean() {
| log = LogMgr.getFrameworkLogger();
| clsLog = LogMgr.getClassLogger(FndAbstractBean.class);
| if(clsLog.debug)
| clsLog.debug("Created bean [&1]", getClass().getName());
| }
|
| @Resource
| protected SessionContext sessionContext;
|
| @Resource(name="fndbas_en-US", mappedName="java:jdbc/fndbas_en-US")
| private DataSource dsEn;
|
| @Resource(name="fndbas-noxa_en-US", mappedName="java:jdbc/fndbas-noxa_en-US")
| private DataSource dsNoXaEn;
|
| public DataSource getDataSource(String name) throws SystemException {
| if("fndbas_en-US".equals(name))
| return dsEn;
| else if("fndbas-noxa_en-US".equals(name))
| return dsNoXaEn;
| throw new SystemException("No dependency to DataSource " + name);
| }
|
| protected SessionContext getSessionContext() {
| return sessionContext;
| }
|
| @AroundInvoke
| private Object aroundInvoke(InvocationContext ctx) throws Exception {
|
| // recreate the bean-protected instance of logger
| log = LogMgr.getFrameworkLogger();
|
| // prepare current FndContext for invocation of a business method
| FndJ2eeContext fndctx;
| if(this instanceof FndActivityBean) {
| Object[] params = ctx.getParameters();
| Object lastParam = params[params.length - 1];
| if(lastParam instanceof FndContext) {
| // typed invoke(): set passed FndContext as current context
| fndctx = (FndJ2eeContext) lastParam;
| setCallerAsApplicationUser(fndctx);
| FndContext.setCurrentContext(fndctx);
| }
| else {
| // untyped invoke(): create new FndContext and set it as current context
| fndctx = (FndJ2eeContext) FndFramework.getFramework().newContext();
| FndContext.setCurrentContext(fndctx);
| }
| }
| else {
| // for nested beans the current FndContext has been already set
| fndctx = FndJ2eeContext.getCurrentJ2eeContext();
| }
|
| // push this bean to the stack with current bens
| fndctx.pushCurrentBean(this);
| if(clsLog.info)
| clsLog.info("Pushed current bean [&1]", getClass().getName());
|
| try {
| // invoke business method
| return ctx.proceed();
| }
| finally {
| // pop this bean from the stack with current bens
| fndctx.popCurrentBean(this);
| if(log.debug)
| log.debug("Poped current bean [&1]", getClass().getName());
|
| // clear the current context after top-level bean method invocation
| if(this instanceof FndActivityBean) {
| FndContext.setCurrentContext(null);
| if(log.debug)
| log.debug("Current context cleared on exit from bean [&1]", getClass().getName());
| }
| }
| }
|
| /**
| * Sets the authenticated user as application user in the specified context.
| */
| protected void setCallerAsApplicationUser(FndJ2eeContext ctx) throws IfsException {
| try {
| String user = sessionContext.getCallerPrincipal().getName();
| ctx.setApplicationUser(user);
| if(log.debug)
| log.debug("Current application user set to authenticated user: &1", user);
| }
| catch (IllegalStateException e) {
| throw new ifs.fnd.base.SecurityException(e,
| "FNDSESSIONBEANSEC:No security context set. Check that security has been configured for the application.");
| }
| }
|
| }
|
There are some other levels of inheritance between a generated EJB and the FndAbstractBean class above, but without anything specific for EJB (I think). But, of course, I can post the code for those classes as well, if necessary.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226913#4226913
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226913
17 years
[Beginners Corner] - Getting J BossAS Bind-Address/Host
by TobiasW
Hi,
i am already a while in development with a JBoss Application Server but now i'am searching for advice in this forum first time. Im not if im in the right corner but now on topic.
I have a Webapplication that is running on serveral JBoss Installations at different places. In last time i was trying around with the TimerServices API and found it quite usefull. I have a timeout method that should call different WebServices and Servlets in this WebApp. Until now we solved this via JNDI-Calls but for some reason this isnt possible anymore.
In future its the goal to call the servlets/webservices via the URLConnection-Class. Cause of this post is i need the servers host part so i can open a Connection from itself (timeout-Method) to itself(Servlet/WebService (mainly Servlet).
I hope you can understand the problem and can help me finding a solution to get the server host address.
Greetings,
Tobias
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226905#4226905
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226905
17 years