[ 
https://issues.apache.org/jira/browse/GERONIMO-5987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13113509#comment-13113509
 ] 

Russell E Glaue commented on GERONIMO-5987:
-------------------------------------------

I just tested geronimo-tomcat7-javaee6-3.0-20110923.091022-350-bin
PortOffset is now working with ActiveMQ, and I am able to startup multiple 
instances of the javaee6 bundle within the same runtime OS - IFF I follow a 
certain startup procedure. Yes, there is one more issue - regarding the 
ActiveMQ lock file.

I have created an example for running multiple instances within the Geronimo 
Wiki, here: 
https://cwiki.apache.org/confluence/display/GMOxDOC30/Running+multiple+Geronimo+instances
Now, if you follow this example, you can follow me in the issue I am able to 
reproduce with a conflict of the ActiveMQ lock file.

Follow the example in the wiki to setup two separate instance. In both start 
scripts, uncomment the interactive startup (bin/geronimo run), and comment out 
the "Normal startup (bin/startup).

Now the steps to reproduce an issue where two Geronimo instances conflict over 
the same ActiveMQ lock file:
1. system$ cd /opt/geronimo3
2. system$ gserv1/start.sh
3. system$ gserv2/start.sh
In these three steps, gserv1 will startup successfully (ActiveMQ binds to port 
61716), but ActiveMQ uses the lockfile "/opt/geronimo3/var/activemq/lock".
When you start gserv2, its ActiveMQ wants to use the lockfile 
"/opt/geronimo3/var/activemq/lock" too. As a result, gserv2 never startsup 
because it enters an infinite loop waiting for the ActiveMQ lock file to be 
available.

Now the successful steps to a current workaround to the above issue
1. system$ cd /opt/geronimo3
2. system$ cd gserv1
3. system$ ./start.sh
4. system$ cd gserv2
5. system$ ./start.sh
In these three steps, gserv1 will startup successfully (ActiveMQ binds to port 
61716), AND (unlike the above issue) ActiveMQ uses the lockfile 
"/opt/geronimo3/gserv1/var/activemq/lock".
Similarly, gserv2 starts up successfully (ActiveMQ binds to port 61816), AND 
(unlike the above issue) ActiveMQ uses the lockfile 
"/opt/geronimo3/gserv2/var/activemq/lock".

So it appears that ActiveMQ uses the lock file of {cwd}/var/activemq/lock , but 
instead ActiveMQ should be using the lock file of 
{org.apache.geronimo.server.dir}/{org.apache.geronimo.server.name}/var/activemq/lock
 .

The workaround works because ActiveMQ (surprisingly) does not use the lock file 
of GERONIMO_HOME/var/activemq/lock which was what I was expecting to be the 
root of the problem when I first encountered this issue.

And just for fun (to verify this is what is really happening) I tried this:
(GERONIMO_HOME := /opt/geronimo3/ and the instance is /opt/geronimo3/gserv1)
1. system$ ls -d /opt/var
ls: /opt/var: No such file or directory
2. system$ cd /opt
3. system$ geronimo3/gserv1/start.sh
4. system$ ls -d /opt/var
/opt/var
4. system$ tree /opt/var
/opt/var
`-- activemq
    |-- journal
    |   |-- data-1
    |   `-- data-control
    |-- kr-store
    |   |-- data
    |   |   |-- index-container-roots
    |   |   `-- lock
    |   `-- state
    |       |-- data-kaha-1
    |       |-- data-store-state-1
    |       |-- hash-index-store-state_state
    |       |-- index-kaha
    |       |-- index-store-state
    |       |-- index-transactions-state
    |       `-- lock
    `-- lock


