Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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.
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!