users@glassfish.java.net

Re: jvmroute not added to sessionid.

From: Amy Roh <amy.roh_at_oracle.com>
Date: Wed, 03 Aug 2011 10:54:30 -0700

I noticed that you don't have instances defined in your domain.xml. If you want to load balance between your instances using mod_jk, then the jvmRoute needs to be created using system property as below.

asadmin create-network-listener --jkenabledtrue --target cluster1 --protocol http-listener-1 --listenerport ${AJP_PORT} jk-listener

asadmin create-jvm-options --target cluster1"-DjvmRoute=\${AJP_INSTANCE_NAME}"

Configure the above system properties for each instance in the cluster. For example, for a cluster instance named "in1", run these commands:

asadmin create-system-properties --target instance1 AJP_INSTANCE_NAME=instance1
asadmin create-system-properties --target instance1 AJP_PORT=8009
asadmin create-system-properties --target instance2 AJP_INSTANCE_NAME=instance2
asadmin create-system-properties --target instance2 AJP_PORT=8010
asadmin create-system-properties --target instance3 AJP_INSTANCE_NAME=instance3
asadmin create-system-properties --target instance3 AJP_PORT=8011

......

On 8/3/11 10:37 AM, Amy Roh wrote:
> You just need to create a jvm option and restart the server. Try
> removing other jvmRoute properties under server.
>
> asadmin create-jvm-options -DjvmRoute=MYINSTANCE
> asadmin restart-domain
>
> We have a unit test [1] for this feature and it is working fine.
>
> asadmin-common-ignore-fail:
> [echo] asadmin create-jvm-options --user admin --passwordfile
> /files/hudson/workspace/webtier-dev-tests-v3/appserv-tests/config/adminpassword.txt
> --host localhost --port 60492 --echo=true --terse=true
> -DjvmRoute=MYINSTANCE
> [exec] asadmin --host localhost --port 60492 --user admin
> --passwordfile
> /files/hudson/workspace/webtier-dev-tests-v3/appserv-tests/config/adminpassword.txt
> --interactive=false --echo=true --terse=true create-jvm-options
> --target server -DjvmRoute=MYINSTANCE
> [exec] Created 1 option(s)
>
> .......
>
> run:
> [java] Connecting
> to:http://localhost:39495/web-session-jvm-route/CreateSession
> [java] Response cookie:
> JSESSIONID=fe6fdee65ca00039384468531ebc.MYINSTANCE;
> Path=/web-session-jvm-route; HttpOnly
> [java]
> [java] Connecting to: GET /web-session-jvm-route/CheckSession
> HTTP/1.0
> [java]
> [java] HTTP/1.1 200 OK
> [java] X-Powered-By: Servlet/3.0 JSP/2.2 (GlassFish Server Open
> Source Edition 3.2-SNAPSHOT Java/Sun Microsystems Inc./1.6)
> [java] Server: GlassFish Server Open Source Edition 3.2-SNAPSHOT
> [java] Set-Cookie: MYNAME=MYVALUE
> [java] Set-Cookie:
> JSESSIONID=fe6fdee65ca00039384468531ebc.MYINSTANCE;
> Path=/web-session-jvm-route; HttpOnly
> [java] Date: Wed, 03 Aug 2011 13:48:24 GMT
> [java] Connection: close
> [java] content-length: 0
> [java]
> [java] Generating report at
> /files/hudson/workspace/webtier-dev-tests-v3/appserv-tests/test_results.xml
> [java]
> [java]
> [java] -----------------------------------------
> [java] - session-jvm-route: PASS -
> [java] -----------------------------------------
> [java] - Total PASS : 1 -
> [java] - Total FAIL : 0 -
> [java] - Total DID NOT RUN : 0 -
> [java] -----------------------------------------
>
>
> [1]
> http://java.net/projects/glassfish/sources/svn/show/trunk/v2/appserv-tests/devtests/web/sessionJvmRoute
>
> On 8/3/11 8:13 AM, forums_at_java.net wrote:
>> Hi Shing,
>>
>> Yes, I have added it almost everywere:
>>
>> 1) as JVM parameters -DjvmRoute
>> 2) as Instance propoerty
>> 3) as Server property
>>
>> But it does not append jvmRoute to sessionId yet...
>>
>> Thanks a lot.
>>
>>
>> --
>>
>> [Message sent by forum member 'osegarra']
>>
>> View Post: http://forums.java.net/node/828705
>>
>>