Creating connection pool on Sun Application Server 8.1
Hi All,
I am trying to create a connection pool for my MySql database on Sun Application Server(Version 8.1) using 'asadmin'. I am also able to create the connection pool successfully but when i am trying to ping the connection pool, it is giving me the java.net.UnknownHostException. The command I am using for creating the connection pool is as follows:
create-jdbc-connection-pool user admin password adminadmin host localhost port 4849 datasourceclassname com.mysql.jdbc.jdbc2.optional.MySqlConnectionPoolDataSource restype javax.sql.XADatasource --property User=root:Password=admin:SelectMethod=Cursor:DatabaseName=testdb:serverName=\"localhost\":portNumber=3306 MyConnectionPool
My database and the application server are running on the same machine.
Has anyone come across such a problem? Any help would be highly appriciated.
Thanks in Advance,
Anurag.
hi Anurag,
Check the properties in the jdbc-connection-pool tag and make sure that the values are populated correctly. You can also try specifying the actual hostname or IP address of the machine instead of localhost and see if that works.
Cheers,
Vasanth
Similar Messages
-
Replace Quotes, Connection Pooling, and Sun Web Server with MySQL, Oracle
This is code I use to insert data into my MySQL and Oracle databases.
I takes care of quotes and shows use of context, i.e. when you use Sun Web Server's
ConnectionPooling. This code works. Feel free to reply if you have questions on how to set up connection pooling using Sun Web Server 6.1SP - it took quite a long time to learn and I couldn't find much information throughout the web, so I hope this helps...
This is not a question and I am not looking for an answer, but please post comments or suggestions.
dailysun
This is in one class where I have a hashtable containing the
column name / value pairs that I want to enter into my table.
This class simply creates the SQL string from the values in the
hashtable. It then passes that hashtable including the database
name to a class which executes that sql statement (second code
portion).
/* Insert data into sf_parts. Create the column strings from
* the provided hash table. Be sure to parse out hash elements which
* are used for the createTemplate process
StringBuffer values = new StringBuffer();
StringBuffer fields = new StringBuffer();
Enumeration keys = fieldHash.keys();
while(keys.hasMoreElements()){
Object currentKey = keys.nextElement();
String fieldValue = (String) fieldHash.get(currentKey);
if(values.length() >0){
values.append(",");
values.append("'"+fieldValue.replaceAll("'","''")+"'"); // Takes care of quotes and various other special characters!
if(fields.length() >0){
fields.append(",");
fields.append(currentKey);
sql = "INSERT INTO myTable (" + fields.toString() + ") VALUES (" + values.toString() + ");";
String insertResult = caq.getInsertDelete(sql,"myDatabaseName"); // your database name is defined in web.xml and sun-web.xml when you use Sun Web Server's Connection Pooling.
returnValue += "<br><br><b>Rows inserted into table(myTable): </b>" + insertResult + "<br>\n";
And, like I describe above, this method executes the sql statement.
* Takes care of insert, update and delete requests.
* Must have set both dbName as well as the sql String.
* Will return number of rows affected as String.
* @return String Number of rows affected
* @exception SQLException
* @exception Exception
public String getInsertDelete() {
checkData(); // this simply checks if the variables dbName and sql are not empty ;-)
InitialContext initContext = null;
int rv = 0;
try{
// Get connection from configured pool
initContext = new InitialContext();
source = (DataSource) initContext.lookup("java:comp/env/jdbc/" + dbName); // I have this set up in web.xml and sun-web.xml (I use Sun Web Server 6.1SP which does connection pooling for me)
conn = source.getConnection();
if(conn != null){
stmt = conn.createStatement();
rv = stmt.executeUpdate(sql);
}catch (SQLException e){
// do something
}catch (Exception e){
// do something
}finally{
try{
stmt.close();
}catch(Exception e){
// do something
try{
conn.close();
}catch(Exception e){
// do something
try{
initContext.close();
}catch(Exception e){
// do something
return rv+"";
}This is code I use to insert data into my MySQL and
Oracle databases.
I takes care of quotes and shows use of context, i.e.
when you use Sun Web Server's
ConnectionPooling. This code works. Feel free to
reply if you have questions on how to set up
connection pooling using Sun Web Server 6.1SP - it
took quite a long time to learn and I couldn't find
much information throughout the web, so I hope this
helps...
This is not a question and I am not looking for an
answer, but please post comments or suggestions.Using prepared statements would mean that you wouldn't have to worry about quotes.
You should be closing the result set.
You are handling all fields as strings. That won't work with time fields and might not work for numeric fields.
Presumably most of your variables are member variables. They should be local variables because that is the scope of the usage.
You must do something with the exceptions.
Hashtables although convienent mean that problems with usage can only be resolved at run time rather than compile time. -
Cant create connection Pool for MS SQL Server 2000 with Microsoft Driver
i am using bea weblogic server 6.1, i cant create connection pool while using MS
SQL Server 2000. i have installed JDBC Driver SAP1 from microsoft website. when
i give the following class name for JDBC driver and the connection url and click
apply while selecting the available server, a number of exception appears in default
server (that is the connection pool cannot be created..... cannot load the driver
class).
URL= jdbc:Microsoft:sqlserver://127.0.0.1:1433;DatabaseName=MyDB
Driver= com.microsoft.jdbc.sqlserver.SQLServerDriver
when i use the above setting in a JDBC simple application in Jbuilder
7.0 the application runs successfully and fetches the data deom MS SQL database
but in at Bea connection Pool is not created with these settings. i do give appropriate
username and password in properties field in connection pool. Thankx for any help!khabbab wrote:
That was the original code part from "startweblogic" :
:runWebLogic
echo on
set PATH=.\bin;%PATH%
set CLASSPATH=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;
echo off
and i changed it to :
:runWebLogic
echo on
set PATH=.\bin;%PATH%
set CLASSPATH=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;D:\Program Files\Microsoft
SQL Server 2000 Driver for JDBC\lib\msbase.jar;D:\Program Files\Microsoft SQL
Server 2000 Driver for JDBC\lib\msutil.jar;D:\Program Files\Microsoft SQL Server
2000 Driver for JDBC\lib\mssqlserver.jar;I suggest moving or copying the three ms driver jars to a directory that has no blanks
in it so the classpath doesn't have blanks in it. Ie:
go to the "D:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib"
directory and do this:
mkdir D:\microsoft_jdbc_driver
cp *.jar D:\microsoft_jdbc_driver
Then make the classpath include D:\microsoft_jdbc_driver\msbase.jar etc.
Joe
>
>
echo off
when i save and run the bat file, server appears then disappears.
Joseph Weinstein <[email protected]_this> wrote:
khabbab wrote:
The class path which is echoed at server startup does not include thepaths to
driver jar files. when i edited the "startweblogic.bat" file and includedthe
driver class paths to jar files, now the server doesnot even run. tellme what
to do now???Show me what change you made to the startweblogic file.
Joe
Joseph Weinstein <[email protected]_this> wrote:
khabbab wrote:
kindly tell me how can i check that the class paths for driver jarfiles are included
in that string? thanks. also tell me can not i use the jdriver forsql server
2000?.The startup script will echo what it's doing, including printing out
the classpath
it will use. Yes you can use the jDriver for MS SQL2000. It is sufficient
for
basic JDBC, but the MS drivfer is preferable in some ways.
Joe
Joseph Weinstein <[email protected]_this> wrote:
khabbab wrote:
i am using bea weblogic server 6.1, i cant create connection
pool
while
using MS
SQL Server 2000. i have installed JDBC Driver SAP1 from microsoft
website.
when
i give the following class name for JDBC driver and the connectionurl and click
apply while selecting the available server, a number of exception
appears
in default
server (that is the connection pool cannot be created..... cannot
load
the driver
class).The server startup script creates a string that will become the
classpath
for the server.
This string is part of the java call to start the server with a-classpath
argument. You need to
make sure the MS driver jars are part of that classpath string.
Joe
URL= jdbc:Microsoft:sqlserver://127.0.0.1:1433;DatabaseName=MyDB
Driver= com.microsoft.jdbc.sqlserver.SQLServerDriver
when i use the above setting in a JDBC simple applicationin Jbuilder
7.0 the application runs successfully and fetches the data deom
MS
SQL database
but in at Bea connection Pool is not created with these settings.
i
do give appropriate
username and password in properties field in connection pool.
Thankx
for any help!
khabbab wrote:
The class path which is echoed at server startup does not include thepaths to
driver jar files. when i edited the "startweblogic.bat" file and includedthe
driver class paths to jar files, now the server doesnot even run. tellme what
to do now???
Joseph Weinstein <[email protected]_this> wrote:
khabbab wrote:
kindly tell me how can i check that the class paths for driver jarfiles are included
in that string? thanks. also tell me can not i use the jdriver forsql server
2000?.The startup script will echo what it's doing, including printing out
the classpath
it will use. Yes you can use the jDriver for MS SQL2000. It is sufficient
for
basic JDBC, but the MS drivfer is preferable in some ways.
Joe
Joseph Weinstein <[email protected]_this> wrote:
khabbab wrote:
i am using bea weblogic server 6.1, i cant create connection
pool
while
using MS
SQL Server 2000. i have installed JDBC Driver SAP1 from microsoft
website.
when
i give the following class name for JDBC driver and the connectionurl and click
apply while selecting the available server, a number of exception
appears
in default
server (that is the connection pool cannot be created..... cannot
load
the driver
class).The server startup script creates a string that will become the
classpath
for the server.
This string is part of the java call to start the server with a-classpath
argument. You need to
make sure the MS driver jars are part of that classpath string.
Joe
URL= jdbc:Microsoft:sqlserver://127.0.0.1:1433;DatabaseName=MyDB
Driver= com.microsoft.jdbc.sqlserver.SQLServerDriver
when i use the above setting in a JDBC simple applicationin Jbuilder
7.0 the application runs successfully and fetches the data deom
MS
SQL database
but in at Bea connection Pool is not created with these settings.
i
do give appropriate
username and password in properties field in connection pool.
Thankx
for any help! -
Help with connection pool at system application server admin console 9.0
Hi,
I am trying to create a pool of oracle connections in system application server admin console, but when I ping to the server, it shows me the error: invalid oracle URL: OracleDataSource.makeURL.
I have the jar file of the driver referenced in the classpath suffix field of the path settings.
I have added all kind of combinations of additional properties, like
serverName: 172.16.9.162
databaseName: oradex07
portNumber: 1521
username: usr
password: pwd
or
url: jdbc:oracle:thin:@172.16.9.162:1521:oradex07
but it still showing me the same errorHey, I use this code to lookup session bean deployed in glassfish.
Based on the glassfish EJB FAQ.
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext initialContext = new InitialContext(props);
SessionBean bean = initialContext.lookup(ejbName);Cheers. -
Setting up Connection Pool in sun app server 8.1 with SQL server 2000
Hello,
I am trying to set up a connection pool & data source for SQL server 2000 (MSDE 2000).
Here is what I attempted to do:
I have a pool data source in a jar file called poll.jar and I copied it to C:\sun\Appserver\lib (Install dir\lib)
com.microsoft.mspool.PoolDataSource is the pool data source class.
In the Admin console, JDBC>Connection pools. Selected NEW and made the following entries.
GENERAL SETTINGS
Name: MsPool
Datasource class name : com.microsoft.mspool.PoolDataSource
Resource type: javax.sql.DataSource
POOL SETTINGS: default values
CONNECTION VALIDATION: default values
TRANSACTION ISOLATION: default values
PROPERTIES:
DataSourceName:PoolDataSource
NetworkProtocol:tcp
DatabaseName: myDB
Password:User specific
user:User specific
server: localhost
PortNumber:1433
I get the following error when I ping:
Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target exception message: Class name is wrong or classpath is not set for : com.microsoft.mspool.PoolDataSource.
Can any one help me if have a solution?
Thanks in advance.
magYou need to copy your jar to ${AS_INSTALL}/domains/domain1/lib/ext (replace domain1 by your
domain). Another option is to leave the jar in ${AS_INSTALL}/lib and add a entry in the classpath-suffix element of your domain.xml.
thanks,
:aditya -
Error Creating Connection Pool for Microsoft SQL Server
I am trying to create a connection pool that connects to a MS SQl Server but it keeps giving me an error
Unable to create : com.microsoft.sqlserver.jdbc.SQLServerDriver
Missing class: com.microsoft.sqlserver.jdbc.SQLServerDriver Dependent class: oracle.oc4j.sql.config.DataSourceConfigUtils Loader: oc4j:10.1.3 Code-Source: /D:/jdevstudiobase1013/j2ee/home/lib/oc4j-internal.jar Configuration: in META-INF/boot.xml in D:\jdevstudiobase1013\j2ee\home\oc4j.jar This load was initiated at system.root:0.0.0 using the Class.forName() method. The missing class is not available from any code-source or loader in the system.
I have added the Microsoft Jar to the D:/jdevstudiobase1013/j2ee/home/lib/ and also to D:/jdevstudiobase1013/j2ee/home/. Please any suggestion would be welcomeI am trying to create a connection pool that connects to a MS SQl Server but it keeps giving me an error
Unable to create : com.microsoft.sqlserver.jdbc.SQLServerDriver
Missing class: com.microsoft.sqlserver.jdbc.SQLServerDriver Dependent class: oracle.oc4j.sql.config.DataSourceConfigUtils Loader: oc4j:10.1.3 Code-Source: /D:/jdevstudiobase1013/j2ee/home/lib/oc4j-internal.jar Configuration: in META-INF/boot.xml in D:\jdevstudiobase1013\j2ee\home\oc4j.jar This load was initiated at system.root:0.0.0 using the Class.forName() method. The missing class is not available from any code-source or loader in the system.
I have added the Microsoft Jar to the D:/jdevstudiobase1013/j2ee/home/lib/ and also to D:/jdevstudiobase1013/j2ee/home/. Please any suggestion would be welcome -
Error Message while creating connection pool
Hi all,
I got the following error message while creating connection pool for the
SQL Server thru the Application Server Admin Console.
The message is,
An error has occured.
Operation 'create.Jdbc.ConnectionPool' failed in 'resources' Config Mbean. Target exception message :
JdbcConnectionPool Already Exists: cannot add duplicate.
But the connection pool for the SQL Server was not there in the list.
What may be the possible reason for this error.
i was trying to deploy a BMP entiy bean using the Sun Application Server.
Prior deploying i just tried to create connection pool and test the connection using the Admin Console
Please help me by providing a solution.Kriti Sundar Mazumder wrote:
Hi
I am getting an following error message, while creating database connection pool
in weblogic 7.
"<Jun 18, 2004 4:52:36 AM CDT> <Error> <JDBC> <001060> <Cannot startup connection
pool "MyJDBCConnectionPool" java.sql.SQLException: [IBM][JDBC Driver] CLI0647E
Error allocating DB2 environment handle, rc=-1.>"
Can anyone help me out in this regard
Regards
KritiHi. I am no expert, but it sounds like a problem with the privileges the user
has... The best thing is to step back to a simpler environment. Can you try
connecting to DB2 with a simple program like utils.dbping? Please look at our
driver docs for the DB2 driver, because there are several variations in connect
properties depending on the type of DB2 you are connecting to...
Joe -
Hi all
I am working on some RFID-related project. I need to capture, fiter and then perform some other tasks on the data sensed by RFID readers, all in Java. So I choose Sun's software. There was no luck when I was trying to configure my system to work with Sun's software. Hope you experienced could do me a favor and help me out. Thanks in advance. Here are details.
In the installation guide of Sun Java System RFID Software 3.0, it says, to install RFID information server, Sun Java System Application Server Platform Edition 8.1 2005Q2 UR2 and PostgreSQL 8.0.4 are needed.
For the following 2 reasons:
1 PostgreSQL 8.0.4 is now not available to download on www.postgresql.org;
2 I think later version of PostgreSQL or Sun Application Server should be compatible to their earlier versions
I tried the following combination other than those stated in the installation guide:
1 PostgreSQL 8.3;
2 Sun Java System Application Server 9.1_02, bound with Sun Java Application Platform SDK Update 5;
3 Sun Java System RFID Software 3.0
Then, the application server successfully communicates with PostgreSQL, demonstrated by "ping success" through the connection pool built in application server's admin console.
The RFID information server communicates successfully with PostgreSQL, demonstrated by deploying RFID information server database successfully in PostgreSQL.
But, instructed by the installation guide, when I tried to validate my RFID information server installation by typing "http://localhost:8080/epcis" in the browser, the application server reported "the resource is not available".
I looked into many other internet resources and instructions about this, but no luck at all. I am now really, really stuck. Hope you could do me this favor. Thanks.
PS:
1 PostgreSQL8.3 is available on http://www.postgresql.org/download/
2 Sun Java System Application Server is available on http://java.sun.com/javaee/downloads/index.jsp
3 Sun Java System RFID Software and the installation guide are available on https://sun-rfid.dev.java.net/SJS_RFID_Software.html
4 Operation System is Windows XPWould be a great idea to open-source the Sun RFID project, since the project is inactive over the last tree years.
Seems that this project have a great architecture, but the techonolgy is outdated ...
We have another open source initiave (google for Aspire RFID), but seems that this project still imature ...
Comercial options includes ALE Server, and Sendra Solutions (but I didn't evaluated these)
Mario Prado-Brazil -
How to make a connection pools to oracle 10g in sun application server 8
env:
windows xp.
sun application server 8
oracle 10g in windows xp .
I do this
1: copy the oracle jdbc ojdbc14.jar orai18n.jar file to sun/appserver/lib
2. add path in admin console
3. restart the server
4. make a connnect pools with resource type javax.sql.DataSource
5.add properties with password,username ,database name= jdbc:oracle:thin:@127.0.0.1:1521:orcl ,(with this url ,my jdbc program can connect oracle10).
6 .try the ping , it show Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target exception message: Connection could not be allocated because: 指定了无效的(direct to unusale) Oracle URL: OracleDataSource.makeURL
please replay to me ,thank very much.I change the thin driver to oci driver ,jdbc:oracle:oci:@orcl ,then fix the problem.
-
Sun Application Server 8.1 remote deplyment database connection
I use the deploy to Remote server to deply a project to Sun Application Server 8.1. When i try to connect to the database I get connection error
javax.servlet.ServletException: javax.faces.FacesException: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Access denied for user ''@'testserver.com' (using password: YES)
it seems it doesnt pick the User from the Connection pull settings. The settings at the server seem correct.
This works fine when i deply to Application server 8.0 that comes with the Sun creatorThe user is correct and it does work from 8.0/
The server doesnt pick the username from the
configuration
the error message says use '' emptyWhat "configuration" are you referring to? Do you mean the way that you have the 8.1 server set up?
Since you cannot ping, then there is something wrong with the configuration on the 8.1 server.
Why don't you remove the connection pool and start over from scratch and cut/paste the settings from the 8.0 app server over. Then make sure you can ping once everything is set up.
Also, where is the 8.1 box located? Are you sure it has access to the database that you are trying to reach?
You might try posting this to the App Server forum as it really isn't a Creator problem. -
How to create the deployment descriptor with the sun application server
I have packaged my .war and ejb-jar files. I go to autodeploy and it says i need a deployment descriptor?
this is actually an example .ear file that i am trying to run. When i create the client with the deploytool that comes with suns application server i get
C:\appclient>appclient -client swe645-appClient.jar
Caught an unexpected exception!
javax.naming.NameNotFoundException: EditEmpBean not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.
java:185)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.ja
va:157)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialCont
extProviderImpl.java:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(Reflecti
veTie.java:123)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispa
tchToServant(CorbaServerRequestDispatcherImpl.java:648)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispa
tch(CorbaServerRequestDispatcherImpl.java:192)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
Request(CorbaMessageMediatorImpl.java:1709)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
(CorbaMessageMediatorImpl.java:1569)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(C
orbaMessageMediatorImpl.java:951)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.call
back(RequestMessage_1_2.java:181)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
(CorbaMessageMediatorImpl.java:721)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatc
h(SocketOrChannelConnectionImpl.java:473)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(
SocketOrChannelConnectionImpl.java:1262)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.
run(ThreadPoolImpl.java:409) -
Problem with creating Connection pool and JNDI, driver is not detected
Hi,
I have an issue with creating Connection Pool and JNDI.
I'm using:
- JDK 1.6
- OS: Linux(ubuntu 8.10)
- Netbeans IDE 6.5.1
- Java EE 5.0
- Apache Tomcat 6.0.18 Its lib directory contains all necessary jar files for Oracle database driver
- Oracle 11g Enterprise
My problem is that the Oracle database driver is not detected when I want to create a pool (it works pretty well and is detected without any problem when I create ordinary connection by DriverManager)
Therefore after running:
InitialContext ic = new InitialContext();
Context context = (Context)ic.lookup("java:comp/env");
DataSource dataSource = (DataSource)context.lookup("jdbc/oracle11g");
Connection connection = dataSource.getConnection();and right after dataSource.getConnection() I have the following exception:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at servlets.Servlet1.doPost(Servlet1.java:47)
at servlets.Servlet1.doGet(Servlet1.java:29)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)
... 17 more
My application context file (context.xml) is:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/WebApplication3">
<Resource auth="Container"
driverClassName="oracle.jdbc.OracleDriver"
maxActive="8"
maxIdle="4"
name="jdbc/oracle11g"
username="scott"
password="tiger"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@localhost:1521:database01" />
</Context>and my web.xml is:
<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/oracle11g</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
...I found similar threads in different forums including sun, such as
http://forums.sun.com/thread.jspa?threadID=567630&start=0&tstart=0
http://forums.sun.com/thread.jspa?threadID=639243&tstart=0
http://forums.sun.com/thread.jspa?threadID=5312178&tstart=0
, but no solution.
As many suggest, I also tried to put context directly in the server.xml (instead of my application context) and referencing it by <ResourceLink /> inside my application context but it didn't work and instead it gave me the following message:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class ' ' for connect URL 'null'
Has anyone succeeded in creating a connection pool with JNDI by using Tomcat 6 or higher ? If yes, could kindly explain about the applied method.
Regards,Hello again,
Finally I managed to run my application also with Tomcat 6.0.18. There was only two lines that had to be modified
in the context.xml file (the context of my application project and not server's)
Instead of writing
<Context antiJARLocking="true" path="/WebApplication2">
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
</Context>we had to write:
<Context antiJARLocking="true" path="/WebApplication2">
type="oracle.jdbc.pool.OracleDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
</Context>- No modification was needed to be done at server level (niether server.xml nor server context.xml)
- I just added the ojdbc6.jar in $CATALINA_HOME/lib (I didn't even need to add it in WEB-INF/lib of my project)
- The servlet used to do the test was the same that I presented in my precedent post.
For those who have encountered my problem and are interested in the format of the web.xml and context.xml
with Tomcat 6.0, you can find them below:
Oracle server: Oracle 11g Enterprise
Tomcat server version: 6.0.18
Oracle driver: ojdbc.jar
IDE: Netbeans 6.5.1
The context.xml file of the web application
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/WebApplication2">
<Resource name="jdbc/oracle11g"
type="oracle.jdbc.pool.OracleDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbc:oracle:thin:@localhost:1521:database01"
driverClassName="oracle.jdbc.OracleDriver"
userName="scott"
password="tiger"
auth="Container"
maxActive="100"
maxIdle="30"
maxWait="10000"
logAbandoned="true"
removeAbandoned="true"
removeAbandonedTimeout="60" />
</Context>The web.xml of my web application
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<resource-ref>
<description>Oracle Database 11g DataSource</description>
<res-type>oracle.jdbc.pool.OracleDataSource</res-type>
<res-auth>Container</res-auth>
<res-ref-name>jdbc/oracle11g</res-ref-name>
</resource-ref>
<servlet>
<servlet-name>Servlet1</servlet-name>
<servlet-class>servlets.Servlet1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Servlet1</servlet-name>
<url-pattern>/Servlet1</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>Ok, now I'm happy as the original problem is completely solved
Regards -
How dynamically create connection pool and Datasource
Hi
How I can dynamically create a connection pool and Data source in Oracle 10g Application server. In our J2EE application the user will be login with db user name, password and database name. I want to create connection pool and data source on the fly while login the user with database name. I our application we have access approximate 80 Databases. so my approach is given bellow
1) Planning to create 80 connection pools and 80 Data sources so when user logs in while selecting the db name i will call the appropriate data source and create the DB connection. Is there any limitation to create number of data sources in oracle app server?
2) Create DB connection with out using connection pool and data source. But i am not prefer this approach coz we need to handle some transaction in our application.
Kindly throw some light on managing connection pool programmatically or in application run time.
I would really appreciate if any one can provide any links or any inormation on this issue.
Thanks in advance.Kindly let me know is there any drawbacks to create 80 Data Sources to connect 80 database in Oracle 10G App server and each data sources should have one connection pool. so i need to create 80 connection pool. Please let me know is this right approach or any work around to create Data source on fly for each request for corresponding database.
-
How to configure sun application server 8.2 for Oracle RAC 10g
Hello,
We have numerous boxes running the sun platform application server 8.2 and 2 boxes running enterprise version 8.2 all connecting to a 4 node Oracle RAC 10 G release 2 database. We have the system up and working. The application servers are connecting just fine to the database and the apps don't have any problems querying, inserting, etc. However, when we try to do failover testing of situations when a node or nodes of the Oracle RAC database goes down the application server does not gain new valid connections. Our configuration is this, OracleDataSource for the data source, table validation turned on with a valid table, ONS configuration set in properties, connectionCache enabled, and fastconnectionfailover enabled as well in the properties. We have that long oracle rac url with load balancing turned on set fot the database URL. We have the checkbox checked to fail all connections on any failure. ONS is configured properly within the database because we have a java application that runs outside of the application server that uses all the same settings described above (only set manually in our code for the OracleDataSource). This application works seemlessly when DB nodes are shutdown. We can shutdown all but one node and it's still humming along without skipping a beat. Start up one of the others, kill the last node, it still hums along nicely without skipping a beat. We'd really like to get the applications running in the application server to work the same way. Any help would be greatly appreciated. We've tried all the combinations that we can think of with configuration settings in the application server and it never works. Am tempted to rip out the database connection pool from inside the application server and configure it manually in the code but we are using entity beans and this is the much easier approach, if it will work. It's down to the point of does sun application server actually work with oracle RAC for connection failovers.Hi,
We are also facing similar execption. Here is the error, we are getting, when a node is failed on RAC.
[#|2007-11-11T12:43:53.685+0000|WARNING|sun-appserver-ee8.1_02|javax.enterprise.system.core.transaction|_ThreadID=38;|JTS5041: The resource manager is doing work outside a global transaction
oracle.jdbc.xa.OracleXAException
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1270)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:318)
at com.sun.gjc.spi.XAResourceImpl.start(XAResourceImpl.java:184)
at com.sun.jts.jta.TransactionState.startAssociation(TransactionState.java:258)
at com.sun.jts.jta.TransactionImpl.enlistResource(TransactionImpl.java:181)
at com.sun.enterprise.distributedtx.J2EETransaction.enlistResource(J2EETransaction.java:397)
at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.enlistResource(J2EETransactionManagerImpl.java:312)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.enlistResource(J2EETransactionManagerOpt.java:114)
at com.sun.enterprise.resource.ResourceManagerImpl.registerResource(ResourceManagerImpl.java:113)
at com.sun.enterprise.resource.ResourceManagerImpl.enlistResource(ResourceManagerImpl.java:71)
at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:176)
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:268)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:193)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:122)
at com.sun.gjc.spi.DataSource.getConnection(DataSource.java:70)
at com.syntegra.nasp.etp.dax.DBManager.getConnection(DBManager.java:192)
at com.syntegra.nasp.etp.dax.DBManager.createDBCommand(DBManager.java:241)
at com.syntegra.nasp.etp.dax.DBManager.createDBCommand(DBManager.java:251)
at com.syntegra.nasp.etp.dax.sp.SPS_PRESCRIPTION_GUID_PROC.getCommand(SPS_PRESCRIPTION_GUID_PROC.java:31)
at com.syntegra.nasp.etp.dax.sp.SPS_PRESCRIPTION_GUID_PROC.execute(SPS_PRESCRIPTION_GUID_PROC.java:23)
at com.syntegra.nasp.etp.dax.PrescriptionBaseDataMapper.loadPresciptionByGUID(PrescriptionBaseDataMapper.java:203)
at com.syntegra.nasp.etp.model.PrescriptionBase.findByPrescriptionGUID(PrescriptionBase.java:176)
at com.syntegra.nasp.etp.messages.PatientPrescriptionReleaseRequest.execute(PatientPrescriptionReleaseRequest.java:120)
at com.syntegra.nasp.etp.service.ETPSLBean.processMessage(ETPSLBean.java:159)
at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:147)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:128)
at $Proxy6.processMessage(Unknown Source)
at com.syntegra.nasp.etp.listener.RequestListener.onRequest(RequestListener.java:204)
at com.syntegra.spine.csf.consumer.mdb.CSFListenerRegisteringConsumer.onRequest(CSFListenerRegisteringConsumer.java:54)
at com.syntegra.spine.csf.consumer.mdb.CSFConsumerBase.invokeListener(CSFConsumerBase.java:267)
at com.syntegra.spine.csf.consumer.mdb.CSFConsumerBase.processMessage(CSFConsumerBase.java:180)
at com.syntegra.spine.csf.consumer.mdb.CSFConsumerBase.onMessage(CSFConsumerBase.java:102)
at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:955)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)
at com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:956)
at com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:42)
at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:130)
at $Proxy9.onMessage(Unknown Source)
at com.sun.genericra.inbound.DeliveryHelper.deliverMessage(DeliveryHelper.java:183)
at com.sun.genericra.inbound.DeliveryHelper.deliver(DeliveryHelper.
Regards
Selvan. -
JMS problem with Sun Application Server 8.2
Hi!
I've just started trying JMS and found a problem.
I set a connection factory called "QueueConnectionFactory" in the Sun Application Server Admin Consol.
After this I test this code:
import javax.jms.*;
import javax.naming.*;
public class Sun_JNDI
public static void main(String args[]) throws Exception
Context jndiContext = null;
System.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory" );
System.setProperty("java.naming.factory.url.pkgs","=com.sun.enterprise.naming");
System.setProperty("java.naming.provider.url","localhost:1024");
jndiContext = new InitialContext();
Object O = jndiContext.lookup("QueueConnectionFactory");
System.out.println(jndiContext);
in result I got this long Exception message:
2006.02.12. 10:52:59 com.sun.corba.ee.spi.logging.LogWrapperBase doLog
INFO: "IOP00710299: (INTERNAL) Successfully created IIOP listener on the specified host/port: all interfaces/1356"
2006.02.12. 10:53:00 com.sun.enterprise.connectors.ActiveRAFactory createActiveResourceAdapter
SEVERE: RAR6001 : Class Not found : com.sun.messaging.jms.ra.ResourceAdapter
2006.02.12. 10:53:00 com.sun.enterprise.connectors.ActiveRAFactory createActiveResourceAdapter
SEVERE:
com.sun.enterprise.connectors.ConnectorRuntimeException: Error in creating active RAR
at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:76)
at com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:267)
at com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:189)
at com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:71)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:293)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at Sun_JNDI.main(Sun_JNDI.java:40)
Caused by: java.lang.ClassNotFoundException: com.sun.messaging.jms.ra.ResourceAdapter
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:50)
... 7 more
2006.02.12. 10:53:00 com.sun.enterprise.naming.SerialContext lookup
SEVERE: NAM0004: Exception during name lookup : {0}
com.sun.enterprise.connectors.ConnectorRuntimeException: Error in creating active RAR
at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:76)
at com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:267)
at com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:189)
at com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:71)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:293)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at Sun_JNDI.main(Sun_JNDI.java:40)
Caused by: java.lang.ClassNotFoundException: com.sun.messaging.jms.ra.ResourceAdapter
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:50)
... 7 more
Exception in thread "main" javax.naming.CommunicationException: serial context communication ex [Root exception is com.sun.enterprise.connectors.ConnectorRuntimeException: Error in creating active RAR]
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:317)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at Sun_JNDI.main(Sun_JNDI.java:40)
Caused by: com.sun.enterprise.connectors.ConnectorRuntimeException: Error in creating active RAR
at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:76)
at com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:267)
at com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:189)
at com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:71)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:293)
... 2 more
Caused by: java.lang.ClassNotFoundException: com.sun.messaging.jms.ra.ResourceAdapter
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:50)
... 7 more
So I tested this code under Netbeans5 and I don't where to find jar file contains the class: com.sun.messaging.jms.ra.ResourceAdapter
Other time I tryied to lookup this URL: "java:comp/env/jms/QueueConnectionFactory"
The result was: javax.naming.NameNotFoundException
I know it is a small code example but if I'm not able to solve this problem I can't go on with JMS.
I would be glad by any help.
Regards:
SandorHello
In my code it looks like that:
1: System.setProperty("com.sun.jndi.ldap.LdapCtxFactory", "iiop://localhost:3700");
2: Context ctx = new InitialContext();
3: TopicConnectionFactory factory = (TopicConnectionFactory)ctx.lookup("jms/DailyDestinationFactory");
4: TopicConnection connection = factory.createTopicConnection();
5: TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
6: Topic topic = (Topic)ctx.lookup("jms/DailyBean");
7: TopicPublisher pub = session.createPublisher(topic);
8: TextMessage msg = session.createTextMessage();
9: msg.setText("NewMessage");
10: pub.send(msg);
and it work with Sun App Server 8.2.
Maybe you are looking for
-
PSE 8.0 Editor Doesn't Open
OK, before I get started just let me say that I have spent the better part of a week moving my photos and catalog from an old XP computer to a new Windows 7 computer. This involved migrating my PSA 2.0 catalog to PSE 5.0 then to PSE 8.0. In the pro
-
How do I close a PDF document automatically when the browser is closed?
I have a web app writen in HTML/ASP. In order to acccess this app, our users have to enter a password and user id. Once on the main page of the app, they can click on a link which opens the reader in another window. Quite often, when finished with th
-
I have purchased an old I-pad wich I would like to update with my information is the possible?
Please I need help with an old Ipad that I have purchased last year How could I make personal when I don't have the previous information?
-
Can I use Time Machine to revert to a previous OS version?
Hi; I've been backing up my mac using TimeMachine for a while now. After upgrading to OS 10.5.6, my audio interface from Motu started having issues. Should have stuck with 10.5.5. Lessons learned I guess. Can I use TM to revert back to 10.5.5? I've u
-
I have a Mac OS X 10.5 and I use wireless set up. My key board does not respond when I try to type anything. I have changed the batteries in the keyboard and mouse, to no avail. Consequently, I cannot put in my wireless password to reactivate my inte