ActiveMQ does not stop subscription when flex client disconnects - activemq

I'm using activeMQ 5.3 to send messages to a flex client via blazeds 3.2.
When the client connects for the first time, I can see the subscriptions to the activeMQ broker being made. However, after I kill the browser that runs the client the subscriptions remain open even though no messages are being consumed anymore. This finally results in an out-of-memory of the web server. From the logs it looks like Blazeds is unsubscribing from the feeds.
Shouldn't blazeds stop the subscription when there are no clients that connect anymore and why isn't he doing that?
Below you can find a snippet from the log files.
...
STARTING WEB SERVER
...
14 Dec 2009 15:54:59,015 [main] DEBUG activemq.transport.vm.VMTransportFactory - binding to broker: localhost
14 Dec 2009 15:54:59,031 [main] INFO apache.activemq.broker.TransportConnector - Connector vm://localhost Started
14 Dec 2009 15:54:59,031 [main] INFO apache.activemq.broker.BrokerService - ActiveMQ JMS Message Broker (localhost, ID:pcjbe-2026-1260802498843-0:0) started
...
CONNECTING WITH CLIENT
...
14 Dec 2009 15:55:03,953 [VMTransport] DEBUG apache.activemq.broker.TransportConnection - Setting up new connection: vm://localhost#4
14 Dec 2009 15:55:03,968 [VMTransport] DEBUG activemq.broker.region.AbstractRegion - localhost adding consumer: ID:pcjbe-2026-1260802498843-2:2:-1:1 for destination: topic://ActiveMQ.Advisory.TempQueue,topic://ActiveMQ.Advisory.TempTopic
14 Dec 2009 15:55:03,968 [http-8000-3] INFO flex.messaging.jms.JmsAdapter - client [AEE95CCE-816B-EBCC-2ACE-41508E3338AC] subscribed to destination [detectorsFeed]
14 Dec 2009 15:55:03,968 [VMTransport] DEBUG activemq.broker.region.AbstractRegion - localhost adding consumer: ID:pcjbe-2026-1260802498843-2:2:1:1 for destination: topic://tmsng.topic.detectors
14 Dec 2009 15:55:03,968 [VMTransport] DEBUG activemq.broker.region.AbstractRegion - localhost adding destination: topic://tmsng.topic.detectors
14 Dec 2009 15:55:03,968 [VMTransport] DEBUG activemq.broker.region.AbstractRegion - localhost adding destination: topic://tmsng.topic.detectors
14 Dec 2009 15:55:03,968 [VMTransport] DEBUG activemq.broker.region.AbstractRegion - localhost adding destination: topic://ActiveMQ.Advisory.Consumer.Topic.tmsng.topic.detectors
[BlazeDS]12/14/2009 15:55:03.968 [DEBUG] [Client.MessageClient] MessageClient created with clientId 'AEE95CCE-816B-EBCC-2ACE-41508E3338AC' for destination 'detectorsFeed'.
...
DISCONNECTING CLIENT
...
14 Dec 2009 15:58:55,156 [http-8000-8] INFO flex.messaging.jms.JmsAdapter - client [AEF0AC64-7B6C-2749-8860-252B8A302EBA] unsubscribed from destination [detectorsFeed]
[BlazeDS]12/14/2009 15:58:55.156 [DEBUG] [Client.MessageClient] MessageClient with clientId 'AEF0AC64-7B6C-2749-8860-252B8A302EBA' for destination 'detectorsFeed' has been invalidated.
Below you can find the configuration used to for ActiveMQ
<beans xmlns="http://www.springframework.org/schema/beans" ...>
<amq:broker brokerName="localhost" useJmx="true" persistent="false" dataDirectory="${INSTALLDIR}/var" >
<amq:destinationPolicy>
<amq:policyMap>
<amq:policyEntries>
<amq:policyEntry topic=">" producerFlowControl="false">
<amq:pendingSubscriberPolicy>
<amq:vmCursor/>
</amq:pendingSubscriberPolicy>
</amq:policyEntry>
</amq:policyEntries>
</amq:policyMap>
</amq:destinationPolicy>
<amq:managementContext>
<amq:managementContext createConnector="false"/>
</amq:managementContext>
<amq:systemUsage>
<amq:systemUsage sendFailIfNoSpace="true">
<amq:memoryUsage>
<amq:memoryUsage limit="10mb" />
</amq:memoryUsage>
</amq:systemUsage>
</amq:systemUsage>
<amq:transportConnectors>
<amq:transportConnector uri="vm://localhost" />
</amq:transportConnectors>
</amq:broker>
<!-- JMS ConnectionFactory to use, configuring the embedded broker using XML -->
<amq:connectionFactory id="connectionFactory" brokerURL="vm://localhost" alwaysSessionAsync="true">
<amq:prefetchPolicy>
<!-- For pooled connections, set the prefetch to 1 to avoid out-of-order messages. (see http://activemq.apache.org/what-is-the-prefetch-limit-for.html) -->
<amq:prefetchPolicy all="1"/>
</amq:prefetchPolicy>
</amq:connectionFactory>
<!-- a pooling based JMS provider -->
<bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop">
<property name="connectionFactory" ref="connectionFactory" />
</bean>
<amq:topic id="detectorTopic" physicalName="tmsng.topic.detectors" />
Best regards
Jan

Does look like a blazeds problem of not closing down the connection

Related

activemq failover using multiple instances in master slave mode on same linux machine

I have setup ActiveMQ mulitple instances to achieve failover in master slave mode in windows.
While setting up the same i just created 3 instances under bin folder without changing any port and started all 3 instances one by one. First instance became master and remaining were in slave mode until I stopped master instance.
Now I am trying to achieve the same in Linux environment. First instance starts successfully but when I start second instance in a different window it throws below error:
ERROR | Failed to start Apache ActiveMQ ([instance2, ID:132vm6-57227-1478597606120-0:1], java.io.IOException: Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server socket: tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Address already in use)
INFO | Apache ActiveMQ 5.14.0 (instance2, ID:132vm6-57227-1478597606120-0:1) is shutting down
INFO | Connector openwire stopped
INFO | Connector amqp stopped
INFO | Connector stomp stopped
INFO | Connector mqtt stopped
INFO | Connector ws stopped
INFO | PListStore:[/opt/apache-activemq-5.14.0/bin/instance2/data/instance2/tmp_storage] stopped
INFO | Stopping async queue tasks
INFO | Stopping async topic tasks
INFO | Stopped KahaDB
INFO | Apache ActiveMQ 5.14.0 (instance2, ID:132vm6-57227-1478597606120-0:1) uptime 0.585 seconds
INFO | Apache ActiveMQ 5.14.0 (instance2, ID:132vm6-57227-1478597606120-0:1) is shutdown
INFO | Closing org.apache.activemq.xbean.XBeanBrokerFactory$1#4233871a: startup date [Tue Nov 08 15:03:24 IST 2016]; root of context hierarchy
WARN | Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.apache.activemq.xbean.XBeanBrokerFactory$1#4233871a: startup date [Tue Nov 08 15:03:24 IST 2016]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:357)[spring-context-4.1.9.RELEASE.jar:4.1.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:884)[spring-context-4.1.9.RELEASE.jar:4.1.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:843)[spring-context-4.1.9.RELEASE.jar:4.1.9.RELEASE]
at org.apache.activemq.hooks.SpringContextHook.run(SpringContextHook.java:30)[activemq-spring-5.14.0.jar:5.14.0]
at org.apache.activemq.broker.BrokerService.stop(BrokerService.java:875)[activemq-broker-5.14.0.jar:5.14.0]
at org.apache.activemq.xbean.XBeanBrokerService.stop(XBeanBrokerService.java:122)[activemq-spring-5.14.0.jar:5.14.0]
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:629)[activemq-broker-5.14.0.jar:5.14.0]
at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)[activemq-spring-5.14.0.jar:5.14.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_65]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_65]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_65]
at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_65]
I am using ActiveMQ 5.14 version.
If anybody has encountered a similar issue, kindly provide your inputs.
To get multiple instances of ActiveMQ running on the same machine, you need to change the ports that they try to open. There are (at least) 3 ports that need to be changed:
The transportConnector ports that accept messaging traffic. These are defined in theactivemq.xml file. Typically you only need the openwire one - this is 61616 by default; I usually change this in the other ActiveMQ instances to 61626, 61636 etc. You can usually comment out the others if you don't intend to use them.
The Jetty HTTP port. This is defined in the jetty.xml file. The default is 8161, set the next ones to 8162, 8163 etc.
The JMX port. This one's a bit tricky, as you need to stick a piece of config into the activemq.xml to explicitly define it as follows:
<managementContext>
<managementContext createConnector="true" connectorPort="1099"/>
</managementContext>
You can then change this to 1199, 1299 on the other instances. Hope this helps.

