Urgent regarding connection pooling
Please can someone thorw some light on how to implement connection pooling in simple way. I have seen lots of code snippet and did lots of reading.
I need to know about how many classes i would need. and how do i use the classes.
If someone can provide code snippet then that would be great
thanks..please consider it to be urgent.
Why reinvent the wheel?
Most JDBC drivers will have connection pooling already implemented, and you just need to use it.
You should be using the interface javax.sql.DataSource
http://java.sun.com/j2se/1.5.0/docs/api/javax/sql/DataSource.html
The recommended approach in Java/JSP is to have a DataSource object accessed via JNDI.
Most servlet containers will let you define JNDI datasources to access the database connections from your app.
For instance Tomcat: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
Good luck,
evnafets
Similar Messages
-
Questions regarding Connection Pooling
Hi
i have some confusion regarding how connection pooling is implemented..i have been doing some digging in to this lately but the more i read the more confused i get. i have some doubts here, will any of the posters here kindly clear them
a. Do i have to connect to my database via the DataSource method to take advantage of the connection pooling provided by my app server?..i have read conflicting information about this suggesting that Connection Pooling will not be provided to my app if i use DriverManager.getConnection()
b. if i chose to use the DataSource method do i have to implement the ConnectionPoolDataSource interface to provide the connection pooling for my app?
c. what is the best way to implement my own custom Connection pool?
ThanxDriverManager.getConnection() literally creates, that is, builds a connection to the database using the values you previously supplied when you loaded the driver.
A connection pool is an object that contains several already made connections to the database, and simply provides you with one of those existing connections. The confusion arises because a) the method name is frequently the same and b) the connection pool object calls the driver's getConnection() method to create several connections before lending any of them out.
In other words:
DriverManager.getConnection() builds a connection to the database.
ConnectionPool.getConnection() fetches an existing connection.
So, to answer your questions...
A. This is correct. If you use DriverManager.getConnection(), you are indeed bypassing the Connection Pool entirely.
B. I'm not familiar with DataSource specifically, but in general, a third party connection pool will either give you the interface (and you implement the details) or they will give you the class file containing the DataSource object. All you would have to do in the latter case is to import that file, then create a new instance of it using the new keyword ( DataSource foo = new DataSource(); ). I suspect DataSource is indeed the class file.
C. Creating a connection pool is trivial and there are many examples of it - search on this forum or check out your favorite Java/JDBC programming book. Usually, the question "Should I use a connection pool and why?" is a more important question. -
Regarding Connection Pooling in Struts
Hi All,
I m using Struts for my web application. Now I want to use the Connection Pooling for my applicaiton.
I m using JBoss, and Oracle 10gXE.
My question are :
1. Do I need to use Oracle Specific Connection Pooling or commons DBCP & Pool.
2. Do I need to JNDI to bind my data source using mydatasource.xml in deploy folder of JBoss or
define the datasource in struts-config.xml of my application.
Which will be the efficient way?
Presently I m defining my datasource in struts-config.xml. like :
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource" key="msgds">
<set-property property="description" value="OracleXE Data Source" />
<set-property property="driverClassName" value="oracle.jdbc.OracleDriver" />
<set-property property="url" value="jdbc:oracle:thin:@192.168.1.8:1521:XE" />
<set-property property="minCount" value="2" />
<set-property property="maxCount" value="50" />
<set-property property="maxWait" value="5000" />
<set-property property="username" value="ashish" />
<set-property property="password" value="ashish" />
<set-property property="autoCommit" value="true" />
<set-property property="readOnly" value="false" />
</data-source>
</data-sources>
3. How can i change it to an mydatasource.xml for JNDI. If is it like this,what is the error:
<datasources>
<local-tx-datasource>
<jndi-name>msgds</jndi-name>
<connection-url>jdbc:oracle:thin:@192.168.1.8:1521/XE</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<user-name>ashish</user-name>
<password>ashish</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
</local-tx-datasource>
</datasources>Please if somebody have idea of it, plz help. If U have code for this plz send it to me.
If u don't want to publish you can send it to my email id: [email protected].Just make sure all the JARS are in the classpath. BTW I use Iplanet but does that matter much ? Configure the Struts-config file for the datasource by adding the below tag text.
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource" key="DBSTR">
<set-property property="description" value="OracleXE Data Source" />
<set-property property="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<set-property property="url" value="jdbc:oracle:thin:@155.136.118.169:1521:DBSID" />
<set-property property="minCount" value="2" />
<set-property property="maxCount" value="10" />
<set-property property="maxWait" value="10000" />
<set-property property="username" value="USER" />
<set-property property="password" value="PASSWORD" />
<set-property property="autoCommit" value="false" />
<set-property property="readOnly" value="false" />
</data-source>
and then access from your action or servlet by executing the below java code.
dataSource = getDataSource(request,"DBSTR");
conn = dataSource.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery("select object_name from user_objects");
while ( rs.next() ) {
tmp = tmp + ": " + rs.getString("object_name");
Piece of cake. -
Regarding connection pooling in java mail
Hi,
Im implementing enterprise application which has ability of sending/receiving emails. Im using java mail API 14.3. I have implemented the application level connection pooling which keep track of open folders, perform the time-out and other tasks. The connection pooling setting of IMAPStore is default setting. When we run our application in high load we get StoreClosedExcepton (Socket closed exception). My assumption is that when we perform some operation on folder, java mail also sends the noop command for store connection so there is no chance of store getting timeout.
Is there anything wrong in my understanding?JavaMail does not do anything to keep the connection "alive". Servers are free to close
connections that have been unused for too long (usually 30 minutes). If you need to
keep the connection alive, you'll need to do some operation periodically, such as checking
the number of messages in the folder. Even that doesn't guard against server or network
failures, of course, so you always have to be prepared for a StoreClosedException or
FolderClosedException. -
URGENT: Tomcat, Connection Pool - Issue with web.xml & server.xml
Folks,
I am trying to connect to a MS SQL database using Tomcat/JSP but having issues. The code that I am using is as follows:
Context ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/test");
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
I have added the following code to my Server.xml:
<Resource name="jdbc/test" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="DB_AW_DATA" password="tester" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
url="jdbc:microsoft:sqlserver://192.168.0.1\\Newcastle"/>
And the complete web.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE web-app (View Source for full doctype...)>
- <web-app>
- <resource-ref>
<description>Resource reference to java.sql.Connection factory defined in server.xml</description>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
The error message that I am getting is as follows:
java.sql.SQLException: Cannot load JDBC driver class 'null'
What confuses me is that I have placed the following files in Tomcat\common\lib...
mssqlserver.jar
msbase.jar
msutil.jar
I think this is purely an issue with how I configured server.xml and web.xml
In the Tomcat documentation it states to put the code in the server.xml - but nested inside the Context element. This is something that I have not done as I am clear what the Context should be..
Can someone assist...
<Context path="" docBase="ROOT" debug="0"> ???
what should be the path and the docBase.
I have deployed the following application:
http://localhost:8080/SCWAPP/index.jsp
THANKS IN ADVANCE FOR ALL SUPPORRTyou should put the code you typed in server.xml into context.xml
in the META-INF folder and this will fix your problem.
the latest tomcat docs detail what to do. -
Hi I have a few doubts regarding connection pools..
1) When an instance is in the running state do the connection pools remain open ? When are connection pools closed exactly? only when the instance gets completed/faulted/terminated or in other conditions also
2) Is there anyway to monitor the current total number connection pools open ?
Thanks in advance
Nikhil1)When an instance is in the running state do the connection pools remain open ?
Here we have to talk about the connection, connection pool holds all the connections created to the database.
When the BPEL engine wants to persist any data to the database the connection will be availed from the connection pool and will be return to the connection pool once the commit is completed.
The instance status is not related to the connection status.
2) Is there anyway to monitor the current total number connection pools open ?
You can monitor the connection details-
Login to weblogic console
Services-->DataSources-->Data source name(SOADatasource)-->Monitoring
Customize the table and add the the required columns like Active Connections Current Count.
I hope this will help u...
Regards
Albin I
http://www.albinsblog.com -
Urgent...Help Needed.1. Helper Class 2. Connection Pool
Hello,
1. There are few helper classes which has to be
shared b/w session and entity beans. But it
seems,state of the object is not transfered to entity
bean though the class has implemented Serializable
interface. I have archived all the helper class and
copied to j2ee\home\lib directory. The same jar file
is made accessible to server via updating <library-
path> in j2ee/home/config/application.xml file.
2. How can i utilise connection pooling in oc4j. In data-sources.xml, i am using
"OracleConnectionPoolDataSource" class. But i feel that connection pool is not utilised coz server hangs in the middle of the retrieval.
The value of max-connections is 50.
We are actually migrating from Weblogic 5.1.0 to Oracle 9i AS. In weblogic, we had given 10 max connections in weblogic.properties,it is working fine. But i dont understand why it is not working in 9i AS though the max-connections is 50.
Kindly let me know the solution at the earliest as it is very urgent to get the program running...
Thanx and Regards,
AchyuthHi,
hopefully I can help you.
1. There are few helper classes which has to be ...We have just the same constellation. We have put the HelperClasses in the
J2EE/home/lib dir, NOT specifying it in the application.xml. So everything works fine.
The only thing: never, again: never put these files within WEB-INF and the lib-dir.
With the HelperClasses in both we have only faced massive problems, mostly ClasCastExceptions.
We had once all the helperClasses within J2EE/home/applications/lib, but this requires to
specify this dir within the orion-application.xml within the appl dir in applications-deployment.
It also worked fine.
2. How can i utilise connection pooling in oc4j. In data-sources.xml, i am using ...I'm not sure of this, but I think, the container handles Connection Pooling, no matter what Factory you
specify. But I think, the Class hasn't to be OracleConnectionPool ... but I have to check this (right now
I have no access to our datasource.xml ..)
cu
ed -
Form Server Connection pooling - Urgent
how does form server maintains connection pooling. I have defined a single db user through which form server establishes connections with the db, and created application users at application level. The information I like to know if form server maintains certain connection pooling and allow users to get connected if user limit exceeds but responed to them with delay. if it does maintains connection pooling then please elaborate how.???
Forms doesn't do connection pooling -- each user requires a separate database connection.
> Allowing remote Internet user connect directly to the
database appears to pose a serious security/denial-of-
service risk.
So this is one of the good reasons to move the web Forms architecture.
> It doesn't seem appropriate to ask unaffiliated remote
users to know about, let alone remember database
credentials for an external database, just to enable
them to use a simple web-enabled form. Embedding the
database credentials into the form appears to pose a
more obvious security risk.
With Forms on the web, you can hide the username/password/database details from the user. That information can be stored centrally -- either with Forms itself, or with an LDAP server. The end user doesn't have to know any of the details.
We have customers running their Forms applications on the internet, and the users have no idea of the connection details to the database.
For extra security, you can use SSL. Forms on the web, though, by default uses 40 bit encryption.
Why then does Oracle Forms use this client-server
architecture? Are there any plans to migrate away from,
or provide an alternative to, this architecture in
the near future?
We do have an architecture to resolve these issues. It's called the Forms Listener Servlet Architecture and it's been available for over 2 years.
If you go to the Forms area on OTN, you can read all about it:
http://otn.oracle.com/products/forms/content.html
Regards,
Robin Zimmermann
Forms Product Management -
REgarding problem in Connection pooling of weblogic server
Hi ,
I have installed weblogic server 9 and trying to connection pooling in datasource , i am getting error to unable to load driver class: oracle.jdbc.DataSource
see below error log
####<Oct 29, 2008 4:55:34 PM IST> <Error> <Console> <cdhulipati> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <> <1225279534589> <BEA-240003> <Console encountered the following error weblogic.application.ModuleException:
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:268)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:360)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:56)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:46)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:147)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
at weblogic.deploy.internal.targetserver.operations.RedeployOperation.createAndPrepareContainer(RedeployOperation.java:98)
at weblogic.deploy.internal.targetserver.operations.RedeployOperation.doPrepare(RedeployOperation.java:118)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:718)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1185)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:215)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:157)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.prepare(DeploymentReceiverCallbackDeliverer.java:40)
at weblogic.deploy.service.internal.statemachines.targetserver.AwaitingContextUpdateCompletion.callDeploymentReceivers(AwaitingContextUpdateCompletion.java:156)
at weblogic.deploy.service.internal.statemachines.targetserver.AwaitingContextUpdateCompletion.handleContextUpdateSuccess(AwaitingContextUpdateCompletion.java:66)
at weblogic.deploy.service.internal.statemachines.targetserver.AwaitingContextUpdateCompletion.contextUpdated(AwaitingContextUpdateCompletion.java:32)
at weblogic.deploy.service.internal.targetserver.TargetDeploymentService.notifyContextUpdated(TargetDeploymentService.java:225)
at weblogic.deploy.service.internal.DeploymentService$1.run(DeploymentService.java:189)
at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: weblogic.common.resourcepool.ResourceSystemException: Cannot load driver class: oracle.jdbc.DataSource at weblogic.jdbc.common.internal.JDBCUtil.parseException(JDBCUtil.java:292)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.loadDriver(ConnectionEnvFactory.java:77)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.<init>(ConnectionEnvFactory.java:133)
at weblogic.jdbc.common.internal.ConnectionPool.initPooledResourceFactory(ConnectionPool.java:687)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:192)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1177)
at weblogic.jdbc.common.internal.ConnectionPool.start(ConnectionPool.java:184)
at weblogic.jdbc.common.internal.ConnectionPool.start(ConnectionPool.java:177)
at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:370)
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:243)
>
Please help me outchaitudnvr wrote:
Please help me outYou would probably get better help in a forum where your question was on-topic. This forum is about XML and Java and your question isn't about either of them. -
REgarding problem in Connection pooling
Hi ,
I have installed weblogic server 9 and trying to connection pooling in datasource , i am getting error to unable to load driver class: oracle.jdbc.DataSource
see below error log
####<Oct 29, 2008 4:55:34 PM IST> <Error> <Console> <cdhulipati> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <> <1225279534589> <BEA-240003> <Console encountered the following error weblogic.application.ModuleException:
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:268)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:360)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:56)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:46)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:147)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
at weblogic.deploy.internal.targetserver.operations.RedeployOperation.createAndPrepareContainer(RedeployOperation.java:98)
at weblogic.deploy.internal.targetserver.operations.RedeployOperation.doPrepare(RedeployOperation.java:118)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:718)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1185)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:215)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:157)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.prepare(DeploymentReceiverCallbackDeliverer.java:40)
at weblogic.deploy.service.internal.statemachines.targetserver.AwaitingContextUpdateCompletion.callDeploymentReceivers(AwaitingContextUpdateCompletion.java:156)
at weblogic.deploy.service.internal.statemachines.targetserver.AwaitingContextUpdateCompletion.handleContextUpdateSuccess(AwaitingContextUpdateCompletion.java:66)
at weblogic.deploy.service.internal.statemachines.targetserver.AwaitingContextUpdateCompletion.contextUpdated(AwaitingContextUpdateCompletion.java:32)
at weblogic.deploy.service.internal.targetserver.TargetDeploymentService.notifyContextUpdated(TargetDeploymentService.java:225)
at weblogic.deploy.service.internal.DeploymentService$1.run(DeploymentService.java:189)
at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: weblogic.common.resourcepool.ResourceSystemException: Cannot load driver class: oracle.jdbc.DataSource at weblogic.jdbc.common.internal.JDBCUtil.parseException(JDBCUtil.java:292)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.loadDriver(ConnectionEnvFactory.java:77)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.<init>(ConnectionEnvFactory.java:133)
at weblogic.jdbc.common.internal.ConnectionPool.initPooledResourceFactory(ConnectionPool.java:687)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:192)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1177)
at weblogic.jdbc.common.internal.ConnectionPool.start(ConnectionPool.java:184)
at weblogic.jdbc.common.internal.ConnectionPool.start(ConnectionPool.java:177)
at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:370)
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:243)
>
Please help me outI think you have your driver slightly incorrect.
Try: oracle.jdbc.OracleDriver
instead of oracle.jdbc.DataSource
Cheers,
-Adrian -
Urgent please - Error Testing connection pool
I have a connection pool and datasource working fine, but when I click at the testing hyperlink on the weblogic console/jdbc/testing, the following message apear at the Unix console.
Caused by: javax.management.MalformedObjectNameException: bad object name,property Location has multiple values in Name=hom59DataSource,Type=ApplicationRuntime,Location=cbdHom,ServerRuntime=cbdHom,Loc
ation=cbdHom,Type=JDBCDataSourceRuntime
at java.lang.Throwable.<init>(Throwable.java:57)
at java.lang.Throwable.<init>(Throwable.java:68)
at weblogic.management.WebLogicObjectName.extractProperties(WebLogicObjectName.java:571)
at weblogic.management.WebLogicObjectName.<init>(WebLogicObjectName.java:326)
at weblogic.management.WebLogicObjectName.setParentFromObjectName(WebLogicObjectName.java:934)
at weblogic.management.WebLogicObjectName.populate(WebLogicObjectName.java:851)
at weblogic.management.WebLogicObjectName.<init>(WebLogicObjectName.java:328)
at weblogic.management.WebLogicObjectName.<init>(WebLogicObjectName.java:822)
at weblogic.management.jmx.MBeanServerInvocationHandler.getWebLogicObjectName(MBeanServerInvocationHandler.java:80)
Somebody please could help me?
Message was edited by:
DenimarHave figured this out. Need to set the "Test Connections" settings under Configurations
(Advanced Options) for the Connection Pool.
Thanks for your help :)
Joe Weinstein <[email protected]> wrote:
Everbright wrote:
Hi,
I've just started working on the Avitek Tutorials.
Encountered the following error message when testing the connectionpools for
both the XA and non-XA connections.
Warning! Connectivity to backend database not verified. This is eitherbecause
required connection pool attributes "TestConnectionsOnReserve" or "TestConnectionsOnRelease"
have not been enabled, or an invalid value has been specified for attribute"TestTableName".
Please check the server log for more details..
Any ideas what might be wrong?It is likely that some part of the information you specified about how
to connect to
your database was incorrect, so weblogic was unable to make a pool of
connections.
We will know more if you show us the server log file, which will contain
messages
about any errors it suffered during startup...
Joe
Thanks! -
Regarding the connection pool Error
Hi All,
I am using weblogic10.3. While starting the server we are able to see the below exceptions in the logs which was causing the server to failed state ,even we resume the
server,the server will come to running state but the instance will not be there in the connection pool monitoring tab .once we restart the server again,its working.
can you please let me know why we are getting these errors and any help to remove these.
####<Apr 14, 2010 6:29:29 AM CDT> <Error> <Server-name> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS
Kernel>> <> <> <1271244569352> <BEA-149205> <Failed to initialize the application 'dsname' due to error weblogic.application.ModuleException: .
weblogic.application.ModuleException:
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:289)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:16)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
at weblogic.deploy.internal.targetserver.SystemResourceDeployment.prepare(SystemResourceDeployment.java:55)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:39)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:187)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
weblogic.common.ResourceException: weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: Io exception: The Network Adapter
could not establish the connection
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:253)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1109)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1033)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:214)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1051)
at weblogic.jdbc.common.internal.ConnectionPool.start(ConnectionPool.java:146)
at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:385)
at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:326)
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:251)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:16)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
at weblogic.deploy.internal.targetserver.SystemResourceDeployment.prepare(SystemResourceDeployment.java:55)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:39)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:187)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)Hi,
Looks like the Database URL may not be correct or may be the TNS name OR some n/w issue between WLS BOX and the DB Box. Please try the following to Double Check it.
<font color=red><b>Test Number-1</b></font><BR>
<font color=maroon><b>Step1).</b></font> Add JDBC Driver also in the Classpath or Better run *"setWLSEnv.sh"*
<font color=maroon><b>Step2).</b></font> Use WLS DB Ping utility:
Syntax:
java -classpath /bea103/wl_server103/server/lib/weblogic.jar utils.dbping ORACLE_THIN <dbUserName> <dbPasswoes> <dbURL>
Example:
java -classpath /bea103/wl_server103/server/lib/weblogic.jar utils.dbping ORACLE_THIN scott tiger databaseHostName:1521:P15215h
<font color=red><b>Test Number-2</b></font>
Please run the Following Program from your WLS Server Box:
import java.sql.*;
public class TestConnection
public static void main(String ar[]) throws Exception
System.out.println("\n\t Database URL: "+ar[0]);
System.out.println("\n\t Database UserName: "+ar[1]);
System.out.println("\n\t Database Password: "+ar[2]);
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("\n\t Driver Class Registered and Loaded Successfully...");
System.out.println("\n\n\n\t Trying to Connect to Database....");
Connection con=DriverManager.getConnection(ar[0],ar[1],ar[2]);
System.out.println("\n\n\n\t CONNECTED TO DATABASE SUCCESSFULLY");
To RUN:
java -classpath /opt/app/yourOracelDriverLocation/ojdbc6.jar:.: TestConnection oracelJdbcURL Oracleusername Oraclepassword
if above fails to connect to DataBase ...it simply means Connectivity issue with your database friom the WebLogic Box.
Thanks
Jay SenSharma -
hi all,
I am new to jndi concet.I am trying to do connection pooling in tomcat 5.0.28.
I have searched google a lot but not been able to succeed in this.
I have created the datasource (ccmtest) from tomcat Administration.So it will automatically writes<resource></resourceparams> info in server.xml.
I manually written <resource-ref> in web.xml
I am trying to access the pool from java class.and i have written the following code
Properties p=new roperties(); p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.commons.dbcp.BasicDataSourceFactory");
p.put(Context.PROVIDER_URL,"http://localhost:8080");
Context context = new InitialContext(p);
DataSource ds=(DataSource)context.lookup("java:/comp/env/jdbc/ccmtest");
Connection conn = ds.getConnection();
but i am getting the following error:
javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.com mons.dbcp.BasicDataSourceFactory [Root exception is java.lang.ClassCastException]
First i didn't placed the code like p.put(Context.INITIAL_CONTEXT_FACTORY,.........but when i didn't place the code i got the error:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
I have placed the commonsdbcp.jar,commonspool.jar,commonscollections.jar in classpath.
Plz help me
Advance thanks.hi aniseed
First of all thanks for the solution.
i have read that documentation several times.and done the same thing what ever documented in that page u have given but still get the error:
javax.naming.NoInitialContextException: Cannot instantiate class: com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory [Root exception is java.lang.ClassCastException] -
Urgent help (on oracle connection pool)
Hi ,
I downloade oracle 8i thin drivers and i am using conenction pool in my application ...
I executed that servlet program
When i try to get conneciton using getDatabaseConnection() method in my jsp i am getting new connection each time ...............
In the oracel doc i read some thing like logical connections and physical connections .............
In my code i set maxLimit to 3 and i am getting connections more than 3 ( all are different).................
When i refresh the browser i am getting different connections like:
con======oracle.jdbc.driver.OracleConnection@338576
con======oracle.jdbc.driver.OracleConnection@1691dec
con======oracle.jdbc.driver.OracleConnection@63ceb4
con======oracle.jdbc.driver.OracleConnection@1590f50
con======oracle.jdbc.driver.OracleConnection@aeff82
con======oracle.jdbc.driver.OracleConnection@906e5b
con======oracle.jdbc.driver.OracleConnection@2403cf
con======oracle.jdbc.driver.OracleConnection@17ab157
See i set max limit as 3 and i got more than 3 connections and each diff ................
What is wrong in my code ............
Please help to me ..........
Here is the code :
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.sql.*;
import oracle.jdbc.driver.*;
import oracle.jdbc.pool.*;
public class PoolJdbc4 extends HttpServlet{
private OracleConnectionPoolDataSource ocpds;
private OracleConnectionCacheImpl ods;
public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
ocpds =new OracleConnectionPoolDataSource();
ocpds.setURL("jdbc:oracle:xxxxxxxxx");
// ocpds.setUser("xxx");
// ocpds.setPassword("xxx");
// Associate it with the Cache
ods = new OracleConnectionCacheImpl(ocpds);
// Set the Max Limit
ods.setMaxLimit (3);
// Set the Scheme
ods.setCacheScheme (OracleConnectionCacheImpl.FIXED_RETURN_NULL_SCHEME);
catch (Exception e) {
throw new UnavailableException(this, "Couldn't create connection pool");
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
Connection con = null;
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
out.println("Updating salary");
try {
con = ods.getConnection("xxxxx","xxx");
System.out.println("con======="+con);
// Turn on transactions
con.setAutoCommit(false);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from checkout_checkin");
while(rs.next())
out.println(rs.getString(1)+"<br>");
stmt.close();
rs.close();
con.close();
catch (Exception e) {
// Any error is grounds for rollback
try {
con.rollback();
catch (Exception ignored) { }
out.println("No more connections available, try later");
}ketan reddy - I'm pretty sure you are not getting a new connection each time even though you are seeing a different connection identifier printed each time you get a new connection.
If you have system privs, try looking at v$session while your servlet is running. I think you will see that you only have a single connection and it is being used each time.
For another test, try commenting out your conn.close() call so that you do not free up connections. Your servlet should fail after 3 executions cause it will not be able to get any more connections - because you specified
ods.setMaxLimit (3);
ods.setCacheScheme (OracleConnectionCacheImpl.FIXED_RETURN_NULL_SCHEME);
Good Luck
tim -
Connection pooling issue, urgent
Hi,
Our asp.net web application use sAP .net connector to make RFC call to sap CRM system. recently, I am trying to utilizing connection pooling, but assigning connection obtained from pool to proxy class , I did exactly the online help docs says, but, i got some very disappointment result, it cause iis worker process memory write proctection error. and very time, I reboot my machine, the problem does not go away, my O.S tells me that "Data Execution proctection" warning comes up and afterwords, iis worker process and etc, I am not sure what I did wrong, any body experience similar problem,
after I uninstall .net connection, and I reboot my machine
, this error went away. Please help.
following is my configuration settings:
<SAP>
<Connector>
<ConnectionPool
MaxOpenConnections="20"
MaxCapacity="20"
MaxIdleTime="10"
CleanupInterval="10" />
<Destinations Default="cd1">
<Entry
DestinationName="cd1"
AppServerHost="ASHOST=sapcrd01.bentley.com"
SystemNumber="00"
Username="ASPRFC"
Password="bentley"
Client="100"/>
</Destinations>
</Connector>
</SAP>
following line of code is from myproxy constructor
this.oCommonProxy.Connection=SAP.Connector.Connection.GetConnectionFromPool(GetConnectStringForUser(this.sRfcUser,this.sRfcPass));
public void CloseConnection()
SAP.Connector.Connection.ReturnConnection(this.oCommonProxy.Connection);
Message was edited by: Yuwen Li
Message was edited by: Yuwen LiHm, sounds strange. Can you try to attach a debugger with both, managed and unmanged mode, turn on "first chance exception handling" for all exception types and check the call stack when the exception happens?
Maybe you are looking for
-
If I chose the wrong folder as defaulf for downloads to go to, how can I change it?
I use download manager. I hit '''yes''' when asked if I wanted to make the folder shown as the default for future downloads of that type. I did not mean to do that. How can I change the default folder?
-
How do I post a Comment?
QuestionHow do I post a Comment? AnswerMany users have requested a way to give Comments to multiple Friends at once, and now you can! There are a couple different ways to post Comments to all your Tagged Friends, and it's even easier with our new mul
-
My icloud used to have my phone number as an option to send messages from but now it is gone and only my e-mail address is there. This never happened prior to downloading the ios 7 update.
-
How to assign ALV for parent node and child node that uses supply method.?
HI Dear friends, I need to display header details ( VBAK ) and Item details ( VBAP ). I have created two node like HEADER_NODE inside this i have created ITEM_NODE for this item node i use supply function 'GET_ITEMS' any way it is working only w
-
HI all, I have BI services installed. I can log into oracle weblogic admin consol and see that EM service is Active. However Health status does not say anything. But I cannot get into Oracle EM. When I log in it looks like its opening up for a split