• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Stateless EJB and Cluster Problem in weblogic 9.2  RSS feed

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! Everybody

I am facing a problem while deploying a web app in a clustered environment in WLS 9.2

Earlier we were working with the same application in non clustered enviroment on WLS 8.1
and it worked fine.


I have a doubt related to the internal working mechanism of cluster in serving the request.

I have a stateless session bean which needs to be deployed in clustered enviroment (on two managed
servers).this stateless bean creates a user thread inside the bean code in a user defined method
and this thread interacts with a remote server and receives the necessary response from the server.
After the respose is received instance members of this bean (stateless) which invoked the user thread
are assigned the values by calling getter methods written in the thread code.

Just to make the things clear ----

class MySessionBean implements SessionBean
{



String respose1;
String respose2;
String respose3;
.
.
.
createThreadFun()
{

MyRunnable t=new MyRunnable(); //this thread communicates with a remote server and collects the response
t.start();
while(getResponseCode==null){}

respose1=t.getRespose1();
respose2=t.getRespose1();
}




}


class MyRunnable extends Thread
{
String responseCode;
String lrespose1;
String lrespose2;
.
.
.
public void run()
{





}


String getRespose1(){return lrespose1;}

String getResponseCode(){return responseCode;}
.
.
.

}

What i am able to figure out from the logs on the server is that :

when the client for this bean (stateless ) invokes the getter methods to get the response (instance members of session bean) some of the
requests are handled by one managed server(MS1) and some are handled by the other
managed server(MS2) of the cluster.
logs clearly show that responses returned by MS1 are OK but the services handled by the
MS2 returns NULL.

I am not able to understand why this instance of stateless session bean
(present on MS2 due to session replication or whatever it is as i don't have any idea)
is not syncronized with that present on MS1.while it clearly shows that methods are invoked
(as System.out.println() gets printed )but they return NULL.

please give me your valuable inputs and some links regarding CLuster and EJBS.


Thanks

Best Regards

Jolly
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never, and i mean never use threading inside EJBs.
Read the docs and you will know.

Threading and stuff is managed by the app server.
If we try to put in our own stuff, then the behaviour is unpredictable.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!