Weblogic doesn't cache LDAP

I have a web application set up using JSF 2.1 and JEE 6 running on a WebLogic 12.1.2 server with an openLDAP for authentication. I've been noticing that loading any page in the app causes multiple BIND requests to LDAP – every single time!
I've read through much of the material and have configured the LDAP provider in Weblogic such that just about any cache I could find is activated. In particular I've set
[x] Cache Enabled
Cache Size: 10240
Cache TTL: 300
GUID Attribute: entryUUID
I've also double-checked that the entryUUID attribute exists. I'm not too knowledgable on either WebLogic or LDAP, but I've read just about any page on configuring the cache, but there's still just as many requests to the LDAP (yes, I've restarted the servers after changes.)
I'd appreciate any help, insights or wild guesses as to what may be the cause or how I can debug this issue further. I'm not too sure which config files to attach, but if there's anything needed I'm happy to provide it.
The LDAP requests all look like this:
# journalctl -u slapd
# … many of these …
Sep 16 23:06:03 server.org slapd[15038]: daemon: read active on 13
Sep 16 23:06:03 server.org slapd[15038]: daemon: epoll: listen=7 active_threads=0 tvp=zero
Sep 16 23:06:03 server.org slapd[15038]: daemon: epoll: listen=8 active_threads=0 tvp=zero
Sep 16 23:06:03 server.org slapd[15038]: conn=1109 op=32 BIND anonymous mech=implicit ssf=0
Sep 16 23:06:03 server.org slapd[15038]: conn=1109 op=32 BIND dn="tpid=NQ00000013,ou=people,dc=de,dc=foobiz,dc=com" method=128
Sep 16 23:06:03 server.org slapd[15038]: conn=1109 op=32 BIND dn="tpid=NQ00000013,ou=people,dc=de,dc=foobiz,dc=com" mech=SIMPLE ssf=0
Sep 16 23:06:03 server.org slapd[15038]: conn=1109 op=32 RESULT tag=97 err=0 text=
Sep 16 23:06:03 server.org slapd[15038]: daemon: activity on 1 descriptor
Sep 16 23:06:03 server.org slapd[15038]: daemon: activity on:
I have figured out the issue and WebLogic isn't at fault whatsoever. Our application seems to be using a rather broken concept of calling remote EJBs where it creates its own proxy, stores the JNDI information and executes a JNDI lookup on every method invocation.
Therefore, even caching the bean wouldn't help. Of course this bypasses any caching mechanisms and thus results in multiple LDAP binds with every request.

NetworkManager kills apache when going offline

When i turn off my WiFi, NetworkManager kills apache2. This can be seen in '/var/log/apache/error_log':
[Sun Mar 01 13:25:55 2015] [notice] caught SIGTERM, shutting down
However, this does not happen if i turn off the WiFi manually by doing
sudo ifconfig wlan0 down
It seems NetworkManager goes to status 'inactive' when i disconnect it from the WiFi.
These are some of the contents of '/var/log/messages' around the time i turn off the WiFi:
Mar 1 13:25:52 raven NetworkManager[22393]: <info> (wlan0): device state change: activated -> disconnected (reason 'user-requested') [100 30 39]
Mar 1 13:25:52 raven NetworkManager[22393]: <info> (wlan0): deactivating device (reason 'user-requested') [39]
Mar 1 13:25:52 raven dhcpcd[350]: received SIGTERM, stopping
Mar 1 13:25:52 raven dhcpcd[350]: wlan0: removing interface
Mar 1 13:25:53 raven NetworkManager[22393]: <info> (wlan0): canceled DHCP transaction, DHCP client pid 350
Mar 1 13:25:53 raven NetworkManager[22393]: <info> NetworkManager state is now DISCONNECTED
Mar 1 13:25:53 raven dbus[16077]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
Mar 1 13:25:53 raven NetworkManager[22393]: <warn> (pid 350) unhandled DHCP event for interface wlan0
Mar 1 13:25:53 raven NetworkManager[22393]: <warn> Connection disconnected (reason -3)
Mar 1 13:25:53 raven NetworkManager[22393]: <info> (wlan0): supplicant interface state: completed -> disconnected
Mar 1 13:25:53 raven NetworkManager[22393]: <warn> Connection disconnected (reason -3)
Is there a way to "uncouple" apache2 from NetworkManager so it is not killed when going offline
I have gentoo 3.10.7-gentoo-r1, i am using OpenRC (not systemd),
NetworkManager 0.9.8.8, and apache 2.2.25
Same problem here (Gentoo user for years).
Very quick solution:
As root, just type apache1 this will start apache with the same configs as the init script /etc/init.d/apache2 does. The only difference is that it will not check for a started network.
The reason why it is stopped then NetworkManager is stopped is this part of the init script:
depend() {
need net
use mysql dns logger netmount postgresql
after sshd
}
The need net part tells the script that this service requires the network to be up. On machine where NetworkManager is used and there is no network connection, through WiFi or wired networks, this condition is not given and the service is stopped automatically.
So as a second (still hacky) solution, you could just comment out this line.

Configuration of CloudAMQP Connection

I'm having difficulty configuring my connection to CloudAMQP in my deployed grails application. I can run the application locally against a locally installed RabbitMQ instance but can't figure out how to correctly define my application to run on CloudBees using the CloudAMQP service.
In my Config.groovy, I'm defining my connection info and a queue:
rabbitmq {
connectionfactory {
username = 'USERNAME'
password = 'PASSWORD'
hostname = 'lemur.cloudamqp.com'
}
queues = {
testQueue autoDelete: false, durable: false, exclusive: false
}
}
When the application starts and tries to connect, I see the following log messages:
2013-08-23 21:29:59,195 [main] DEBUG listener.SimpleMessageListenerContainer - Starting Rabbit listener container.
2013-08-23 21:29:59,205 [SimpleAsyncTaskExecutor-1] DEBUG listener.BlockingQueueConsumer - Starting consumer Consumer: tag=[null], channel=null, acknowledgeMode=AUTO local queue size=0
2013-08-23 21:30:08,405 [SimpleAsyncTaskExecutor-1] WARN listener.SimpleMessageListenerContainer - Consumer raised exception, processing can restart if the connection factory supports it
org.springframework.amqp.AmqpIOException: java.io.IOException
at org.springframework.amqp.rabbit.connection.RabbitUtils.convertRabbitAccessException(RabbitUtils.java:112)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:163)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:228)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:119)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:163)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:109)
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:199)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:524)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:381)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:516)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:545)
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; reason: java.net.SocketException: Connection reset
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)
... 3 more
Caused by: java.net.SocketException: Connection reset
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:95)
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:131)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:508)
2013-08-23 21:30:08,406 [SimpleAsyncTaskExecutor-1] INFO listener.SimpleMessageListenerContainer - Restarting Consumer: tag=[null], channel=null, acknowledgeMode=AUTO local queue size=0
2013-08-23 21:30:08,406 [SimpleAsyncTaskExecutor-1] DEBUG listener.BlockingQueueConsumer - Closing Rabbit Channel: null
2013-08-23 21:30:08,407 [SimpleAsyncTaskExecutor-2] DEBUG listener.BlockingQueueConsumer - Starting consumer Consumer: tag=[null], channel=null, acknowledgeMode=AUTO local queue size=0
Aug 23, 2013 9:30:11 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'grails'
Aug 23, 2013 9:30:11 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8634
Aug 23, 2013 9:30:11 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8634
According to https://developer.cloudbees.com/bin/view/RUN/CloudAMQP
when you bind your CloudAMQP service to your app - some config params are provided in the pattern of CLOUDAMQP_URL_ - this is the type of thing you would need to put in your config files so they can be wired in when the app launches.
Make sure to specify the virtualHost for CloudAMQP connections. That worked for me.

