Context lost for Session Beans
Hi Guys,
Using WLS4.5.1 sp13 on NT4 sp6.
We are having a problem with the Context of a Session Bean switching from the correct user to the last person who logged in. The users credentials and hence the context filter through from the JSP pages correctly and the Session Bean is created correctly.
Then when someone else logs in, both users assume the identity of the new user. The context of the EJB's being used changes to the new user for all other users.
When we do a getInitialContext() we assume the "weblogic.security.acl.Security.getCurrentUser()" properties to create the context. Either this is getting switched somehow or we are getting a circular reference to a Session Bean which is confusing weblogic.
One thing we do do is after various actions, we change the context to a new user and create a new EJB to validate against this users properties. When finished we throw this EJB away - and resume "presumably" in the original context !?!?!?
Any ideas ??!!?!?
Thankx in advance,
Andrew Harris//
I'm not sure if it is possible in 6.0, but 6.1 definitely supports this -
you can specify deployment order using console.
"Sébastien Charrier" <[email protected]> wrote:
Hi,
I was wondering if it's possible to define a deployement order for session
beans and if yes how to configure it (where in the console or in the
config.xml) ? Each session bean is in a single jar file and all the jars are
packaged in an ear file. I'm using weblogic 6.0 sp2.
thanks in advance.--
Dimitri
Similar Messages
-
hi ,
i am just using EJb in my Application
just created an SessionBean and with Local interface in it i am getting this wierd exception with weblogic NetBeans and eclipse also
weblogic.ejb.container.compliance.ComplianceException: No business interface, component interface or web service endpoint interface found for Session Bean SessionEJB
weblogic.ejb.container.compliance.ComplianceException: No business interface, component interface or web service endpoint interface found for Session Bean SessionEJB
at weblogic.ejb.container.compliance.SessionBeanClassChecker.checkInterfacesExist(SessionBeanClassChecker.java:177)
at weblogic.ejb.container.compliance.Ejb30SessionBeanClassChecker.checkInterfacesExist(Ejb30SessionBeanClassChecker.java:27)
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 weblogic.ejb.container.compliance.EJBComplianceChecker.check(EJBComplianceChecker.java:331)
at weblogic.ejb.container.compliance.EJBComplianceChecker.checkDeploymentInfo(EJBComplianceChecker.java:280)
at weblogic.ejb.container.ejbc.EJBCompiler.checkCompliance(EJBCompiler.java:789)
at weblogic.ejb.container.ejbc.EJBCompiler.doCompile(EJBCompiler.java:222)
at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:461)
at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:428)
at weblogic.ejb.container.deployer.EJBDeployer.runEJBC(EJBDeployer.java:437)
at weblogic.ejb.container.deployer.EJBDeployer.compileJar(EJBDeployer.java:795)
at weblogic.ejb.container.deployer.EJBDeployer.compileIfNecessary(EJBDeployer.java:683)
at weblogic.ejb.container.deployer.EJBDeployer.prepare(EJBDeployer.java:1254)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:442)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:613)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:184)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
at weblogic.ejb.container.compliance.EJBComplianceChecker.check(EJBComplianceChecker.java:321)
at weblogic.ejb.container.compliance.EJBComplianceChecker.checkDeploymentInfo(EJBComplianceChecker.java:280)
at weblogic.ejb.container.ejbc.EJBCompiler.checkCompliance(EJBCompiler.java:789)
at weblogic.ejb.container.ejbc.EJBCompiler.doCompile(EJBCompiler.java:222)
at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:461)
Truncated. see log file for complete stacktrace
>Hi Rajendar,
I think the problem with having empty interfaces, or interfaces without methods for EJBs, is that they don't really make "sense". After deploying your EJB, a client application will use JNDI or dependency injection to access your EJB. So in your case it will look something like this
@EJB
mytestSSBLocal myejb; //(In this case we are using the local interface)
In the second step, you will want to do something will your EJB, but since mytestSSBLocal doesn't define any methods, there is nothing you can do with your ejb.
The Exception is telling you that weblogic couldn't find a complaint interface for your EJB.
best regards, Nicolas -
Execute client for Session Bean without appClient
Hi,
I want to execute a standalone client for a Session Bean in a Application Server 8 platform but I don�t want to use the "appClient" script that is used in the J2EE 1.4 Tutorial.
For example, for the Converter example I want to execute ConverterClient directly.
For this I suppose that I have to include the following lines of code:
java.util.Hashtable env = new java.util.Hashtable();
env.put( Context.INITIAL_CONTEXT_FACTORY, "XXXX" );
env.put(Context.PROVIDER_URL, "YYYY");
Context initial = new InitialContext(env);
Context myEnv = (Context) initial.lookup("java:comp/env");
BUT WHAT XXXX AND YYYY SHOULD BE IN SUN APPLICATION SERVER 8?
ThanksWhen you are inside a container these are setup as properties automaticly. When you are outside the container you can setup these properties just the container does, but it is not done for you. When you use that HashTable you are giving it the properties instead of it getting them from system properties. Also, it looks like you need to change the lookup. Once you get the InitailContext you will see that you can't lookup java:comp from outside. You will have to use the fully qualified name. Something like "nodes/node1/servers/server1/ejb/myEjb". Just keep that in mind.
-
Validation error on retry count for session bean
Hi,
In our weblogic-ejb-jar.xml we have configured a retry count for a specific method on a local session bean. When I click on 'Browse' to select a specific method, it only shows '*' as a possible value. When we type the method name by hand, it shows a red cross next to the input field with the error 'Cannot find method "exampleMethod()" in the ExampleBean's Local interfaces'.
We use EJB 3.0 and OEPE 12.1.1.0.1 with Eclipse 3.7.2
The weblogic-ejb-jar.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-ejb-jar xmlns="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-ejb-jar http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.2/weblogic-ejb-jar.xsd">
<retry-methods-on-rollback>
<retry-count>3</retry-count>
<method>
<ejb-name>ExampleBean</ejb-name>
<method-intf>Local</method-intf>
<method-name>exampleMethod</method-name>
</method>
</retry-methods-on-rollback>
</weblogic-ejb-jar>The bean looks like this:
@Stateless(mappedName = MappedName.DONNA)
@TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW)
public class ExampleBean implements Example {
}And the interface:
@Local
public interface Example {
}Does anyone else have this problem?
Thanks.
PieterHi Pieter,
This is a known issue and I will keep you posted on the development.
Thanks for your feedback!
-Ram -
Help !! Client for session bean
I need your help for this roblem :
I have deployed a session bean in helloClient.jar and wrote TestHello class to test the session bean.
My problem ist to do this test ;i have tried with this command
java -cp HelloClient.jar TestHello ,but it works not .
Thanks.Without source code or any description of exceptions, your problem definition is useless.
-
Naming Exception Error for Session Bean (Stateless) in JDeveloper
I have written a session bean stateless in JDeveloper Environment. When i running that bean i getting the following error message.
javax.naming.NamingException: Lookup error: java.net.ConnectException: Connection refused:
how can we resolve this error?http://forum.java.sun.com/thread.jsp?forum=54&thread=484437&tstart=0&trange=15
-Regards
Manikantan -
EJB3 - More than one remote interface for Session Bean?
Hi,
Is it possible in EJB3 to have more than one remote interface for a SessionBean?
I have seen it posetd on here that it is possible but never been able to find any other information.
Using JBoss as my App Server, I have deployed an App, where a SessionBean is defined as implementing 2 interfaces, both of which are annotated using @remote.
However when I examine the JBoss JMX Console, Global JNDI Namespace only one remote interface is listed, and indeed it is the first one defined in the SessionBean.
Considering I use a String similar to (MyApp/MyBean/remote) to do the JNDI lookup, this would indicate that it is not possible to have more than one remote interface.
1. Is this a JBoss specific limitation?
2. Is there another way of performing the JNDI lookup?
Thanks,
Alan.Hi,
Thanks for prompt response! I tried the suggestion in my application, and the output from JBoss JMX Console was
+- XXXBean (class: org.jnp.interfaces.NamingContext)
| | +- remote (proxy: $Proxy291 implements No ClassLoaders found for: xxx.xxx.xxx.xxx.xxx.Remote1 (no security manager: RMI class loader disabled))Again only displaying the remote interface that is first in the @remote ({ Remote1.class , Remote2.class}) list. This would lead me to believe that JBoss does not support this.
Can anyone confirm this?
Alan. -
Do JNDI look up for entity beans from a session bean in different jars
I have a problem doing entity beans JNDI look up from a session bean which is deployed
as a separate package (session.jar) from the entity beans (entity.jar)
I believe if both session bean and entity beans are deployed into one jar and
I specify ejb-local-reference-description for session bean, it should work. However,
due to some reason, they have to be in separated packages but still in the same
container. Then question how to do JNDI lookup given entity beans only have local
interfaces?
FYI.
1 both session.jar and entity.jar are self-contained. i.e., no deployment error.
each JNDI name can be viewed from JNDI tree
2. weblogic-ejb-jar.xml for session.jar
<weblogic-ejb-jar>
<description><![CDATA[Generated by XDoclet]]></description>
<weblogic-enterprise-bean>
<ejb-name>PetstoreLogic</ejb-name>
<stateless-session-descriptor>
</stateless-session-descriptor>
<reference-descriptor>
</reference-descriptor>
<jndi-name>PetstoreLogic</jndi-name>
<local-jndi-name>PetstoreLogicLocal</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
3. weblogic-ejb-jar.xml (code snip) for entity.jar
<weblogic-enterprise-bean>
<ejb-name>Account</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<reference-descriptor>
</reference-descriptor>
<local-jndi-name>net.sourceforge.cpetstore/AccountLocalHome</local-jndi-name>
</weblogic-enterprise-bean>
4. if I do
accountLocalHome = (AccountLocalHome) ic.lookup("net/sourceforge/cpetstore/AccountLocalHome");
get error like:
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
While trying to look up /app/ejb/net.sourceforge.cpetstore-entity.jar#Account/local-home
in /app/ejb/cpetstore-ejb.jar#PetstoreLogic.; remaining name '/app/ejb/net/sourceforge/cpetstore-entity/jar#Account/local-home'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)In weblogic-ejb-jar.xml use jndi-name instead of local-jndi-name in reference-descriptor
element.
"Qiming He" <[email protected]> wrote:
>
I have a problem doing entity beans JNDI look up from a session bean
which is deployed
as a separate package (session.jar) from the entity beans (entity.jar)
I believe if both session bean and entity beans are deployed into one
jar and
I specify ejb-local-reference-description for session bean, it should
work. However,
due to some reason, they have to be in separated packages but still in
the same
container. Then question how to do JNDI lookup given entity beans only
have local
interfaces?
FYI.
1 both session.jar and entity.jar are self-contained. i.e., no deployment
error.
each JNDI name can be viewed from JNDI tree
2. weblogic-ejb-jar.xml for session.jar
<weblogic-ejb-jar>
<description><![CDATA[Generated by XDoclet]]></description>
<weblogic-enterprise-bean>
<ejb-name>PetstoreLogic</ejb-name>
<stateless-session-descriptor>
</stateless-session-descriptor>
<reference-descriptor>
</reference-descriptor>
<jndi-name>PetstoreLogic</jndi-name>
<local-jndi-name>PetstoreLogicLocal</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
3. weblogic-ejb-jar.xml (code snip) for entity.jar
<weblogic-enterprise-bean>
<ejb-name>Account</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<reference-descriptor>
</reference-descriptor>
<local-jndi-name>net.sourceforge.cpetstore/AccountLocalHome</local-jndi-name>
</weblogic-enterprise-bean>
4. if I do
accountLocalHome = (AccountLocalHome) ic.lookup("net/sourceforge/cpetstore/AccountLocalHome");
get error like:
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
While trying to look up /app/ejb/net.sourceforge.cpetstore-entity.jar#Account/local-home
in /app/ejb/cpetstore-ejb.jar#PetstoreLogic.; remaining name '/app/ejb/net/sourceforge/cpetstore-entity/jar#Account/local-home'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338) -
Calling session bean's business method through web dynpro component
Hi All,
Can anybody tell me how to call a session bean's methods through a web dynpro WITHOUT java-model or web service model ??
I have following scenario:-
1. Stateless Session bean having two business methods
2. Web Dynpro component
3.Now i want to call business methods without using any model. I have got following piece of code but I dont know how to go about it.
4.Where do i have to set JNDI name for session bean? which interface will be looked for?
5. Do I have to declare public part for EJB DC? If yes, how?
//This is inside web dynpro component
InitialContext context = new InitialContext();
o = context.lookup(JNDIName);
TestSessionbeanHome homeRef = (TestSessionbeanHome) PortableRemoteObject.narrow( o,
TestSessionbeanHome.class);
TestSessionbean beanRef = homeRef.create();
<returnValue> = beanRef.<ejb method name>
Please help to get a step-by-step approach to this case.
Thanks and regards,
Amey MogareHi,
If I comment out the part that is using session bean's business method, DC is building fine.
And if I uncomment, then compiler is unabl eto resolve business method(s).
And i would like to mention that my EJB + J2EE App DC is building properly, but it havent yet deployed properly as I am waiting for data-source-alias name prefix to be configured by ERP team. So will this be a reason why Web Dynpro DC is not able to resolve business methods ??
Because Web Dynpro DC is able to resolved all interfaces of Session bean and entity bean. But when it comes to business method, its not able to resolve.
Any more ideas why it is not happening?
Pls help.
Now i went through some forum posts regarding this and found that we also need to add EJB DC to Java Build Path for WebDynproDC>Properties>Java Build Path.
I did this and now it is able to resolve business methods and DTOs as well. So to summarize I did following:-
1. Added EJB DC (complete DC) as a Used DC to Web Dynpro DC with Buid-n-Deploy-n-Run time dependency
2. Added Sharing reference of J2EE application DC to Web Dynpro DC -->Properties
This reference I constructed as follows:-
<vendorname>/<name of j2ee application as appearing under display name tag in application.xml (replacing '/' with '~')>
So my Sharing Reference becomes:- <vendorname>/reqpstapscreqpstapja_reqid
3. Added EJB DC to Java Build Path in Web Dynpro DC's properties
4. Then I added following piece of code to get object of SessionBean class
InitialContext context = new InitialContext();
Object o = context.lookup("java:comp/env/ejb/SessionRequestIDBean");
SessionRequestIDHome homeRef = (SessionRequestIDHome) PortableRemoteObject.narrow(o, SessionRequestIDHome.class);
SessionRequestID beanRef = homeRef.create();
beanRef.<business method>
But After doing this I am facing another problem :-
The build fails saying it is not able find the package for DTOs. But when I see the Component Controller's code it is not showing any red or yellow marks.
Can anybody pls help me out here?
Thanks and regards,
Amey Mogare -
How to track the stateful Session Bean?
Hi all,
Am in a serious trouble. I have a message driven bean which will get initiated when some message gets dumped into the queue. I have got session bean which i use to process message which my message driven bean takes from the queue.
My problem is, lets say there are 3 msgs in the queue. lets say the messages be "aaaa", "aaaa" and "bbbb".
In this case, when i read the first message, i will create an instance of the session bean to process the message "aaaa". When i receive the second message still i create an instance to process the message "aaaa". When i get the 3rd message, i create an instance to process the message "bbbb".
My problem in this is, i want to create only one instance of session bean for the message "aaaa".
So once i create the instance for session bean for particular message, i need to store the object or something of the instance which i created along with the message. Please help me with what i can store with which i can reffer to the session bean again.
Please see the sample code too.
Thanks in advance,
Ashly
if(msg.equals("aaaa"))
First n;
Object obj = ctx.lookup("ejb/First");
FirstHome home = (FirstHome) PortableRemoteObject.narrow(obj, FirstHome.class);
n = home.create(msg);
}Hi,
thanks for information. But i have one question. In a stateful session bean why do we have to store the Remote Interface on the client side.
I expected in the second jsp page when i do a lookup or create, the container/server should find out whether there is a session bean already created for this session if yes, then return that particular instance of the session bean else create a new one.
If this is not a possible case then a stateful session bean is nuthing but an instance of an object in the EJB container which does not get destroyed unless there is a time out or the remove method is called. It has nuthing to do with session because throughout the session I have to store the remote interface in the session context of the client( the client here means the jsp).
thanks in advance
Anurag -
Statless Session Bean FIFO Behaviour
Hi,
I'm using WL81, and would like to ask if its possible to enforce FIFO behaviour for session bean pools? - that is, given the situation of only 1 initial bean and max bean count is 1 for the bean pool, the request for the beans would be served according to there arrival time's chronological order.
regards,
GBHi,
here is the sample example for stateless bean which for j2ee server..
home.java
import java.rmi.*;
import javax.ejb.*;
public interface home extends EJBHome
public remote create() throws RemoteException,CreateException;
remote.java
import javax.ejb.*;
import java.rmi.*;
public interface remote extends EJBObject
public String display() throws RemoteException;
Server.java
import java.rmi.*;
import javax.ejb.*;
public class server implements SessionBean
public server(){}
public void ejbCreate(){}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void setSessionContext(SessionContext c)
public String display() throws RemoteException
return "welcome";
client.java
import java.rmi.*;
import java.io.*;
import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
public class client
public static void main(String a[])
try
Context initial =new InitialContext();
Object obj =initial.lookup("sampleserver");
home h=(home)PortableRemoteObject.narrow(obj,home.class);
remote r= h.create();
System.out.println(r.display());
}catch(Exception e)
throw new Error(e.toString());
};//compile and create a jar, for ex "firstClient.jar"
//run in console mode
// java -Dorg.omg.CORBA.ORBInitialHost=localhost -classpath "%classpath%;firstClient.jar" client -
Entity Beans and Session beans to represet Business lOgic
How cam we implement Entity Beans and Session beans to represent Business Logic.
Can anyone explain how can we do this.
Regards...I have session beans calling method in entity beans and any client
doesn't have access to entity beans, only via session beans.
If i define security policy and method permissions for session beans
only, do entity beans use that permissions when calling their methods
from sessions beans OR should i define the security policy for entity
beans separately?If you want to set the permission on individual
methods of entity bean ( with different roles)
you have to do it separately.
If you want to delegate the Authenticated user along with
the method call to the Entity Bean you can use
run-as-identity-principal.
For more detail please check out the EJB2.0 Spec.
-utpal -
Hi this is Prashanth
Is there any way in which we can modify the Number of Beans that are in the pooled state. so that we can visualise the ejbActivate and ejbPassivate method calls when made by the Container.
thanks in advanceIn orion-ejb-jar.xml you can set the pool size for session beans with
<session-deployment ... min-instances="2" max-instances="20">
</session-deployment>
For complete documentation on configuring pool size follow this link:
http://download-uk.oracle.com/docs/cd/B25221_03/web.1013/b14428/usadmin.htm#i1017802 -
Documentation on Session Bean Pooling in Oracle9iAS
Is there any documentation stating how the Oracle9iAS (OC4J) handles session bean pooling?
In orion-ejb-jar.xml you can set the pool size for session beans with
<session-deployment ... min-instances="2" max-instances="20">
</session-deployment>
For complete documentation on configuring pool size follow this link:
http://download-uk.oracle.com/docs/cd/B25221_03/web.1013/b14428/usadmin.htm#i1017802 -
Context.lookup in a Servlet always returns the same Stateful Session Bean
Hi,
I am working on an application in which a Servlet should obtain one StateFul Session Bean per client. I read in EJB 3.0 in Action that to do so I should use a jndi lookup and save the result of the lookup in an HttpSession. This works fine for me when I have a single client.
My issue is that when I have several clients, context.lookup returns the same SFSB for each client. This means that I end up having a single SFSB for the whole application. I've been browsing the web for a while now trying to find a solution but haven't had any luck yet.
The code I use to obtain and save the SFSB is the following:
HttpSession session = request.getSession(true);
DFMServiceRemote service = (DFMServiceRemote) session.getAttribute("DFMService");
if (null == service)
service = (DFMServiceRemote) new InitialContext().lookup("DFMService");
session.setAttribute("DFMService", service);
}Using different browser, I end up with different HttpSession but a single SFSB. The only workaround I found is to create the context with environment variables or properties. It then returns different SFSBs for different HttpSession. The workaround code is as below:
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
env.put(Context.PROVIDER_URL, "ormi://localhost:23791/DriverFatigue");
service = (DFMServiceRemote) new InitialContext(env).lookup("DFMService");My question is the following. How can I get a different instance of an SFSB every time I execute context.lookup without specifying properties.
Thanks in advance for any help,
Matthieu SiggenI just did something similar in another project using JBoss instead of oc4j and didn't have any problem. I expect I missed a configuration file in oc4j or there is a conflict somewhere.
Maybe you are looking for
-
Stuck at the verification part of creative cloud
I didn't verificative my emailadres within the 72 hours, since the emailadres adobe has is wrong. I noticed it says hotmail whereas i have outlook. I don't receive any codes, thus I can't even log in into creative cloud. what should i do now?
-
------Load Dataset into Temp table--------------- SELECT z.SYSTEMNAME --,Case when ZXC.[Subsystem Name] <> 'NULL' Then zxc.[SubSystem Name] --else NULL --End AS SubSystemName , CASE WHEN z.PROV_TAX_ID IN (SELECT DISTINCT zxc.TIN FROM dbo.SQS_Provider
-
Is there a way to recover an overwritten image folder in a site root?
I mistakenly did a 'get' of the 'images' folder in my remote site and it overwrote my local site file, which contained many new photoshopped jpgs that I had spent hours creating and had recently placed there for the site work. I am working in CS5 on
-
I have a HDMI to thunder port cable and I have mu Macbook pro hooked up to it and trying to mirror to my tv but I cannot choose a different display then my built in, and the F7 is not working to switch it like it says to do in instructions, What do
-
Frozen app..or won't open..have deleted, reinstalled, etc