I am using WebLogic Server: 12.1.1.0, Spring 3.2.11.RELEASE and Camel 2.13.4.
I have a ConnectionFactory on my WebLogic. The JNDI name is: jms/ConnectionFactory. I used a servlet to print all JNDI names in the server and found it inside the jms subcontext.
The Spring configuration is:
<bean id="jndiFactoryBean" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jms/ConnectionFactory"/>
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="lookupOnStartup" value="false"/>
<property name="proxyInterface" value="javax.jms.ConnectionFactory"/>
</bean>
I get the error:
GRAVE: Could not refresh JMS Connection for destination 'CamelTest' -
retrying in 5000 ms. Cause: JndiObjectTargetSource failed to obtain
new target object; nested exception is
javax.naming.NameNotFoundException: While trying to look up
jms/ConnectionFactory in
/app/webapp/camelweblogic.war/1720653836.; remaining name
'jms/ConnectionFactory'
The full trace is:
Caused by: javax.naming.NameNotFoundException: While trying to lookup 'jms.ConnectionFactory' didn't find subcontext 'jms'. Resolved '' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'jms.ConnectionFactory' didn't find subcontext 'jms'. Resolved '']; remaining name 'jms/ConnectionFactory'
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:237)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:464)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:272)
at weblogic.jndi.internal.ServerNamingNode_1211_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:418)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:406)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:231)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:217)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
... 86 more
I have also already tried using the following JNDI names:
java:jms/ConnectionFactory,
java:ConnectionFactory,
ConnectionFactory,
java:comp/env/jms/ConnectionFactory
When you create the domain using WLST, what do you set the JNDI name of the connection factory to? Typically you will see something like this in your domain setup script (.py):
cf = create('ConnectionFactoryName', "ConnectionFactory")
cf.setName('ConnectionFactoryName')
cf.setJNDIName('ConnectionFactoryJNDIName')
In this case you would simply use
<bean id="jndiFactoryBean" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="ConnectionFactoryJNDIName"/>
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="lookupOnStartup" value="false"/>
<property name="proxyInterface" value="javax.jms.ConnectionFactory"/>
</bean>
in your Spring bean. If you don't have a custom name it may be of value to add one.
Related
In Spring boot application, Getting below exception when added file:nio-locker in inbound-channel-adapter
to obtain file-locking
Exception : The 'filter' and 'locker' options must be present on the provided external 'scanner'
Stack trace :
facing below error while starting the application.Cannot resolve reference to bean 'filesInChannel.adapter.source' while setting bean property 'source'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filesInChannel.adapter.source': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: The 'filter' and 'locker' options must be present on the provided external 'scanner': org.springframework.integration.file.RecursiveDirectoryScanner#358ee631
The 'filter' and 'locker' options must be present on the provided external 'scanner
<file:inbound-channel-adapter id="filesInChannel"
directory="file:${base.path}" auto-startup="false" scanner="recursiveScanner" auto-create-directory="true">
<integration:poller id="poller" max-messages-per-poll="${max.messages.per.poll}" fixed-rate="${message.read.frequency}" task-executor="pollingExecutor">
<integration:transactional transaction-manager="transactionManager" />
</integration:poller>
<file:nio-locker/>
</file:inbound-channel-adapter>
<bean id="inboundFilter" class="org.springframework.integration.file.filters.CompositeFileListFilter">
<constructor-arg>
<list>
<bean class="org.springframework.integration.file.filters.AcceptOnceFileListFilter"/>
<bean class="org.springframework.integration.file.filters.RegexPatternFileListFilter">
<constructor-arg value="${file.type}"/>
</bean>
</list>
</constructor-arg>
</bean>
<bean id="recursiveScanner" class="org.springframework.integration.file.RecursiveDirectoryScanner">
<property name="filter" ref="inboundFilter" />
</bean>
could you please suggest on this.
You do scanner="recursiveScanner" on the <file:inbound-channel-adapter>, but at the same time you use <file:nio-locker/> sub-element. That's how you violate a requirements and get that exception.
According a recommendation in the error message you need to move a NioFileLocker reference into the RecursiveDirectoryScanner bean definition instead:
<bean id="recursiveScanner" class="org.springframework.integration.file.RecursiveDirectoryScanner">
<property name="filter" ref="inboundFilter" />
<property name="locker" ref="nioLocker" />
</bean>
I am trying to implement the SimpleQueueService of AWS. I have created the Queue in US-east-2 region by the name: "tradein-tire-promotionsOrders-Alpha-USAmazon". I have mentioned in the xml also , to consider region us-east-2 like this:
<bean id="sqsEndPoint_USAmazon" class="java.lang.String">
<constructor-arg value="https://sqs.us-east-2.amazonaws.com" />
</bean>
The beans which I have created is:
<bean name="promotionsOrdersQueuePoller"
class="com.amazon.tradein.datarelocationengine.sqs.PromotionsOrdersQueuePoller"
init-method="init">
<constructor-arg ref="resourceProvider" />
<constructor-arg ref="promotionsOrdersQueueMessageHandler" />
<constructor-arg ref="promotionsOrdersQueueMessageFailureHandler" />
</bean>
<bean name="promotionsOrdersQueueMessageHandler"
class="com.amazon.tradein.datarelocationengine.sqs.PromotionsOrdersQueueMessageHandler" />
<bean name="promotionsOrdersQueueMessageFailureHandler"
class="com.amazon.tradein.datarelocationengine.sqs.PromotionsOrdersQueueMessageFailureHandler" />
Now I am still getting the error :
Error creating bean with name 'promotionsOrdersQueuePoller' defined in URL [file:/local/home/mshikher/TradeInDataRelocationService/src/TradeInDataRelocationEngine/configuration/spring-configuration/application/sqs.xml]: Invocation of init method failed; nested exception is com.amazon.tradein.datarelocationengine.exception.TerminalException: SQS message consumer start failed
Caused by: com.amazonaws.services.sqs.model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version. (Service: AmazonSQS; Status Code: 400; Error Code: AWS.SimpleQueueService.NonExistentQueue;
I have read many solutions, but there was one solution only that we need to create the queue in us-east-2 region. I have created that already so please provide me with some other solution.
I have a spring application deployed to a WebSphere 8.5.5 installation that has an issue where it occassionally starts up and fails to load the property file subsitutions. After a few restarts, it will pick up the place holder values and properly start up. When it fails to pick up the values, it results in a stack trace error similar the snippet I'll be adding to the bottom of this post.
We've contacted IBM Support, but they believe it to be a Spring Framework Placeholder Configurer issue after their investigation of our collected logs. I've also attached a snippet of our bean configuration for reference. Is this a known issue in Spring? Any help would be greatly appreciated.
STACK TRACE ERROR:
[9/29/16 9:28:57:197 CDT] 000000e0 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper init Uncaught.init.exception.thrown.by.servlet
[9/29/16 9:28:57:199 CDT] 000000e0 webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[apiWeb]: org.springframework.beans.fa
ctory.BeanDefinitionStoreException: Invalid bean definition with name 'mailSender' defined in class path resource [spring-mailsender.xml]: Could not resolve placeholder '
mailsender.host' in string value "${mailsender.host}"
at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:209)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.processProperties(PropertySourcesPlaceholderConfigurer.java:174)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:151)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:662)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1709)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:170)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:904)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:789)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:427)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1178)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1383)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:972)
at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:209)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.processProperties(PropertySourcesPlaceholderConfigurer.java:174)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:151)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:662)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1709)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:170)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:904)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:789)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:427)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1178)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1383)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
BEAN DEFINITION:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<!-- This factory bean will provide a classpath resource pointing to
environment/[env].properties, e.g. environment/dev.properties.
It will get the name of the environment from the Java system
property runtime.environment. -->
<bean class="com.czr.ocrm.integration.util.EnvPropertiesResourceFactory">
<property name="systemPropertyName" value="runtime.environment"/>
<property name="propertiesFilePrefix" value="environment/"/>
<property name="defaultEnvironment" value="dev"/>
<property name="propertiesFileSuffix" value=".properties"/>
</bean>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
<!-- This setting means any properties set using Java system properties will
override what is in the properties file. -->
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
<!-- Lowest priority so the containing app can override -->
<property name="order" value="9999"></property>
</bean>
My webapp with spring 3.2.4 is running fine. But when I start up it, I will get debug infos:
2014-05-20 11:11:47 DEBUG JndiTemplate:150 - Looking up JNDI object with name [java:comp/env/spring.liveBeansView.mbeanDomain]
2014-05-20 11:11:47 DEBUG JndiLocatorDelegate:101 - Converted JNDI name [java:comp/env/spring.liveBeansView.mbeanDomain] not found - trying original name [spring.liveBeansView.mbeanDomain]. javax.naming.NameNotFoundException: Name [spring.liveBeansView.mbeanDomain] is not bound in this Context. Unable to find [spring.liveBeansView.mbeanDomain].
2014-05-20 11:11:47 DEBUG JndiTemplate:150 - Looking up JNDI object with name [spring.liveBeansView.mbeanDomain]
2014-05-20 11:11:47 DEBUG JndiPropertySource:87 - JNDI lookup for name [spring.liveBeansView.mbeanDomain] threw NamingException with message: Name [spring.liveBeansView.mbeanDomain] is not bound in this Context. Unable to find [spring.liveBeansView.mbeanDomain].. Returning null.
2014-05-20 11:11:47 DEBUG PropertySourcesPropertyResolver:81 - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
2014-05-20 11:11:47 DEBUG PropertySourcesPropertyResolver:81 - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
2014-05-20 11:11:47 DEBUG PropertySourcesPropertyResolver:103 - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null]
2014-05-20 11:11:47 DEBUG DispatcherServlet:533 - Published WebApplicationContext of servlet 'spring' as ServletContext attribute with name [org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring]
I don't know what the infos mean. I use c3p0 as my dataSource, and the configuration is:
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>/WEB-INF/config/jdbc.properties</value>
</list>
</property>
</bean>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<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="autoCommitOnClose" value="true"/>
<property name="checkoutTimeout" value="${cpool.checkoutTimeout}"/>
<property name="initialPoolSize" value="${cpool.minPoolSize}"/>
<property name="minPoolSize" value="${cpool.minPoolSize}"/>
<property name="maxPoolSize" value="${cpool.maxPoolSize}"/>
<property name="maxIdleTime" value="${cpool.maxIdleTime}"/>
<property name="acquireIncrement" value="${cpool.acquireIncrement}"/>
<property name="maxIdleTimeExcessConnections" value="${cpool.maxIdleTimeExcessConnections}"/>
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="simpleJdbcTemplate" class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
<constructor-arg ref="jdbcTemplate" />
</bean>
I cant't find where JNDI is used in. I have search some questions about this exception. But they are always associated with #Profile or #Configuration. There is no #Profile or #Configuration in my code.
In my bean class, there is no #Bean annotation. Are the infos related to this? But I don't need spring inject my bean class.
if you don't use any profiles or mbeans, just add following context-params to the web.xml as workaround (trick), hopefully there is someone can provide better solution than this ugly one.
<context-param>
<param-name>spring.profiles.active</param-name>
<param-value>dev</param-value>
</context-param>
<context-param>
<param-name>spring.profiles.default</param-name>
<param-value>dev</param-value>
</context-param>
<context-param>
<param-name>spring.liveBeansView.mbeanDomain</param-name>
<param-value>dev</param-value>
</context-param>
This is the JIRA issue and a short explanation about why it's been introduced first time in Spring 3.2. Also, a bit more details you can find in the initial commit for this feature.
Basically, this feature it's a way to expose through JMX a live list of beans that exist in an application context from a certain application. For example, you have a webapp deployed in Tomcat and upon starting it you pass to it as an environment variable one called spring.liveBeansView.mbeanDomain. And let's say you don't give it any value, or just an empty String. Spring searches a long list of possible locations for this kind of property and it's finding it in the system environment. If it's found it will know to expose that list of live beans (in JSON format) through JMX.
If you connect with JConsole to your Tomcat instance you will see an entry called DefaultDomain and under it your application's name. If you expand that there should be an attribute called SnapshotAsJson and this is the live list of beans from your webapp's application context.
If you would have given a value to your system environment variable, let's say "test_domain", in JMX the entry would have been called test_domain and not DefaultDomain.
So, basically you are seeing those DEBUG messages because Spring searches for spring.liveBeansView.mbeanDomain property in a long list of locations, JNDI (in case of JEE servers) being one of them.
In the latest version of SpringSource Tool Suite (and maybe in some earlier ones), there is a feature that makes use of this live beans JMX exposure called "Live Beans Graph" that takes that JSON representation and creates a somewhat basic graphic representation of those beans.
I'm not experienced in Java and Spring. I try to write a program that uses JdbcTemplate for Data access. I use DBCP pooling, here it is:
<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:#192.168.2.7:1521:xe" />
<property name="username" value="manifesto" />
<property name="password" value="manifesto" />
<property name="initialSize" value="2" />
<property name="maxActive" value="4" />
</bean>
My application perform several update operations and then throws an exception:
7053 [SenderThread-0] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
Exception in thread "SenderThread-0" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
192.168.2.7:1521:xe
)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:572)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:811)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:867)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:875)
at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.update(SimpleJdbcTemplate.java:249)
at com.talutek.manifesto.dao.firestorm.dao.spring.MessageItemsTableDaoImpl.update(MessageItemsTableDaoImpl.java:52)
at com.talutek.manifesto.lib.MessageItemMngr.updateItem(MessageItemMngr.java:115)
at com.talutek.manifesto.gw.SenderThread.run(SenderThread.java:42)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
192.168.2.7:1521:xe
)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
... 9 more
Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
192.168.2.7:1521:xe
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:496)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:490)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:465)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
... 13 more
When I change pool settings(pool size), the application can run some more times but it then crashes. I think the problem is related to pooling but I couldn't solve it.
Any suggestions?
The same error occurred for me when lots of threads accessed the database simultaneously, and I had a separate DBCP BasicDataSource and a separate Spring JdbcTemplate for each thread.
By making both the BasicDataSource and the JdbcTemplate a singleton shared by all threads, I could avoid this error. This is also what SpringSource recommends.
A google search would have helped: http://www.dba-oracle.com/sf_ora_12519_tns_no_appropriate_service_handler_found.htm
Few suggestions:
Use app server pools if possible
Use c3p0 than DBCP
Use oracle.jdbc.pool.OracleDataSource