I was trying to use new jclouds based discovery mechanism in Hazelcast 3.6 EA. However, couldn't make it work using exactly same credentials as for native AWS discovery. Here are two configs:
Native AWS (works):
<network>
<join>
<multicast enabled="false" />
<tcp-ip enabled="false" />
<aws enabled="true">
<access-key>AKIAXXXXXXXXXXXXX</access-key>
<secret-key>YYYYYYYYYYYYYYYYY</secret-key>
<region>eu-west-1</region>
<host-header>ec2.amazonaws.com</host-header>
</aws>
</join>
</network>
jclouds (doesn't work):
<properties>
<property name="hazelcast.discovery.enabled">true</property>
</properties>
<network>
<join>
<multicast enabled="false" />
<tcp-ip enabled="false" />
<aws enabled="false" />
<discovery-strategies>
<discovery-strategy class="com.hazelcast.jclouds.JCloudsDiscoveryStrategy" enabled="true">
<properties>
<property name="provider">aws-ec2</property>
<property name="identity">AKIAXXXXXXXXXXXXX</property>
<property name="credential">YYYYYYYYYYYYYYYYY</property>
<property name="regions">eu-west-1</property>
</properties>
</discovery-strategy>
</discovery-strategies>
</join>
</network>
More about setup: 2 instances which are part of the same Elastic Beanstalk application. Port 5701 is open publicly (for testing). DEBUG log level enabled for Hazelcast. AWS user has permission to perform ec2:describe*
With jclouds discovery enabled, each node only see itself:
DEBUG: Log4jFactory.java:93 [172.31.5.117]:5701 [dev] [3.6-EA] This node will assume master role since no possible member where connected to.
DEBUG: Log4jFactory.java:93 [172.31.5.117]:5701 [dev] [3.6-EA] This node is being set as the master
DEBUG: Log4jFactory.java:93 [172.31.5.117]:5701 [dev] [3.6-EA] PostJoin master: Address[172.31.5.117]:5701, isMaster: true
INFO : Log4jFactory.java:99 [172.31.5.117]:5701 [dev] [3.6-EA]
Members [1] {
Member [172.31.5.117]:5701 this
}
I see Hazelcast 3.6-EA release has issues with JClouds Integration and here is the fix for it.
https://github.com/hazelcast/hazelcast/pull/6651
Related
i have hazelcast version 3.12.10 and i want enable management center.
I do according to the instructions https://docs.hazelcast.com/imdg/3.12/management/management-center
My config hazelcast.xml
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.12.xsd" xmlns="http://www.hazelcast.com/schema/config">
<group>
<name>(login)</name>
<password>(password)</password>
</group>
<network>
<public-address>(host1)</public-address>
<port auto-increment="false">(port)</port>
<join>
<multicast enabled="false"></multicast>
<tcp-ip enabled="true">
<member>(host1):(port)</member>
<member>(host2):(port)</member>
<member>(host3):(port)</member>
</tcp-ip>
</join>
</network>
<properties>
<property name="hazelcast.rest.enabled">true</property>
<property name="hazelcast.socket.bind.any">true</property>
</properties>
<management-center enabled="true" scripting-enabled="false">
http://localhost:8080/hazelcast-mancenter
</management-center>
</hazelcast>
Hazelcast starts but management-center won't start.
I check the link http://host1:8080/hazelcast-mancenter.
What am I doing wrong?
Port not busy
I got Apache Tomcat running some app on RedHat server, now listening on port 8081. I want the app to listen to port 80, but not working. My RedHat server not using firewall so iptables has no relavance. How can i make it work? Here is my server.xml:
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="84431" />
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="80431"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
</Server>
Ports below 1024 can only be opened by a root user. So If you want tomcat to listen on port 80 you will need to start it as the root user.
Or else you can configure an Apache proxy to redirect traffic o port 80 to port 8081 on which tomcat will be listening on
I tried to connect to cassadra and perform CRUD operation from this link. But after executing the code got the below exception.Can't figure out the problem.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Jun 29, 2015 2:47:00 PM com.impetus.client.cassandra.config.CassandraPropertyReader onProperties
WARNING: No property file found in class path, kundera will use default property
Jun 29, 2015 2:47:01 PM com.impetus.kundera.persistence.EntityManagerFactoryImpl <init>
INFO: EntityManagerFactory created for persistence unit : kundera
Exception in thread "main" com.impetus.kundera.KunderaException: org.scale7.cassandra.pelops.exceptions.NoConnectionsAvailableException: Failed to get a connection within the configured max wait time.
at com.impetus.kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:208)
at kundera.KunderaClient.main(KunderaClient.java:22)
Caused by: org.scale7.cassandra.pelops.exceptions.NoConnectionsAvailableException: Failed to get a connection within the configured max wait time.
at org.scale7.cassandra.pelops.pool.CommonsBackedPool.getConnectionExcept(CommonsBackedPool.java:345)
at org.scale7.cassandra.pelops.Operand.tryOperation(Operand.java:77)
at org.scale7.cassandra.pelops.Mutator.execute(Mutator.java:93)
at org.scale7.cassandra.pelops.Mutator.execute(Mutator.java:63)
at com.impetus.client.cassandra.pelops.PelopsClient.onPersist(PelopsClient.java:527)
at com.impetus.kundera.client.ClientBase.persist(ClientBase.java:83)
at com.impetus.kundera.lifecycle.states.ManagedState.handleFlush(ManagedState.java:193)
at com.impetus.kundera.graph.Node.flush(Node.java:525)
at com.impetus.kundera.persistence.PersistenceDelegator.flush(PersistenceDelegator.java:411)
at com.impetus.kundera.persistence.PersistenceDelegator.persist(PersistenceDelegator.java:169)
at com.impetus.kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:202)
... 1 more
However, I can perform crud operation from cqlsh.
Below is my persistence.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="kundera">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>kundera.Catalog</class>
<properties>
<property name="kundera.nodes" value="localhost" />
<property name="kundera.port" value="9042" />
<property name="kundera.username" value="cassandra" />
<property name="kundera.passsword" value="cassandra" />
<property name="kundera.keyspace" value="Kundera" />
<property name="kundera.dialect" value="cassandra" />
<property name="kundera.client.lookup.class"
value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
<property name="kundera.cache.provider.class"
value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
<property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
</properties>
</persistence-unit>
</persistence>
I tried changing kundera.port to 9160. But got the same exception.
Is your Cassandra server enabled for authentication ? Which version of kundera-cassandra are you using ?
Also, can you please update your persistence.xml and try with :
<persistence-unit name="kundera">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>kundera.Catalog</class>
<properties>
<property name="kundera.nodes" value="localhost" />
<property name="kundera.port" value="9160" />
<property name="kundera.username" value="cassandra" />
<property name="kundera.passsword" value="cassandra" />
<property name="kundera.keyspace" value="Kundera" />
<property name="kundera.dialect" value="cassandra" />
<property name="kundera.client.lookup.class"
value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
</properties>
</persistence-unit>
9042 port is for cql3 binary protocol enabled clients but not the thrift clients. Change,
<property name="kundera.client.lookup.class"
value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
TO
<property name="kundera.client.lookup.class"
value="com.impetus.kundera.client.cassandra.dsdriver.DSClientFactory" />
it should work for you.
HTH,
-Vivek
I have developed a JSF application with JPA using Netbeans and GlassFish. It is working fine within the Netbeans environment. Now I want to deploy it a remote GlassFish server with different database settings. Is there any method I can give the database settings when it is deployed in the server for the first time and save the settings afterwords?
I have a persistence.xml file, but the database settings are there in glassfish-resources.xml file.
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="HOPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>dsHiLap2</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>
</persistence-unit>
glassfish-resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-resource enabled="true" jndi-name="jdbc/ho" object-type="user" pool-name="connectionPoolHo">
<description/>
</jdbc-resource>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.apache.derby.jdbc.ClientDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="connectionPoolHo" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="URL" value="jdbc:derby://localhost:1527/healthofice"/>
<property name="serverName" value="localhost"/>
<property name="PortNumber" value="1527"/>
<property name="DatabaseName" value="healthofice"/>
<property name="User" value="healthoffice"/>
<property name="Password" value="health"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="dsDec2012" object-type="user" pool-name="connectionPoolHo"/>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.apache.derby.jdbc.ClientDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="derby_net_ho_hoPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="serverName" value="localhost"/>
<property name="portNumber" value="1527"/>
<property name="databaseName" value="ho"/>
<property name="User" value="ho"/>
<property name="Password" value="ho"/>
<property name="URL" value="jdbc:derby://localhost:1527/ho"/>
<property name="driverClass" value="org.apache.derby.jdbc.ClientDriver"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="dsHo" object-type="user" pool-name="derby_net_ho_hoPool"/>
<jdbc-resource enabled="true" jndi-name="ds2013Feb" object-type="user" pool-name="connectionPoolHo"/>
<jdbc-resource enabled="true" jndi-name="drHoBuddhikaDesktop1" object-type="user" pool-name="derby_net_ho_hoPool"/>
<jdbc-resource enabled="true" jndi-name="drHoBuddhikaLaptop1" object-type="user" pool-name="connectionPoolHo"/>
<jdbc-resource enabled="true" jndi-name="dsHiLap" object-type="user" pool-name="derby_net_ho_hoPool"/>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.apache.derby.jdbc.ClientDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="derby_net_ho1_ho1Pool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="serverName" value="localhost"/>
<property name="portNumber" value="1527"/>
<property name="databaseName" value="ho1"/>
<property name="User" value="ho1"/>
<property name="Password" value="ho1"/>
<property name="URL" value="jdbc:derby://localhost:1527/ho1"/>
<property name="driverClass" value="org.apache.derby.jdbc.ClientDriver"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="dsHiLap2" object-type="user" pool-name="derby_net_ho1_ho1Pool"/>
</resources>
You need to use GlassFish deployment plan to configure different connection pool settings for your remote GlassFish server, since glassfish-resources.xml defined application-scoped resources. The application-scoped connection pool is only created during the application deployment. Please see To Deploy an Application or Module by Using a Deployment Plan. Basically your supply a remote server version of glassfish-resources.xml (following module-name.gf-dd-name naming convention) in the deploymentplan.jar.
Another option is not to use the application-scoped resource. You can define the connection pool/data source through the GlassFish Admin console.
The goal is to create a clustered environment for a web application that is currently running in a single Jetty instance. When clustering configuration is added, it appears to prevent the applications data source pool from initializing. Attaching a remote debugging session and stepping through the code shows the application hanging on startup while waiting for a connection to free up from the pool. Inspecting the details of the pool shows no connections have been created. c3p0 is used for the pooling implementation. When the server starts without the clustering configuration, c3p0 generates a log message showing it is initializing. When started with clustering configured, the log message is not seen. Leading me to believe the application data source pool is never initialized because the clustering data source pool is usurping it in some way.
To get the clustering behavior I added the following to %JETTY_HOME%/etc/jetty.xml.
<New id="DSClustering" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/DSClustering</Arg>
<Arg>
<New class="com.mchange.v2.c3p0.ComboPooledDataSource">
<Set name="driverClass">oracle.jdbc.OracleDriver</Set>
<Set name="jdbcUrl">jdbc:oracle:thin:#xxxxx:1521:xe</Set>
<Set name="User">xxxx</Set>
<Set name="Password">xxxx</Set>
</New>
</Arg>
</New>
<Set name="sessionIdManager">
<New id="jdbcidmgr" class="org.eclipse.jetty.server.session.JDBCSessionIdManager">
<Arg><Ref id="Server"/></Arg>
<Set name="workerName">jetty1</Set>
<Set name="DatasourceName">jdbc/DSClustering</Set>
<Set name="scavengeInterval">60</Set>
</New>
</Set>
<Call name="setAttribute">
<Arg>jdbcIdMgr</Arg>
<Arg><Ref id="jdbcidmgr"/></Arg>
</Call>
And added the following to the applications jetty-web.xml
<Set name="sessionHandler">
<New class="org.eclipse.jetty.server.session.SessionHandler">
<Arg>
<New class="org.eclipse.jetty.server.session.JDBCSessionManager">
<Set name="idManager">
<Ref id="jdbcidmgr"/>
</Set>
</New>
</Arg>
</New>
</Set>
The applications data source pool is configured as a Spring bean -
<bean id="sysContextAwareDataSource" class="com.mycompany.datasource.SysContextAwareDataSource">
<property name="targetDataSource" ref="myPoolDataSource"/>
<property name="connectionWaitLoggingThreshold" value="1000"/>
</bean>
<bean id="myPoolDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${jdbc.driverClassName}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="acquireIncrement" value="${jdbc.pool.acquireIncrement}"/>
<property name="minPoolSize" value="${jdbc.pool.minPoolSize}"/>
<property name="maxPoolSize" value="${jdbc.pool.maxPoolSize}"/>
<property name="initialPoolSize" value="${jdbc.pool.initialPoolSize}"/>
<property name="acquireRetryAttempts" value="${jdbc.pool.acquireRetryAttempts}"/>
<property name="testConnectionOnCheckin" value="${jdbc.pool.testConnectionOnCheckin}"/>
<property name="idleConnectionTestPeriod" value="${jdbc.pool.idleConnectionTestPeriod}"/>
<property name="preferredTestQuery" value="${jdbc.pool.preferredTestQuery}"/>
<property name="maxIdleTime" value="${jdbc.pool.maxIdleTime}"/>
<property name="acquireRetryDelay" value="${jdbc.pool.acquireRetryDelay}"/>
<property name="maxStatements" value="${jdbc.pool.maxStatements}"/>
<property name="maxStatementsPerConnection" value="${jdbc.pool.maxStatementsPerConnection}"/>
</bean>
<bean id="userDAO" class="com.mycompany.dataaccess.UserDAOImpl">
<property name="sessionFactory" ref="sessionFactory"/>
<property name="dataSource" ref="transactionAwareDataSourceProxy"/>
</bean>
Environment: jetty 8.1.9, Oracle 11g, Windows 7 Enterprise, JDK 1.6.0_38
Figured it out! This was caused because I had 2 ojdbc-10.2.0.4.0.jars that were being accessed. To get the session management DB implementation working I added an ojdbc jar to JETTY_HOME\lib\ext. This provided the Oracle classes to the Jetty server. There’s also a ojdbc jar contained in the applications lib directory, which is used by the application. The problem occurred because the ojdbc jar is a “sealed” jar. Meaning, once a class is loaded from one of the jars, an attempt to load the same class from another jar causes a security exception to be thrown. So the Jetty server would load an Oracle class from the lib/ext version of the jar. Then the application would try to load the same class from its ojdbc jar, causing the security exception. It took a while to figure out because the c3p0 class that received the exception, silently swallowed the exception and then tried to establish the connection again. This was happening on another thread then the one I was looking at. That was the thread that was establishing connections for the pool, while I was looking at the thread that was waiting for connections from the pool. Argh!