jdbc connection on tomcat server

I will try to formulate as best as I can.
First, web application(Spring MVC with Spring Jdbc) worked well until I started messing out with versions of STS(Spring Tool Suite based on Eclipse) and JDK+JRE7 to get features of Java 7.
Second, the current problem is that Apache Tomcat 6 or 7(I have both which I reinstalled for reason I don't remember) seems to be affecting the connection to the database. Saying directly: it fails to get jdbc connection
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: No suitable driver found for jdbc:postgresql:postgres
and it happens whenever I try to do any operation on database from my web application.
The line jdbc:postgresql:postgres is OK just in case, because it worked before and it effectively says to connect to local database with name postgres(and also because of the point below).
Another important point to mention is that under vFabric tc Server everything works flawlessly without any problems whatsoever.
Third, the database is PostgreSql along with Apache DBCP pooling.
Fourth, the maven jdbc driver dependencies seems to work well, as again if they didn't vFabric tc Server would also fail same as Apache Tomcat which leads to me to an idea that Apache Tomcat is itself the culprit.
Some of the information produced during server start-up:
Dec 14, 2011 4:54:32 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\ProgramFiles\Java\jdk1.7.0_02\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin;C:\Program Files\Apache Software Foundation\apache-maven-3.0.3\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\QuickTime\QTSystem\;.
Dec 14, 2011 4:54:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 14, 2011 4:54:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Dec 14, 2011 4:54:32 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 849 ms
Dec 14, 2011 4:54:32 PM org.apache.catalina.core.StandardServicestartInternal
INFO: Starting service Catalina
Dec 14, 2011 4:54:32 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.23
Dec 14, 2011 4:54:33 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Users\User\Documents\workspace-sts\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\project.xml
Dec 14, 2011 4:54:33 PM org.apache.catalina.startup.SetContextPropertiesRule begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:project' did not find a matching property.
Dec 14, 2011 4:54:34 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Dec 14, 2011 4:54:37 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 14, 2011 4:54:37 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Dec 14, 2011 4:54:37 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4664 ms
I am really desperate please help.
UPDATE:
Still sitting in front looking at sad screen, so I decided to include all the .xml configuration.
<bean id="dataSource" class="org.apache.commons.dbcp.PoolingDataSource">
<constructor-arg ref="connectionPool"/>
</bean>
<bean id ="connectionPool" class="org.apache.commons.pool.impl.GenericObjectPool">
<constructor-arg><null/></constructor-arg>
</bean>
<bean id="poolableConnectionFactory" class="org.apache.commons.dbcp.PoolableConnectionFactory" >
<constructor-arg ref="connectionFactory"/>
<constructor-arg ref="connectionPool"/>
<constructor-arg><null/></constructor-arg>
<constructor-arg><null/></constructor-arg>
<constructor-arg value="false"/>
<constructor-arg value="true"/>
</bean>
<bean id="connectionFactory" class="org.apache.commons.dbcp.DriverManagerConnectionFactory">
<constructor-arg value="jdbc:postgresql:postgres"/>
<constructor-arg value="postgres"/>
<constructor-arg value="myCorrectPassword"/>
</bean>
In grl, I'd say that DB drivers should probably go into the common lib folder on Tomcat.
Usually those drivers are used for several applications.
Additionally, if you set your pool in the context.xml, this is required.