How to configure datasources in tomcat 4.1.12 to obtain OracleResultSets
Hi!
Since my application running under both OracleAS and Tomcat 4.1.12 should obtain connection pooling i tried to configure the application servers. Our application makes use of OracleResultSet. I configured OracleAS by editing the data-sources.xml file which works very well:
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="OracleDS"
location="jdbc/OracleCoreDS"
xa-location="jdbc/xa/OracleXADS"
ejb-location="jdbc/OracleDS"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="scott"
password="tiger"
url="jdbc:oracle:thin:@testdb:1525:ORA5"
inactivity-timeout="30"
/>
The code for jndi lookup is here. It works fine when i cast ResultSet to OracleResultSet using OracleAS:
initCtx = new InitialContext();
envCtx = (Context) initCtx.lookup("java:comp/env");
dataSource = (DataSource) envCtx.lookup("jdbc/OracleDS");
con = dataSource.getConnection();
ResultSet rs = con.executeQuery("..");
OracleResultSet orars = (OracleResultSet)rs;
Then i configured tomcat 4.1.12 server.xml file:
<Resource name="jdbc/OracleDS" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/OracleDS">
<parameter><name>username</name><value>scott</value></parameter>
<parameter><name>password</name><value>tiger</value></parameter>
<parameter><name>driverClassName</name><value>oracle.jdbc.driver.OracleDriver</value></parameter>
<parameter><name>url</name><value>jdbc:oracle:thin:@testdb:1525:ORA5</value></parameter>
</ResourceParams>
The same source for jndi lookup brings up a ClassCastException at line
OracleResultSet orars = (OracleResultSet)rs;
Therefore i tried to add a new parameter in tomcats server.xml:
<parameter><name>factory</name><value>com.evermind.sql.DriverManagerDataSource</value></parameter>
Now following exceptions occurs:
javax.naming.NamingException: Could not create resource factory instance, com.evermind.sql.DriverManagerDataSource
java.lang.Object org.apache.naming.factory.ResourceFactory.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)
I have oc4j.jar and classes12.jar in tomcats home directory under config/lib.
How should i configure tomcat to be able to use connection pooling and OracleResultSets?
Thanks in advance!
thomas
?
Similar Messages
-
How to configure datasource in JBOSS?
Hi All,
I want to configure datasource in JBOSS for oracle database? The constraints are
1) The password should be in the encrypted format in the configuration file because I dont want to reveal my password to anyone.
How can we acheive this.
Can I do the encryption at the time of build(If yes how?)
For any help Thanks in advance.
Rajani KanthHi Rajani
I was browsing the web looking for a way to solve the same problem.
Have you every found a way to do this?
I'm faced with the same problem: I must encrypt the user name and
password.
Did you find out whether JBoss has a way to accomplish this.
Many thanks in advance.
Serge
[email protected] -
How to configure SSL in tomcat and transfer data through HTTPS.
Hi all,
I hav an urgent requirement for transfering data through HTTPS.But hav no idea how to achieve that,using SSL.
For that i have to configure tomcat.What and all i hav to do
download and which and all files i hav to alter for configuring the tomcat.
seeking for ur help,
thank youMulti-posted.
http://forum.java.sun.com/thread.jspa?threadID=591116&messageID=3079266#3079266
http://forum.java.sun.com/thread.jspa?threadID=591062&messageID=3078566#3078566
http://forum.java.sun.com/thread.jspa?threadID=590987&messageID=3077736#3077736 -
[SOLVED] - How to configure datasources in TP4
Hello,
I see there is no longer a Tools >> Embedded OC4J Server Preferences menu option in TP4.
I have searched here and looked through the help to no avail...
How/Where do we configure our Datasources under TP4?
Thanks,
Ripley
Message was edited by:
Ripley
Message was edited by:
RipleyI'm not sure this is exactly what you're looking for, but try Tools -> Java EE Runtime Preferences, then select the Embedded OC4J radio button option, followed by the Embedded OC4J Server Preferences button, and within the dialog that pops up their is a Data Sources node.
Hope this helps.
CM. -
How to configure "mod_gzip" in tomcat
Hi falks,
i'd like to ask if someone con help me to configure the "mod_gzip" component with tomcat!
If yes could you post me an example please?
Many thanks
Ciro.thanks for the reply, i have configured the connection pool settings in the tomcat.
I created a class with static method, which will return the connection object.
whenever i need the connection object, iam invoking the static method, once its usage is over iam closing thew connection..
is it the right way of using the connection object in the web application. -
Please help : How to configure a datasource in 9iAS
Hello all,
I am new at 9iAS . Can anyone tell me how we configure datasource with JNDI name in 9iAS.
any help will be appriciated.
Thanks a lot
Madhukar
nullDo you mean from flash in a web page or do you mean
converting the swf file format (maybe with a decompiler or
whatever).
If you're meaning to do it from flash in a web page:
You can't save a movieclip from flash to svg. You could
perhaps record drawingAPI commands and create the appropriate svg
output in an internal xml object which you then send to the server.
But I don't know of any pre-built classes to do that (disclaimer:
because I don't know of any doesn't mean they don't exist).
Going from svg to flash is doing it the other way around.
Converting the svg paths back to actionscript drawing commands. I
think I've seen some examples of this online somewhere. -
Configure the embedded Tomcat Server
Hello,
is there a documentation which tells me how to configure the embedded Tomcat Server in the Oracle Content Server? I can't get it work.
When I try to start an web application from "JSP Server Web App Admin" I get the following error message:
Content Server Request Failed
csJspServerErrorAddWebAppService Failed to add context /idc/groups/jsp/documents/adacct/hello. Unable to execute service method 'addContext'.
[ Details ]
intradoc.common.ServiceException: !csJspServerErrorAddContext,/idc/groups/jsp/documents/adacct/hello!csUnableToExecMethod,addContext at intradoc.server.jsp.JspServiceHandler.addContext(JspServiceHandler.java:152) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at intradoc.common.IdcMethodHolder.invokeMethod(ClassHelperUtils.java:461) at intradoc.common.ClassHelperUtils.executeMethodReportStatus(ClassHelperUtils.java:142) at intradoc.server.ServiceHandler.executeAction(ServiceHandler.java:75) at intradoc.server.Service.doCodeEx(Service.java:488) at intradoc.server.Service.doCode(Service.java:470) at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1350) at intradoc.server.Service.doAction(Service.java:450) at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1191) at intradoc.server.Service.doActions(Service.java:445) at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1111) at intradoc.server.Service.executeActions(Service.java:431) at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:632) at intradoc.server.Service.doRequest(Service.java:1709) at intradoc.server.ServiceManager.processCommand(ServiceManager.java:357) at intradoc.server.IdcServerThread.run(IdcServerThread.java:195) Caused by: intradoc.common.ServiceException: !csJspServerErrorAddContext,/idc/groups/jsp/documents/adacct/hello!csUnableToExecMethod,addContext at intradoc.server.jsp.JspProvider.addContext(JspProvider.java:391) at intradoc.server.jsp.JspServiceHandler.addContext(JspServiceHandler.java:116) ... 19 more
And it is also not possible to use jsp layout pages in Site created in Site Studio. When I try to load pages using a jsp layout page the browser displays a blank page.Hi,
Even i am also facing the same issue after following all those steps.
Please find the error which i m getting.
csJspServerErrorAddWebAppService The target file cannot be accessed. Unable to rename the file 'F:\stellent\indxpdod2\weblayout\groups\chanpart\@cccd\documents\manufacturing\enhstellsrchint' to 'F:\stellent\indxpdod2\weblayout\groups\chanpart\@cccd\documents\manufacturing\enhstellsrchint~jsp'. -
How can I configure ang use JNDI datasource on Tomcat 4.0.x ?
How can I configure ang use JNDI datasource on Tomcat 4.0.x ?
Please help me , Thanks !Hello ,
You need to go through the JNDI tutorial which you can access at the sun's site. It will explain all the things you need.
By the way all you want to use JNDI datasource is JNDI class library and some naming or directory service provider, which also you can download from sun.
Good Luck. -
How to configure Oracle Datasource in Tomcat
Hello,
My configuration of a Tomcat Datasource (oracle) appears to be wrong. Either that or my oraclejdbc.jar file is in the wrong place. Perhaps my classpath setting is wrong. Any help is appreciated.
Tomcat console error:
20070423 20:46:22.514 http-8080-Processor24(0x005878d2)
JdbcUtil#getDataSourceObject() Throw com.waveset.util.ConfigurationError: Failed to load JDBC DataSource 'java:comp/env/jdbc/wrsPool':
==> javax.naming.OperationNotSupportedException: Can't generate an absolute name for this namespace
Trace output from JdbcUtil:
XPRESS exception:
Can't call method getDataSourceObject on class com.waveset.util.JdbcUtil ==> com.waveset.util.ConfigurationError: Failed to load JDBC DataSource 'java:comp/env/jdbc/wrsPool': ==> javax.naming.OperationNotSupportedException: Can't generate an absolute name for this namespace
XPRESS exception:
Can't call method queryRecords on class com.waveset.util.JdbcUtil ==> java.lang.NullPointerException:
The express code used to call JdbcUtil follows:
<defvar name='dataSource'>
<new class='javax.sql.DataSource'/>
</defvar>
<set name='dataSource'>
<invoke name='getDataSourceObject' class='com.waveset.util.JdbcUtil'>
<null/>
<s>java:comp/env/jdbc/wrsPool</s>
<null/>
</invoke>
</set>
The Tomcat configuration *.xml file
<?xml version='1.0' encoding='utf-8'?>
<Context docBase="wavex" path="/wavex" useNaming="false" workDir="work\Catalina\localhost\wavex">
<Resource name="jdbc/waveexPool " type="javax.sql.DataSource"/>
<Resource name="jdbc/wrsPool" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/waveexPool ">
<parameter>
<name>url</name>
<value>jdbc:sqlserver://localhost:1433;DatabaseName=WaveEx</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
</parameter>
<parameter>
<name>username</name>
<value></value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>
<ResourceParams name="jdbc/wrsPool">
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@vega.vf.lmco.com:1521:dev2</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>username</name>
<value></value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>
</Context>
Environment is:
IDM 7.0 on Windows 2000, sql server houses the repository.
Tomcat 5.0.28 with JDK 1.6thanks for the reply, i have configured the connection pool settings in the tomcat.
I created a class with static method, which will return the connection object.
whenever i need the connection object, iam invoking the static method, once its usage is over iam closing thew connection..
is it the right way of using the connection object in the web application. -
How to configure applet/servlet in Tomcat?
I'm building a web application which is going to be deployed in Tomcat. I have an applet(called MYAPPLET here) which "calls" a servlet(called MYSERVLET here). I cannot figure out how to configure the whole thing.
/test is my docbase. In /test I made a directory "applet classes" and a directory "servlet". The applet tag I use in the HTML file looks like this:
<applet
code="MYAPPLET.class"
codebase="http://localhost:8080/test/applet classes/"
<!-- Tell the applet where its peer is located -->
<param
name="servlet"
value="http://localhost:8080/test/servlet/MYSERVLET" />
</applet>
Now, when opening the page, the applet can be found but Tomcat gives an error 404 saying that it can not find the servlet. On the other hand, If I make an entry in my web.xml (with url mapping
<url-pattern>/test </url-pattern> or <url-pattern>/test/servlet </url-pattern>, depending on where I put MYSERVLET)
for the servlet mentioned above and I put the MYSERVLET in either the WEB-INF/classes directory or in /test/servlet Tomcat gives an error 403. It refuses to connect to the servlet!
Please can anyone help me. THanx in advance
debeumersYou are configuring Tomcat and if you have further questions then post new questions in the forum "Java Servlet Technology".
Given that your servlet url is "localhost:8080/test/servlet/MyServlet"
This assumes -
1) You have created a web application called "test". You have a directory called "test" under- $CATALINA_HOME/webapps
2) Your html files, jsp files, and subdirectory "applet-classes" (Note - do Not use spaces when naming directories) exist in this top level directory of your web app. If you choose to place your applet classes in this subdir then the codebase can be "applet-classes" - omitting the "/" means this directory is located relative to the current directory of the html file. (No jar files? No archive param then..)
3) You have a class file called "MyServlet" located - $CATALINA_HOME/webapps/test/WEB-INF/classes
Some versions of Tomcat require you to uncomment out the area of the Mapping for the Invoker Servlet element in $CAT_HOME/conf/web.xml.
<servlet-name>invoker</servlet-name>
<url-mapping>/servlet/*</url-mapping>
Once this is done, you need not create a directory called "servlet" anywhere in your structure. It is the url mapping.
You will want to apply url-patterns and mappings to your application specific web.xml (This is located in - $C_H/webapps/test/WEB-INF) when it comes time to deploy the app, but that is not required for testing and development. You need not make changes to the app specific web.xml at this time just to get the servlet to run.
And finally I suggest you read a book on this subject... -
How to include new driver and configure datasource in NW 7.0
Hi,
I have deployed my application in the app server and now i need to add the ms sql drivers to the application server and configure datasource to it.
Can any one help me to configure the datsource in Nw 7.0 and also how to add the driver files tp app server..?
thanks in advance
jayakumarHi,
Follow these links:
How To Install and Configure External Drivers for the JDBC & JMS
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f04ce027-934d-2a10-5a8f-fa0b1ed4d88f
http://saphelp.border-states.com/EN/b3/cc633c3a892251e10000000a114084/content.htm
http://www.sapag.co.in/JDBC%20Adapter-Type2JDBCDriver%20Deployment.html
Regards,
Nithiyanandam
Reward points -
How to configure connection pooling in tomcat?
how to configure connection pooling in tomcat and how to use the connection pooling in the jsp and servlets?
thanks for the reply, i have configured the connection pool settings in the tomcat.
I created a class with static method, which will return the connection object.
whenever i need the connection object, iam invoking the static method, once its usage is over iam closing thew connection..
is it the right way of using the connection object in the web application. -
JMS with TomCat ? how to configure or install JMS
i am new to JMS i dont know how to configure JMS.I have copied ths javax.jms.jar and jms.jar in JDK1.4 directories like ../lib, jre/lib etc. also set the classpaths but i cant compile a simple file error saya no package found. can anyone help me please ???? webserver i am using is tomcat. tell me the solution step wise please be soon thakyou again. in advance ;)
when you say classpaths, you mean you added ../lib/jms.jar to your class path. that is you explicitly put the jar file in your path and it won't compile?
_sjz. -
How to Install and Configure Java and Tomcat
Hi Everybody,
I am using the following versions of java and tomcat:
JAVA: j2sdk-1_4_2_13
Tomcat: jakarta-tomcat-5.0.5
I tried to configure several times both but everytime the result is the same. I am setting the following variables:
PATH: .;D:\j2sdk1.4.2_13\bin;D:\Tomcat 5.0\bin
CLASSPATH: .;D:\j2sdk1.4.2_13\lib;D:\Tomcat 5.0\common\lib\servlet-api.jar
JAVA_HOME: D:\j2sdk1.4.2_13
Please correct what mistake i am doing again and again. I appreciate your effort.
Thanks in advance.
HimanshuFine sir, I will tell evrything in detail what steps i am following during installation and configuring java and Tomcat.
1) I am using the following versions(exe) of java and tomcat:
JAVA: j2sdk-1_4_2_13-windows-i586-p
Tomcat: jakarta-tomcat-5.0.5
2) Then, i follow exactly the same variable names and values to configure java as mentioned below to make java work under User variables header:
PATH: .;D:\j2sdk1.4.2_13\bin
CLASSPATH: .;D:\j2sdk1.4.2_13\lib
JAVA_HOME: D:\j2sdk1.4.2_13
Above steps i follow only for installing java. And it also not working properly. If i run my .java file from the destination of the file then it will be execulted but if i try to execute from any other location then it doesn't, it shows the following message in the DOS prompt:
error: cannot read: Hello.java
1 error
Now, please correct what mistake i am doing.
Thanks
Himanshu -
How to configure the smtp server..
i had an error when running the java mail program..
this is my program
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.io.*;
import java.util.Properties;
public class MailClient
public void sendMail(String mailServer, String from, String to,
String subject, String messageBody,
String[] attachments) throws
MessagingException, AddressException
// Setup mail server
Properties props = System.getProperties();
props.put("mail.smtp.host", mailServer);
// Get a mail session
Session session = Session.getDefaultInstance(props, null);
// Define a new mail message
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
// Create a message part to represent the body text
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(messageBody);
//use a MimeMultipart as we need to handle the file attachments
Multipart multipart = new MimeMultipart();
//add the message body to the mime message
multipart.addBodyPart(messageBodyPart);
// add any file attachments to the message
// addAtachments(attachments, multipart);
// Put all message parts in the message
message.setContent(multipart);
// Send the message
Transport.send(message);
protected void addAtachments(String[] attachments, Multipart multipart)
throws MessagingException, AddressException
for(int i = 0; i<= attachments.length -1; i++)
String filename = attachments;
MimeBodyPart attachmentBodyPart = new MimeBodyPart();
//use a JAF FileDataSource as it does MIME type detection
DataSource source = new FileDataSource(filename);
attachmentBodyPart.setDataHandler(new DataHandler(source));
//assume that the filename you want to send is the same as the
//actual file name - could alter this to remove the file path
attachmentBodyPart.setFileName(filename);
//add the attachment
multipart.addBodyPart(attachmentBodyPart);
public static void main(String[] args)
try
MailClient client = new MailClient();
String server="smtp.canvasindia.com";
String from="[email protected]";
String to = "[email protected]";
String subject="Test";
String message="Testing";
String[] filenames ={"c:/A.java"};
client.sendMail(server,from,to,subject,message,filenames);
catch(Exception e)
e.printStackTrace(System.out);
the error is .................
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 553 Attack detected from p
ool 59.144.8.116. <http://unblock.secureserver.net/?ip=59.144.8.*>
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1196)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:584)
at javax.mail.Transport.send0(Transport.java:169)
at javax.mail.Transport.send(Transport.java:98)
at MailClient.sendMail(MailClient.java:47)
at MailClient.main(MailClient.java:84)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 553 Attack detected fro
m pool 59.144.8.116. <http://unblock.secureserver.net/?ip=59.144.8.*>
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1047)
... 5 more
how to configure the smtp server in my machine..
please guide me...This uses gmail account, and gmail smtp
* MailSender.java
* Created on 14 November 2006, 17:07
* This class is used to send mails to other users
package jmailer;
* @author Abubakar Gurnah
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class MailSender{
private String d_email,d_password;
* This example is for gmail, you can use any smtp server
* @param d_email --> your gmail account e.g. [email protected]
* @param d_password --> your gmail password
* @param d_host --> smtp.gmail.com
* @param d_port --> 465
* @param m_to --> [email protected]
* @param m_subject --> Subject of the message
* @param m_text --> The main message body
public String send(String d_email,String d_password,String d_host,String d_port,
String m_from,String m_to,String m_subject,String m_text ) {
this.d_email=d_email;
this.d_password=d_password;
Properties props = new Properties();
props.put("mail.smtp.user", d_email);
props.put("mail.smtp.host", d_host);
props.put("mail.smtp.port", d_port);
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
//props.put("mail.smtp.debug", "true");
props.put("mail.smtp.socketFactory.port", d_port);
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
SecurityManager security = System.getSecurityManager();
try {
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);
//session.setDebug(true);
MimeMessage msg = new MimeMessage(session);
msg.setText(m_text);
msg.setSubject(m_subject);
msg.setFrom(new InternetAddress(m_from));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(m_to));
Transport.send(msg);
return "Successful";
} catch (Exception mex) {
mex.printStackTrace();
return "Fail";
//public static void main(String[] args) {
// MailSender blah = new MailSender();
private class SMTPAuthenticator extends javax.mail.Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(d_email, d_password);
}
Maybe you are looking for
-
Need help restoring original desktop after crash and new install
Question: is there a way to restore my original desktop? My system starting giving me kernel errors. I was running Member when it crashed. I did a restart and the mouse would no longer work. Tried starting in safe mode. Mouse still refused to work. R
-
Vendor account group definition
Are the delivered vendor account groups and their number ranges considered best practice or is this field one that the users decide on the number ranges and which vendor account groups to use. What is the SAP recommendation on vendor account groups w
-
InDesign CS6 crashing when I change document set up from letter to tabloid on all my Indd files
New problem we're experiencing today. Wondering if anyone else is experiencing the same issue?
-
Hi All Currently I am working on .net based application and Oracle 8.0.6.00 (Multi language Support - (Japanese/English ))as backbend . The above mention error is occurring from last few days on our production server when user is trying to save data
-
Hi all I want to change my Character Set to UTF8 for an exisiting database. Can anyone please post me the steps to be followed. Regds Nirmal