> The ActiveMQ working directory and port are not referenced correctly - 
> multiple instances not possible
> ------------------------------------------------------------------------------------------------------
>
>                 Key: GERONIMO-5987
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5987
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: ActiveMQ
>    Affects Versions: 3.0-M1, 3.0
>         Environment: Linux x86, Red Hat Enterprise Linux Server release 5.4 
> (Tikanga)
>            Reporter: Russell E Glaue
>            Assignee: Rex Wang
>              Labels: geronimo
>         Attachments: GERONIMO-5987-detail.patch, GERONIMO-5987-new.patch, 
> GERONIMO-5987.patch
>
>
> I am testing with geronimo-tomcat7-javaee6-web-3.0-SNAPSHOT, 
> geronimo-tomcat7-javaee6-web-3.0-20110523.171218-97
> ActiveMQ is configured to run as "org.apache.geronimo.home.dir/var/activemq" 
> and port 61616, and does not cooperate with multi-server configurations, nor 
> does it use the PortOffset. This is the use of the 
> "org.apache.geronimo.server.name" option and PortOffset in 
> "var/config/config-substitutions.properties". (see: 
> https://cwiki.apache.org/GMOxDOC30/running-multiple-geronimo-instances.html)
> First, Problem with working directory
> When wanting to run more than a single server instance, the ActiveMQ startup 
> will block waiting for the lock file "$GERONIMO_HOME/var/activemq/lock" to 
> become available.
> Obviously this causes any server instance started after the first server 
> instance is started to block during startup while waiting for the lock file 
> to become available.
> Second, Problem with PortOffset
> When configuring the PortOffset in  
> "var/config/config-substitutions.properties", all Geroniomo components expect 
> and attempt to connect to ActiveMQ at the port {ActiveMQ + PortOffset}. 
> However, regardless of what you set the PortOffset to be, the ActiveMQ 
> service only ever binds to port 61616, the default configured port (or 
> whatever you have the port set as for this service).
> Steps to repeat working directory problem:
> 1. Download and unpack G3.0 SNAPSHOT (3.0-20110523 tested)
> 2. Create the server instances:
> -- 2A. cd ${GERONIMO_HOME}
> -- 2B-1. mkdir gserver1
> -- 2B-2. cp -rp var gserver1/
> -- 2B-3. cp -rp etc gserver1/
> -- 2B-4. cp -rp repository gserver1/
> 3. update the "PortOffset" parameter in 
> gserver1/var/config/config-substitutions.properties for the gserver1 instance.
> 4. Start the default instance and gserver1 instance:
> -- bin/startup
> -- env GERONIMO_OPTS=-Dorg.apache.geronimo.server.name=gserver1 bin/startup
> 5. `tail -f gserver1/var/logs/geronimo.log` and you will see this as the last 
> line that outputs:
> "2011-05-31 16:26:39,609 WARN  [AMQPersistenceAdapter] Waiting to Lock the 
> Store var/activemq"
> The server waits here indefinitely.
> 6. Shutdown the default instance and you will see the "gserver1" instance 
> continue on in the startup procedures. (of course you will see errors due to 
> the PortOffset problem)
> * If I first start the "gserver1" instance by itself (before starting the 
> default instance), the directory "org.apache.geronimo.home.dir/var/activemq" 
> is created and populated. Instead it should be 
> "org.apache.geronimo.home.dir/org.apache.geronimo.server.name/var/activemq" 
> that is created and populated.
> * Probably the patch should be to reference the ActiveMQ working directory as 
> "org.apache.geronimo.server.dir/var/activemq"
> Steps to repeat PortOffset problem:
> 1. Download and unpack G3.0 SNAPSHOT (3.0-20110523 tested)
> 2. Create the server instances:
> -- 2A. cd ${GERONIMO_HOME}
> -- 2B-1. mkdir gserver1
> -- 2B-2. cp -rp var gserver1/
> -- 2B-3. cp -rp etc gserver1/
> -- 2B-4. cp -rp repository gserver1/
> 3. update the "PortOffset" parameter in 
> gserver1/var/config/config-substitutions.properties in the instance
> 4. Start the server instance:
> -- env GERONIMO_OPTS=-Dorg.apache.geronimo.server.name=gserver1 bin/startup
> This is the two error messages you receive when configuring PortOffset to 100 
> (for example). The second error message, regarding XAResource, repeats:
> -
> 2011-06-01 16:26:49,883 ERROR [MCFConnectionInterceptor] Error occurred 
> creating
> ManagedConnection for handle: nullManagedConnectionInfo:
> org.apache.geronimo.connector.outbound.ManagedConnectionInfo@1c211b3. mc: 
> null]
> javax.resource.ResourceException: Could not create connection.
>       at
> org.apache.activemq.ra.ActiveMQManagedConnectionFactory.createManagedConnection(ActiveMQManagedConnectionFactory.java:171)
> ...
> Caused by: java.net.ConnectException: Connection refused
> ...
> -
> This one reveals the problem that ActiveMQ ia not using PortOffset. 
> RecoveryController wants to connect to ${ActiveMQ + PortOffset} (61616 + 100).
> -
> 2011-06-01 16:26:49,885 ERROR [RecoveryController] Recovery error: Could not 
> get
> XAResource for recovery for mcf:
> geronimo:J2EEApplication=null,J2EEServer=geronimo,JCAConnectionFactory=DefaultActiveMQConnectionFactory,JCAManagedConnectionFactory=DefaultActiveMQConnectionFactory,JCAResource=geronimo-activemq-ra-3.0-SNAPSHOT,ResourceAdapter=geronimo-activemq-ra-3.0-SNAPSHOT,ResourceAdapterModule=org.apache.geronimo.configs/activemq-ra/3.0-SNAPSHOT/car,j2eeType=JCAConnectionManager,name=DefaultActiveMQConnectionFactory
> 2011-06-01 16:27:05,894 ERROR [MCFConnectionInterceptor] Error occurred 
> creating
> ManagedConnection for handle: nullManagedConnectionInfo:
> org.apache.geronimo.connector.outbound.ManagedConnectionInfo@287dba. mc: null]
> javax.resource.ResourceException: Could not create connection.
> ...
> Caused by: javax.jms.JMSException: Could not connect to broker URL:
> tcp://localhost:61716. Reason: java.net.ConnectException: Connection refused
> ...
> -
> In this tested scenario, ActiveMQ is binding to port 61616, even though the 
> PortOffset value is 100.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to