0 Replies Latest reply on Sep 2, 2005 2:24 AM by aho

    Can't Get Stateful Session Bean Replication Working

    aho

      I have a clustering setup with two JBoss 4.0.3RC1 nodes, one running in solaris 10 and the other in Win XP. I have laso Apache2 + mod_jk1.2 for load balancing but without HTTP session replication implemented. The stateful session bean is coded with @clustered annotation and its function merely keeps a counter on the number of times it is acessed and has a method to return the counter. A JSP calls the session bean method locally to get the counter. Starting the JSP on a browser and each time making a call to session bean increments the counter correctly. When I shut down one of the server, Apache2 correctly perform the load balancing by redirectiing to the running server. However, the counter is not saved and starts from 1 again.

      I presume, when the request goes to the other sever, another JSP is call which invoke a new session bean. If I want to maintain the existing configuration (two servers with JBoss AS each, web server with Apache2), what needs to be done to implement a Stateful Session Bean Replication?

      The console shows that the clustering is implemented when the ear file was deployed in the fram folder.

      14:16:01,062 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-808
      0
      14:16:01,250 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
      14:16:01,265 INFO [JkMain] Jk running ID=0 time=0/62 config=null
      14:16:01,265 INFO [Server] JBoss (MX MicroKernel) [4.0.3RC1 (build: CVSTag=JBos
      s_4_0_3_RC1 date=200506260723)] Started in 42s:594ms
      14:16:42,546 INFO [DefaultPartition] New cluster view for partition DefaultPart
      ition (id: 1, delta: 1) : [192.168.0.102:1099, 192.168.0.54:1099]
      14:16:42,546 INFO [DefaultPartition] I am (192.168.0.102:1099) received members
      hipChanged event:
      14:16:42,546 INFO [DefaultPartition] Dead members: 0 ([])
      14:16:42,546 INFO [DefaultPartition] New Members : 1 ([192.168.0.54:1099])
      14:16:42,546 INFO [DefaultPartition] All Members : 2 ([192.168.0.102:1099, 192.
      168.0.54:1099])
      14:16:50,921 INFO [PassivationTreeCache] viewAccepted(): new members: [192.168.
      0.102:3759, SOLARIS-SERVER:33530]
      14:16:50,921 INFO [PassivationTreeCache] locking the tree to obtain transient s
      tate
      14:16:50,921 INFO [PassivationTreeCache] returning the transient state (140 byt
      es)
      14:16:53,109 INFO [TreeCache] viewAccepted(): new members: [192.168.0.102:3763,
      SOLARIS-SERVER:33533]
      14:16:53,125 INFO [TreeCache] locking the tree to obtain transient state
      14:16:53,125 INFO [TreeCache] returning the transient state (140 bytes)
      14:16:59,171 INFO [TreeCache] viewAccepted(): new members: [192.168.0.102:3767,
      SOLARIS-SERVER:33536]
      14:16:59,203 INFO [TreeCache] locking the tree to obtain transient state
      14:16:59,203 INFO [TreeCache] returning the transient state (140 bytes)
      14:17:39,718 INFO [FarmMemberService] farmDeployment(), deploy locally: farm/ex
      ample1.ear
      14:17:40,953 INFO [EARDeployer] Init J2EE application: file:/C:/jboss-4.0.3RC1/
      server/default/farm/example1.ear
      14:17:41,265 INFO [JaccHelper] Initialising JACC Context for deployment: exampl
      e1.ejb3
      14:17:41,296 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=example.bean.sess
      ion.AccountMaintenanceBean, class=example.bean.session.AccountMaintenanceBean, t
      ype=STATEFUL
      14:17:41,375 INFO [JaccHelper] example.bean.session.AccountMaintenanceBean has
      no @SecurityDomain - skipping JACC configuration
      14:17:41,375 INFO [JaccHelper] JACC Policy Configuration for deployment has bee
      n put in service
      14:17:41,375 INFO [Ejb3Deployment] EJB3 deployment time took: 110
      14:17:41,390 INFO [JaccHelper] Initialising JACC Context for deployment: exampl
      e1.par
      14:17:41,390 INFO [Ejb3Deployment] Found persistence.xml file in EJB3 jar
      14:17:41,390 INFO [HibernatePersistence] found EJB3 Entity bean: example.bean.e
      ntity.Account
      14:17:41,406 INFO [Configuration] processing extends queue
      14:17:41,406 INFO [Configuration] processing collection mappings
      14:17:41,406 INFO [Configuration] processing association property references
      14:17:41,406 INFO [Configuration] processing foreign key constraints
      14:17:41,406 INFO [Configuration] processing extends queue
      14:17:41,406 INFO [Configuration] processing collection mappings
      14:17:41,406 INFO [Configuration] processing association property references
      14:17:41,406 INFO [Configuration] processing foreign key constraints
      14:17:41,406 INFO [ConnectionProviderFactory] Initializing connection provider:
      org.hibernate.ejb.InjectedDataSourceConnectionProvider
      14:17:41,406 INFO [InjectedDataSourceConnectionProvider] Using provided datasou
      rce
      14:17:41,406 INFO [SettingsFactory] RDBMS: MySQL, version: 4.1.13-nt
      14:17:41,406 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version:
      mysql-connector-java-3.1.10 ( $Date: 2005/05/19 15:52:23 $, $Revision: 1.1.2.2
      $ )
      14:17:41,406 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
      14:17:41,406 INFO [TransactionFactoryFactory] Using default transaction strateg
      y (direct JDBC transactions)
      14:17:41,406 INFO [TransactionManagerLookupFactory] instantiating TransactionMa
      nagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
      14:17:41,406 INFO [TransactionManagerLookupFactory] instantiated TransactionMan
      agerLookup
      14:17:41,406 INFO [SettingsFactory] Automatic flush during beforeCompletion():
      disabled
      14:17:41,406 INFO [SettingsFactory] Automatic session close at end of transacti
      on: disabled
      14:17:41,406 INFO [SettingsFactory] JDBC batch size: 15
      14:17:41,406 INFO [SettingsFactory] JDBC batch updates for versioned data: disa
      bled
      14:17:41,406 INFO [SettingsFactory] Scrollable result sets: enabled
      14:17:41,406 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
      14:17:41,406 INFO [SettingsFactory] Connection release mode: after_statement
      14:17:41,406 INFO [SettingsFactory] Maximum outer join fetch depth: 2
      14:17:41,406 INFO [SettingsFactory] Default batch fetch size: 1
      14:17:41,406 INFO [SettingsFactory] Generate SQL with comments: disabled
      14:17:41,406 INFO [SettingsFactory] Order SQL updates by primary key: disabled
      14:17:41,406 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.AST
      QueryTranslatorFactory
      14:17:41,406 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
      14:17:41,406 INFO [SettingsFactory] Query language substitutions: {}
      14:17:41,406 INFO [SettingsFactory] Second-level cache: enabled
      14:17:41,406 INFO [SettingsFactory] Query cache: disabled
      14:17:41,406 INFO [SettingsFactory] Cache provider: org.hibernate.cache.Hashtab
      leCacheProvider
      14:17:41,406 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
      14:17:41,406 INFO [SettingsFactory] Structured second-level cache entries: disa
      bled
      14:17:41,406 INFO [SettingsFactory] Statistics: disabled
      14:17:41,406 INFO [SettingsFactory] Deleted entity synthetic identifier rollbac
      k: enabled
      14:17:41,406 INFO [SettingsFactory] Default entity-mode: pojo
      14:17:41,421 INFO [SessionFactoryImpl] building session factory
      14:17:41,437 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no
      JNDI name configured
      14:17:41,437 INFO [SchemaUpdate] Running hbm2ddl schema update
      14:17:41,437 INFO [SchemaUpdate] fetching database metadata
      14:17:41,437 INFO [SchemaUpdate] updating schema
      14:17:41,437 INFO [Configuration] processing extends queue
      14:17:41,437 INFO [Configuration] processing collection mappings
      14:17:41,437 INFO [Configuration] processing association property references
      14:17:41,437 INFO [Configuration] processing foreign key constraints
      14:17:41,453 INFO [TableMetadata] table found: jboss.account
      14:17:41,453 INFO [TableMetadata] columns: [actbalance, actactive, acttype, act
      name]
      14:17:41,453 INFO [TableMetadata] foreign keys: []
      14:17:41,453 INFO [TableMetadata] indexes: [primary]
      14:17:41,453 INFO [SchemaUpdate] schema update complete
      14:17:41,453 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.fa
      ctory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.p
      kgs=org.jboss.naming:org.jnp.interfaces}
      14:17:41,453 INFO [SessionFactoryImpl] Checking 0 named queries
      14:17:41,453 INFO [Ejb3Deployment] Create EntityManager with JNDI name: MySqlMg
      r
      14:17:41,453 INFO [JaccHelper] JACC Policy Configuration for deployment has bee
      n put in service
      14:17:41,453 INFO [Ejb3Deployment] EJB3 deployment time took: 63
      14:17:41,484 INFO [ProxyDeployer] no declared remote bindings for : example.bea
      n.session.AccountMaintenanceBean
      14:17:41,531 INFO [EJB3Deployer] Deployed: file:/C:/jboss-4.0.3RC1/server/defau
      lt/tmp/deploy/tmp25474example1.ear-contents/example1.ejb3
      14:17:41,531 INFO [EJB3Deployer] Deployed: file:/C:/jboss-4.0.3RC1/server/defau
      lt/tmp/deploy/tmp25474example1.ear-contents/example1.par
      14:17:41,546 INFO [TomcatDeployer] deploy, ctxPath=/example1, warUrl=file:/C:/j
      boss-4.0.3RC1/server/default/tmp/deploy/tmp25474example1.ear-contents/example1-e
      xp.war/
      14:17:41,671 INFO [EARDeployer] Started J2EE application: file:/C:/jboss-4.0.3R
      C1/server/default/farm/example1.ear