Weblogic clustering configuration -
i developing application jdeveloper 11.1.1.6.0. have problem client application when try connect weblogic server cluster within application. service runs on server call.
the situation follows:
there weblogic instance, configuration cannot change @ moment. weblogic instance has following servers , clusters:
- admin server - (runs on machine m1) url: a, port: 1 - url connection t3://a:1
- cluster c containing:
- server s1 - (runs on machine m1) url: a, port: 2 - uses database d1 - url connection t3://a:2
- server s2 - (runs on machine m2) url: b, port: 1 - uses database d2 - url connection t3://b:1
- server s3 - (runs on machine m2) url: b, port: 2 - uses database d2 - url connection t3://b:2
i trying connect t3://a:2 , not cluster or of other 2 servers. however, works every third time, maybe because of 3 servers within cluster. cluster uses unicast messaging , round-robin-affinity load balancing.
i trying find out causes this. can change within configuration of weblogic client application runs (integrated or standalone)? or must configuration setup of instance server cluster changed?
thank in advance!
best regards
(23.05.2013) edit:
we use plain jndi-lookup access ejb on remote server in described scenario.
context ctx = new initialcontext();
object o = ctx.lookup(...)
...
jndi.properties:
java.naming.provider.url=t3://a:2 java.naming.factory.initial=weblogic.jndi.wlinitialcontextfactory
it seems possible send jndi-request right server setting property pin_to_primary_server. yet, subsequent ejb-requests still routed whole cluster using round robin...
can on client-side change behavior address specific server url t3://a:2?
i had similar problem , after trying changing invocationcontext environment properties, found had little luck. instead had alter weblogic-ejb-jar.xml stateless session bean.
string destination = "t3://node-alpha:2010"; hashtable<string, string> env = new hashtable<string, string>(); env.put( context.initial_context_factory, "weblogic.jndi.wlinitialcontextfactory"); env.put( context.provider_url, destination ); // env.put( weblogic.jndi.wlcontext.enable_server_affinity, "true" ); // env.put( weblogic.jndi.wlcontext.pin_to_primary_server, "true" ); initialcontext ctx = new initialcontext( env ); ejbhome home = (ejbhome) ctx.lookup( jndi_remote_system_sf ); sf = somesf.class.cast( home.getclass().getmethod( "create" ).invoke( home ) ); // check hitting right server node. system.out.println( destination + " => " + sf );
once start transaction, shouldn't change servers, create stateless bean receive targeted calls , there begin work intend do. can set stateless bean not clusterable in weblogic-ejb-jar.xml
. need set both items listed below.
<home-is-clusterable>false</home-is-clusterable>
<stateless-bean-is-clusterable>false</stateless-bean-is-clusterable>
what means when getting reference through initial context, targeted server give instance of reference stateless bean on particular cluster node.
using servers
- node-alpha:2010
- node-alpha:2011
- node-beta:3010
- node-beta:3011
with home-is-clusterable
& stateless-bean-is-clusterable
set true
here first entry server targeting, rest fail-over and/or load balancing (e.g. round robin).
clusterableremoteref( 3980825488277365621s:node-alpha:[2010,2010,-1,-1,-1,-1,-1]:mydomain:node-alpha [ 3980825488277365621s:node-alpha:[2010,2010,-1,-1,-1,-1,-1]:mydomain:node-alpha/338, 4236365235325235233s:node-alpha:[2011,2011,-1,-1,-1,-1,-1]:mydomain:node-alpha/341, 1321244352376322432s:node-beta:[3010,3010,-1,-1,-1,-1,-1]:mydomain:node-beta/342, 4317823667154133654s:node-beta:[3011,3011,-1,-1,-1,-1,-1]:mydomain:node-beta/345 ] )/338
with home-is-clusterable
& stateless-bean-is-clusterable
set false
weblogic.rmi.internal.basicremoteref - hostid: '-3980825488277365621s:node-alpha:[2010,2010,-1,-1,-1,-1,-1]:mydomain:node-alpha', oid: '336', channel: 'null'
weblogic-ejb-jar.xml example below.
<weblogic-ejb-jar> <weblogic-enterprise-bean> <ejb-name>somesf</ejb-name> <stateless-session-descriptor> <pool> <max-beans-in-free-pool>42</max-beans-in-free-pool> </pool> <stateless-clustering> <home-is-clusterable>false</home-is-clusterable> <stateless-bean-is-clusterable>false</stateless-bean-is-clusterable> <stateless-bean-methods-are-idempotent>true</stateless-bean-methods-are-idempotent> </stateless-clustering> </stateless-session-descriptor> <transaction-descriptor> <trans-timeout-seconds>20</trans-timeout-seconds> </transaction-descriptor> <enable-call-by-reference>true</enable-call-by-reference> <jndi-name>somesf</jndi-name> </weblogic-enterprise-bean> </weblogic-ejb-jar>
Comments
Post a Comment