Sure ! Somethings might be pointless, as it is a class just for testing purpose.


  | @RemoteBinding(jndiBinding="EJBTEST/NatPerLstSFBean/remote")
  |     /* This is set as a System.property 
  | clientBindUrl="servlet://mc0430-116.somewhere.de:8080/invoker/JNDIFactory"
  | */
  | @LocalBinding(jndiBinding="comp/env/EJBTEST/NatPerLstSFBean/local")
  | @Stateful
  | @Clustered(partition= "DefaultPartition", loadBalancePolicy = 
org.jboss.ha.framework.interfaces.RoundRobin.class)
  | public class NatPersLstSFBean implements INatPersLstLocal,
  |                                                                             
 INatPersLstRemote,
  |                                                                             
 Serializable{
  |     @Resource SessionContext sctx;
  |     //@PersistenceManager EntityManager em;
  |     private int     hitCount                = 0;
  |     private Session sess                    = null;
  |     List<NatPers>   myResult                = null;
  |     private String  oldletterLastName= "";
  | 
  |     public int getIntValue(String intString) {
  |             hitCount++;
  |             return hitCount;
  |     }               
  | 
  |     @PermitAll
  |     public List<NatPers> getNatPersLst(String letterLastName){              
  |             if (sess==null || sess.isConnected()==false)
  |                     sess = new 
HibTestUtil().sessionFactory.getCurrentSession(); // Could this cause the 
problem when clustering ? 
  |     
  |             try{
  |             sess.beginTransaction();
  |             System.out.println("about to create query");            
  |             Query qry =     sess.createSQLQuery(
  |                             " SELECT PersonID, Name, Vorname from NATPERSON 
np" +
  |                             " WHERE  np.name like '"+ letterLastName + "%' 
" +
  |                             " ORDER BY NAME, VORNAME" 
).addEntity("np",NatPers.class);
  |             //qry.setCacheable(false);
  |             System.out.println("about to save result");
  |             myResult = (List<NatPers>) qry.list();
  |             sess.getTransaction().commit();
  |             }catch (Exception e){
  |                     e.printStackTrace();
  |                     sess.getTransaction().rollback();
  |             }       
  |             String sctxUserName="";
  |             try{
  |                     if (sctx !=null){
  |                             sctxUserName = 
sctx.getCallerPrincipal().getName();
  |                             System.out.println(sctxUserName);
  |                     }
  |             }catch(Exception e){System.out.println(e);}
  |             
  |             return myResult;
  |     }       
  |     @Init
  |     public void createSession(){            
  |             System.out.println("I have been created by"+ 
  |                                                     
  |                                                     " " 
+this.getClass().getName());
  |     }
  |     @Remove
  |     public void endSession(){
  |             System.out.println("I am ending "+this.getClass().getName());
  |     }
  |     @PrePassivate
  |     public void doSerialization(){
  |             System.out.println("I will be serial soon 
"+this.getClass().getName());
  |     }       
  |     
  |     @PostActivate
  |     public void doDeSerialization(){
  |             System.out.println("I am deserialized again 
"+this.getClass().getName());
  |     }
  | }
  | 

Mainly it fetches a hibernate session from a factory and uses this to to the 
query on the db and passes the result back to the client.  The client invokes 
the methodes a couple times in a row and ends.
After what you said, could it for some reason be that the  getCurrentSession() 
method trys to somehow use the factory of node one ?

Sincerely
Marc

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950046#3950046

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950046


_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to