Web app and Forum

2007-08-18 Thread Mohammed Zabin
Hi all

I have a web application, and I wanted to add a forum for this application,
i used mvnforum ( an open source forum). My question is :
Can I jar two web applications in one file?? both applications use the same
database.

??
any help please


Re: Web app and Forum

2007-08-18 Thread Mohammed Zabin
No, It's just I am using an open source forum, a huge project, with
hundredes of class and jsp files. I thought that If I wanted to merge the
forum with my web applications, it will be a nightmare :(, so I am looking
for a way to sovle this



On 8/18/07, David Smith [EMAIL PROTECTED] wrote:

 I doubt it.  Webapps are intended to be independent of each other like
 software applications on your desktop or notebook.  My question is why
 would you want to?  Is the database some file based db like derby or
 berkley db?

 --David

 Mohammed Zabin wrote:
  Hi all
 
  I have a web application, and I wanted to add a forum for this
 application,
  i used mvnforum ( an open source forum). My question is :
  Can I jar two web applications in one file?? both applications use the
 same
  database.
 
  ??
  any help please
 
 


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Web app and Forum

2007-08-18 Thread Mohammed Zabin
You mean I deploy two war files that shares the same database?

On 8/18/07, David Smith [EMAIL PROTECTED] wrote:

 If you are pointing both webapp and forum to the same database on the
 same database server and there aren't any other shared resources or
 reasons for them to live under the same roof, I would think it would be
 much easier to deploy two webapps and be done.

 --David

 Mohammed Zabin wrote:
  No, It's just I am using an open source forum, a huge project, with
  hundredes of class and jsp files. I thought that If I wanted to merge
 the
  forum with my web applications, it will be a nightmare :(, so I am
 looking
  for a way to sovle this
 
 
 
  On 8/18/07, David Smith [EMAIL PROTECTED] wrote:
 
  I doubt it.  Webapps are intended to be independent of each other like
  software applications on your desktop or notebook.  My question is why
  would you want to?  Is the database some file based db like derby or
  berkley db?
 
  --David
 
  Mohammed Zabin wrote:
 
  Hi all
 
  I have a web application, and I wanted to add a forum for this
 
  application,
 
  i used mvnforum ( an open source forum). My question is :
  Can I jar two web applications in one file?? both applications use the
 
  same
 
  database.
 
  ??
  any help please
 
 
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Bean and Servlet

2007-07-27 Thread Mohammed Zabin
Ok, in the first page, which use a tag, I generate 10 random numbers. and
generate a SQL statement containing this numbers like the following:
SELECT * FROM table WHERE id in ( 2, 3, 5, 10,  etc). I use a string to
hold the  in  statement and bound it to the whole query string.

After submitting the page, I need to check the validety of the answers, for
the same questions. So, I store the inStr in a session and read it in the
second page.

Regarding concurrency issue, I think that I don't need to synchronize random
number generation. Because I don't have a problem for multiple requests to
have the same set of questions.


On 7/27/07, Pid [EMAIL PROTECTED] wrote:

 Caldarale, Charles R wrote:
  From: Mohammed Zabin [mailto:[EMAIL PROTECTED]
  Subject: Re: Bean and Servlet
 
  My Problem is that, I want to pass these numbers, Questions
  IDs, from the first page, which i have made it as a tag class,
  to Results page, which was made as servlet.
 
  Rather than hanging onto the ID within Tomcat, why not store it on the
  generated web page (as a hidden field) and have some script on that page
  include it with the next request from the client?  That way you avoid
  all synchronization issues that can occur with simultaneous requests.

 It sounds like a simple form submit with (a) hidden field(s).

 Why do all of the rest of the ids need to be submitted as well, if
 you're only checking for the single correct answer?

 p


  That was my problem my buddy, by the way, when i used
  session, it worked fine. and you stated that this will
  not work
 
  I didn't say it wouldn't work, I said you had to be careful and take
  concurrency into account, which your code snippets did not.
 
   - Chuck
 
 
  THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
  MATERIAL and is thus for use only by the intended recipient. If you
  received this in error, please contact the sender and delete the e-mail
  and its attachments from all computers.
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 





Re: Bean and Servlet

2007-07-27 Thread Mohammed Zabin
On 7/27/07, Mohammed Zabin [EMAIL PROTECTED] wrote:

 Ok, in the first page, which use a tag, I generate 10 random numbers. and
 generate a SQL statement containing this numbers like the following:
 SELECT * FROM table WHERE id in ( 2, 3, 5, 10,  etc). I use a string
 to hold the  in  statement and bound it to the whole query string.

 After submitting the page, I need to check the validety of the answers,
 for the same questions. So, I store the inStr in a session and read it in
 the second page.

 Regarding concurrency issue, I think that I don't need to synchronize
 random number generation. Because I don't have a problem for multiple
 requests to have the same set of questions. The most important issue is that
 for a given request, I need to submit the same collection of questions
 to Results page. And so, i used session to store the questions ids'.


  On 7/27/07, Pid [EMAIL PROTECTED] wrote:
 
  Caldarale, Charles R wrote:
   From: Mohammed Zabin [mailto:[EMAIL PROTECTED] ]
   Subject: Re: Bean and Servlet
  
   My Problem is that, I want to pass these numbers, Questions
   IDs, from the first page, which i have made it as a tag class,
   to Results page, which was made as servlet.
  
   Rather than hanging onto the ID within Tomcat, why not store it on the
   generated web page (as a hidden field) and have some script on that
  page
   include it with the next request from the client?  That way you avoid
   all synchronization issues that can occur with simultaneous requests.
 
  It sounds like a simple form submit with (a) hidden field(s).
 
  Why do all of the rest of the ids need to be submitted as well, if
  you're only checking for the single correct answer?
 
  p
 
 
   That was my problem my buddy, by the way, when i used
   session, it worked fine. and you stated that this will
   not work
  
   I didn't say it wouldn't work, I said you had to be careful and take
   concurrency into account, which your code snippets did not.
  
- Chuck
  
  
   THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
  PROPRIETARY
   MATERIAL and is thus for use only by the intended recipient. If you
   received this in error, please contact the sender and delete the
  e-mail
   and its attachments from all computers.
  
   -
   To start a new topic, e-mail: users@tomcat.apache.org
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
 



Re: MySql Connector

2007-07-27 Thread Mohammed Zabin
Ok guys, here we are. I have define the new resource inside a Context tag
inside a Host tag, as suggested by Tomcat documentation. I removed it and
put it inside GlobalNamingResources tag like the following:

1. Configure naming Resource:
inside GlobalNamingResources i put the following:
Resource name=jdbc/DBTest auth=Container type=javax.sql.DataSource
  maxActive=100 maxIdle=30 maxWait=1
  username=root password=exam driverClassName=
com.mysql.jdbc.Driver
  url=jdbc:mysql://localhost:3306/exam/

2. Inside web.xml:
resource-ref
  descriptionOracle Datasource example/description
  res-ref-namejdbc/DBTest/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref

3. Finally, you have to connect your server to the new resource. To do that,
inside context.xml put the following:
ResourceLink global=jdbc/DBTest name=jdbc/DBTest type=
javax.sql.DataSource/

4. Test your code as follow:

%@ page import = java.sql.*, javax.naming.*, javax.sql.* %

%

  Context initContext = new InitialContext();
   DataSource ds  =
  (DataSource)initContext.lookup(java:comp/env/jdbc/DBTest);

   Connection conn = ds.getConnection();

   out.println(Connection Established);

%
Tomcat 6 documentation stated that you have to put naming resource
definition inside the Context tag. And this was the problem, when i removed
it from their it worked find and the connection established successfully.

Anyways, thank you very much buddies for your time and consideration. I am
always saying that the user of this mailing list are the best developers in
the world. ;)

On 7/26/07, Christopher Schultz [EMAIL PROTECTED] wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Mohammed,

 Mohammed Zabin wrote:
  If you looked at the exception you will find ClassNotFoundException at
 line
  66 in the generated servlet, and this occurs withing the try block, so,
 i
  think it's a problem of Connector.

 You are seriously confused, here.

 Your code is not being compiled. Your code is not running. The fact that
 you have a try/catch block in your code is irrelevant.

 Why do you think that this occurs within the try block? Your stack
 trace does not include any references to your own code. It's simply not
 executing.

 And, even if this occurred within your try/catch block, you are
 foolishly swallowing all exceptions, meaning that you would never know
 what the problem was.

  But the strange thing is that this
  code worked fine on a normal java class???

 Probably because your normal java class actually compiled and ran.
 Something is wrong with your file, not your code.

 - -chris

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.7 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFGqO9T9CaO5/Lv0PARAuXgAKDBgPM+osNL0y15at28q9YITixicACgqJte
 QOgTrjE+1cqeih2be83XEww=
 =dPUB
 -END PGP SIGNATURE-

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: registering a DB2ConnectionPoolDataSource in tomcat 5.5

2007-07-27 Thread Mohammed Zabin
I didn't work on DB2 before, but i have configured Oracle and MySql
database in the same way.

First, you have to get the ideal connector for DB2, jar file, and
place it inside CATALINA_HOME/lib, or JAVA_HOME/lib/ext.

Second, Define your resource name, you already did.

Thrid: Add extra information in your web.xml file like the following:
resource-ref
  descriptionOracle Datasource example/description
  res-ref-namejdbc/db2universal/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref

After that, you have to connect your Resource name to the your server.
In context.xml add the following line of code:

ResourceLink global=jdbc/db2universal name=jdbc/db2universal
type=javax.sql.DataSource/

One last thing, please note that you have to change the previous
parameters according to your database. Hope that will help
On 7/27/07, dileep_sivaraman [EMAIL PROTECTED] wrote:

 Hi ,

 I am trying to register a com.ibm.db2.jcc.DB2ConnectionPoolDataSource
 datasource in tomcat 5.5.4.

 I am not getting any exception's while doing a context lookup and gives me
 the datasource.
 However the paramaeter's that are set with that Resource are always null.

 Server.xml
 GlobalNamingResources
 Resource name=jdbc/db2universal
 type=com.ibm.db2.jcc.DB2ConnectionPoolDataSource
 factory=com.ibm.db2.jcc.DB2DataSourceFactory
 serverName=PROD9S03.bankofamerica.com username=abc password=abc/

 /GlobalNamingResources

 In my code  I get the datasource as :

 connPoolDataSource=(DB2ConnectionPoolDataSource)
 envContext.lookup(jdbc/db2universal);

 However when I print out the serverName parameter that has been set in the
 resource it prints null.

 System.out.println(connPoolDataSource.getServerName()
 :+connPoolDataSource.getServerName());

 OUTPUT:

 connPoolDataSource.getServerName() :null


 Can somebody tell me what I  am doing wrong?
 --
 View this message in context:
 http://www.nabble.com/registering-a-DB2ConnectionPoolDataSource-in-tomcat--5.5-tf4155802.html#a11823991
 Sent from the Tomcat - User mailing list archive at Nabble.com.


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: registering a DB2ConnectionPoolDataSource in tomcat 5.5

2007-07-27 Thread Mohammed Zabin
On 7/27/07, dileep_sivaraman [EMAIL PROTECTED] wrote:


 Hi,
  Thrid: Add extra information in your web.xml file like the following:
  resource-ref
   descriptionOracle Datasource example/description
   res-ref-namejdbc/db2universal/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
 /resource-ref


  Do we have to add this since I am defining the resource as global?
 You are right, i think that you don't have to add the above in web.xml, I
 tried to remove it from Oracle configuration and MySql, and it works.


The most important thing, is to defing a resource in server.xml, and then
linke your resource to the server enviroment in context.xml

OUTPUT :

 PRinting out entries in java:comp/env
 Entry :jdbc: org.apache.naming.NamingContext
 PRinting out entries in java:comp/env/jdbc
 Entry :db2universal: org.apache.naming.ResourceLinkRef
 It is not null
 
 connPoolDataSource.getServerName() :null
 Port:446
 DB Name:null
 Driver type :2
 Timeout :0
 User :null

 Is there any way to print out the parameters that are passed along with
 the
 Resource?
 Or am I doing something fundamentally wrong?



 Mohammed Zabin wrote:
 
  I didn't work on DB2 before, but i have configured Oracle and MySql
  database in the same way.
 
  First, you have to get the ideal connector for DB2, jar file, and
  place it inside CATALINA_HOME/lib, or JAVA_HOME/lib/ext.
 
  Second, Define your resource name, you already did.
 
  Thrid: Add extra information in your web.xml file like the following:
  resource-ref
descriptionOracle Datasource example/description
res-ref-namejdbc/db2universal/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
  /resource-ref
 
  After that, you have to connect your Resource name to the your server.
  In context.xml add the following line of code:
 
  ResourceLink global=jdbc/db2universal name=jdbc/db2universal
  type=javax.sql.DataSource/
 
  One last thing, please note that you have to change the previous
  parameters according to your database. Hope that will help
  On 7/27/07, dileep_sivaraman [EMAIL PROTECTED] wrote:
 
  Hi ,
 
  I am trying to register a com.ibm.db2.jcc.DB2ConnectionPoolDataSource
  datasource in tomcat 5.5.4.
 
  I am not getting any exception's while doing a context lookup and gives
  me
  the datasource.
  However the paramaeter's that are set with that Resource are always
 null.
 
  Server.xml
  GlobalNamingResources
  Resource name=jdbc/db2universal
  type=com.ibm.db2.jcc.DB2ConnectionPoolDataSource
  factory=com.ibm.db2.jcc.DB2DataSourceFactory
  serverName=PROD9S03.bankofamerica.com username=abc password=abc/
 
  /GlobalNamingResources
 
  In my code  I get the datasource as :
 
  connPoolDataSource=(DB2ConnectionPoolDataSource)
  envContext.lookup(jdbc/db2universal);
 
  However when I print out the serverName parameter that has been set in
  the
  resource it prints null.
 
  System.out.println(connPoolDataSource.getServerName()
  :+connPoolDataSource.getServerName());
 
  OUTPUT:
 
  connPoolDataSource.getServerName() :null
 
 
  Can somebody tell me what I  am doing wrong?
  --
  View this message in context:
 
 http://www.nabble.com/registering-a-DB2ConnectionPoolDataSource-in-tomcat--5.5-tf4155802.html#a11823991
  Sent from the Tomcat - User mailing list archive at Nabble.com.
 
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 View this message in context:
 http://www.nabble.com/registering-a-DB2ConnectionPoolDataSource-in-tomcat--5.5-tf4155802.html#a11824613
 Sent from the Tomcat - User mailing list archive at Nabble.com.


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Bean and Servlet

2007-07-26 Thread Mohammed Zabin
What do you suggest to overcome this problem?

On 7/25/07, Caldarale, Charles R [EMAIL PROTECTED] wrote:

  From: Mohammed Zabin [mailto:[EMAIL PROTECTED]
  Subject: Re: Bean and Servlet
 
  I will tell you the procedure; At each time the user clickes
  the first page in the site, a random numbers will be generated
  and stored in the session.

 You're missing the point.  The user may click multiple times before the
 first request is even received by the webapp, or the browser may simply
 fire off multiple parallel requests, or the user may open multiple tabs
 for the same web site.  All of the above will result in multiple
 concurrent requests occurring for the same session.  Does your logic
 handle that properly?  The code snippet you posted does not.

 - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you
 received this in error, please contact the sender and delete the e-mail
 and its attachments from all computers.

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: MySql Connector

2007-07-26 Thread Mohammed Zabin
It's already wrapped man, i just copied the code snippet from within %%
marker ;), and for System.out, or out.println, It's still the same problem.
If you looked at the exception you will find ClassNotFoundException at line
66 in the generated servlet, and this occurs withing the try block, so, i
think it's a problem of Connector. But the strange thing is that this
code worked fine on a normal java class???

On 7/26/07, David Smith [EMAIL PROTECTED] wrote:

 1. This can't be the complete jsp code.  If it is, you need to minimally
 wrap it in %% markers to indicate it's raw java code, not
 jsp/html.  Additionally your System.out.println() call would end up
 going to the JVM's standard output instead of the browser.

 2. The listed exception is really secondary to the main problem
 occurring whenever the jsp compile fails to generate a .class file.
 There has to be an earlier exception detailing the syntax problems with
 the jsp.

 --David

 Mohammed Zabin wrote:
  This is my jsp code:
  try {
   Class.forName(org.gjt.mm.mysql.Driver);
   String url = jdbc:mysql://localhost:3306/exam;
   Connection con = DriverManager.getConnection(url,root,
 exam);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(Select type from
  questions);
 
while( rs.next() ) {
   System.out.println( rs.getString(type) );
   }
 
   } catch( Exception e ) {
 }
 
  and this is what i got:
 
  *exception*
 
  org.apache.jasper.JasperException: org.apache.jasper.JasperException:
  Unable to load class for JSP
org.apache.jasper.servlet.JspServletWrapper.getServlet(
 JspServletWrapper.java:154)
org.apache.jasper.servlet.JspServletWrapper.service(
 JspServletWrapper.java:320)
org.apache.jasper.servlet.JspServlet.serviceJspFile(
 JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
   *root cause*
 
  org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.JspCompilationContext.load(
 JspCompilationContext.java:600)
org.apache.jasper.servlet.JspServletWrapper.getServlet(
 JspServletWrapper.java:142)
org.apache.jasper.servlet.JspServletWrapper.service(
 JspServletWrapper.java:320)
org.apache.jasper.servlet.JspServlet.serviceJspFile(
 JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
   *root cause*
 
  java.lang.ClassNotFoundException: org.apache.jsp.mySql_jsp
java.net.URLClassLoader$1.run(URLClassLoader.java:200)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java
 :134)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java
 :66)
org.apache.jasper.JspCompilationContext.load(
 JspCompilationContext.java:598)
org.apache.jasper.servlet.JspServletWrapper.getServlet(
 JspServletWrapper.java:142)
org.apache.jasper.servlet.JspServletWrapper.service(
 JspServletWrapper.java:320)
org.apache.jasper.servlet.JspServlet.serviceJspFile(
 JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
 
  Any suggestions, please?
 
  On 7/25/07, Christopher Schultz [EMAIL PROTECTED] wrote:
 
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
 
  Mohammed,
 
  Mohammed Zabin wrote:
 
  I have the following error:
 
  org.apache.jasper.JasperException: Unable to compile class for JSP:
 
  Uhh... you have a syntax error in your JSP code. Fix that, then we'll
  get back to configuration issues. You didn't give enough information to
  help with the JSP syntax error.
 
  - -chris
 
  -BEGIN PGP SIGNATURE-
  Version: GnuPG v1.4.7 (MingW32)
  Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
  iD8DBQFGp2lm9CaO5/Lv0PARAvlRAJ45KuixS2Fy75ssMLQLwUYhA+DjOACgtiTN
  nZhKt8DoIGh8UFwV+Ri6qWI=
  =syvt
  -END PGP SIGNATURE-
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: MySql Connector

2007-07-26 Thread Mohammed Zabin
This is my jsp code:
try {
 Class.forName(org.gjt.mm.mysql.Driver);
 String url = jdbc:mysql://localhost:3306/exam;
 Connection con = DriverManager.getConnection(url,root, exam);
  Statement stmt = con.createStatement();
  ResultSet rs = stmt.executeQuery(Select type from
questions);

  while( rs.next() ) {
 System.out.println( rs.getString(type) );
 }

 } catch( Exception e ) {
   }

and this is what i got:

*exception*

org.apache.jasper.JasperException: org.apache.jasper.JasperException:
Unable to load class for JSP

org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:154)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

 *root cause*

org.apache.jasper.JasperException: Unable to load class for JSP

org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:600)

org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:142)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

 *root cause*

java.lang.ClassNotFoundException: org.apache.jsp.mySql_jsp
java.net.URLClassLoader$1.run(URLClassLoader.java:200)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)

org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598)

org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:142)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


Any suggestions, please?

On 7/25/07, Christopher Schultz [EMAIL PROTECTED] wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Mohammed,

 Mohammed Zabin wrote:
  I have the following error:
 
  org.apache.jasper.JasperException: Unable to compile class for JSP:

 Uhh... you have a syntax error in your JSP code. Fix that, then we'll
 get back to configuration issues. You didn't give enough information to
 help with the JSP syntax error.

 - -chris

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.7 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFGp2lm9CaO5/Lv0PARAvlRAJ45KuixS2Fy75ssMLQLwUYhA+DjOACgtiTN
 nZhKt8DoIGh8UFwV+Ri6qWI=
 =syvt
 -END PGP SIGNATURE-

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Bean and Servlet

2007-07-26 Thread Mohammed Zabin
I have changed like this:

pageContext.getRequest().setAttribute(InQry, qry);

and retrieve it in the servlet like this:
inQry = (String)request.getAttribute(InQry);

But when using request attributes, inQry will be null when retrieved?


On 7/26/07, Mohammed Zabin [EMAIL PROTECTED] wrote:

 What do you suggest to overcome this problem?

 On 7/25/07, Caldarale, Charles R [EMAIL PROTECTED] wrote:
 
   From: Mohammed Zabin [mailto:[EMAIL PROTECTED]
   Subject: Re: Bean and Servlet
  
   I will tell you the procedure; At each time the user clickes
   the first page in the site, a random numbers will be generated
   and stored in the session.
 
  You're missing the point.  The user may click multiple times before the
  first request is even received by the webapp, or the browser may simply
  fire off multiple parallel requests, or the user may open multiple tabs
  for the same web site.  All of the above will result in multiple
  concurrent requests occurring for the same session.  Does your logic
  handle that properly?  The code snippet you posted does not.
 
  - Chuck
 
 
  THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 
  MATERIAL and is thus for use only by the intended recipient. If you
  received this in error, please contact the sender and delete the e-mail
  and its attachments from all computers.
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: Bean and Servlet

2007-07-26 Thread Mohammed Zabin
Well, I will descript the problem exactly. the first page use a tag class to
render a random question from database, and their possible answers, the user
must choose the right answer and submit the form for processing.

 I need the random question numbers, which are question ids to
*Results*servlet.
*Results* servlet is a servlet that must display the same questions that was
displayed in the Questions page to run a query against the database to
display the questions and the correct and wrong answers.

My Problem is that, I want to pass these numbers, Questions IDs, from the
first page, which i have made it as a tag class, to Results page, which was
made as servlet. I tried to use request.setAttribute(Ids, ids); but when
retrieve it in Results servlet, I got *null. *

 That was my problem my buddy, by the way, when i used session, it worked
fine. and you stated that this will not work, but i think that storing these
ids in a session is a good choice, isn't it?

If you have any comments please post it.


On 7/26/07, Caldarale, Charles R [EMAIL PROTECTED] wrote:

  From: Mohammed Zabin [mailto:[EMAIL PROTECTED]
  Subject: Re: Bean and Servlet
 
  What do you suggest to overcome this problem?

 In the seven messages you've posted in this thread, you've never really
 explained what this attribute is being used for; nor have you answered
 the question of whether or not it's used only for the duration of a
 single request or is applicable to everything a given user does with
 this particular webapp.

 Until you give us some idea of what your intent is (as opposed to code
 snippets), I don't think anyone can really answer your questions.

 If you do need to store attributes in a session, you will need at least
 some synchronization logic to see if the attribute is already present,
 since multiple requests can easily be using the Session object
 concurrently.

 - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you
 received this in error, please contact the sender and delete the e-mail
 and its attachments from all computers.

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: MySql Connector

2007-07-25 Thread Mohammed Zabin

For test purposes, i have wrote the following code as a java program and it
worked fine, but when I tried it in a jsp page i got the following error:

Class.forName(com.mysql.jdbc.Driver);
String url = jdbc:mysql://localhost:3306/exam;
Connection con = DriverManager.getConnection(url,root, exam);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(Select type from questions);

while( rs.next() ) {
System.out.println( rs.getString(type) );
}


org.apache.jasper.JasperException: Unable to compile class for JSP:



Stacktrace:

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)

org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



On 7/25/07, Mohammed Zabin [EMAIL PROTECTED] wrote:


In cotrast, i have installed Oracle and worked very well, but MySql didn't
work with me. I am using Connecter/J from MySql website, the beta version, I
put the jar file in the CATALINA_HOME/lib, and i add it to the CLASSPATH.
and I followed the instructions provided in Tomcat documentation, exactly,
Didn't work :(

On 7/24/07, David Smith [EMAIL PROTECTED] wrote:

 I've never dealt with Oracle but have done a lot of MySQL installs
 without a single failure.  Your config outside of the web.xml doesn't
 look wrong in any way.

 You might want to put the resource-ref block in your web.xml as
 described in the how-to's.  It doesn't hurt and is part of the servlet
 spec.

 --David


 Mohammed Zabin wrote:

  No, the same error, You know what David?? I put nothing in web.xml, I
 am
  confused about this issue, when to use web.xml, and it might be the
  reason
  behind the unsuccessfull MySql Connection, I follow the same procedure
 I
  followed to configure Oracle DBCP, I think it must work for MySql,
 right?
 
  On 7/24/07, David Smith [EMAIL PROTECTED] wrote:
 
 
  Try this variant of your code:
 
  Context initContext = new InitialContext();
  DataSource ds  =
  (DataSource)initContext.lookup(java:comp/env/jdbc/TestMySql);
  Connection conn = ds.getConnection ();
 
  out.println(Connection Established);
 
  Essentially when you lookup java:comp/env/jdbc/TestMySql, that's the
  full JNDI path to the DataSource and returns a DataSource type
 object,
  not a Context type object.
 
  --David
 
  Mohammed Zabin wrote:
 
   Ok thank you, I did the following as you have stated:
  
   1. in server.xml:
   Resource name=jdbc/TestMySql auth=Container
   type=javax.sql.DataSource
 maxActive=100 maxIdle=30 maxWait=1
 username=root password=exam driverClassName=
   com.mysql.jdbc.Driver
 url=jdbc:mysql://localhost:3306/exam/
   2. in context.xml
   ResourceLink global=jdbc/TestMySql name=jdbc/TestMySql type=
   javax.sql.DataSource/
  
   3. in my test page:
Context initContext = new InitialContext();
Context envContext  =
   (Context)initContext.lookup(java:comp/env/jdbc/TestMySql);
DataSource ds = (DataSource)envContext.lookup(jdbc/TestMySql);
Connection conn = ds.getConnection();
  
out.println(Connection Established);
   And i put nothing in web.xml, I have the following error:
  
   org.apache.jasper.JasperException: Unable to compile class for JSP:
  
  
  
   Stacktrace:
   org.apache.jasper.compiler.DefaultErrorHandler.javacError (
  DefaultErrorHandler.java:85)
  
   org.apache.jasper.compiler.ErrorDispatcher.javacError(
  ErrorDispatcher.java:330)
  
   org.apache.jasper.compiler.JDTCompiler.generateClass (
  JDTCompiler.java:415)
  
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
   org.apache.jasper.JspCompilationContext.compile(
  JspCompilationContext.java:566)
  
   org.apache.jasper.servlet.JspServletWrapper.service(
  JspServletWrapper.java:308)
  
  
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
  :320)
  
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java
 :266)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  
  
  
   On 7/23/07, David Smith [EMAIL PROTECTED] wrote:
  
  
   A few things to consider:
  
   1

Re: MySql Connector

2007-07-25 Thread Mohammed Zabin

This is all the exception message, I looked inside logs folder, i found an
empty file, it continas nothing :~

On 7/25/07, David Smith [EMAIL PROTECTED] wrote:


Your stack trace appears to be incomplete.  Could you post more?  It
appears to be a compile error and should cite the code in question.

--David

Mohammed Zabin wrote:
 For test purposes, i have wrote the following code as a java program
 and it
 worked fine, but when I tried it in a jsp page i got the following
error:

 Class.forName(com.mysql.jdbc.Driver);
 String url = jdbc:mysql://localhost:3306/exam;
 Connection con = DriverManager.getConnection(url,root, exam);
 Statement stmt = con.createStatement();
 ResultSet rs = stmt.executeQuery(Select type from questions);

 while( rs.next() ) {
 System.out.println( rs.getString(type) );
 }


 org.apache.jasper.JasperException: Unable to compile class for JSP:



 Stacktrace:
 org.apache.jasper.compiler.DefaultErrorHandler.javacError(
DefaultErrorHandler.java:85)

 org.apache.jasper.compiler.ErrorDispatcher.javacError(
ErrorDispatcher.java:330)

 org.apache.jasper.compiler.JDTCompiler.generateClass(
JDTCompiler.java:415)

 org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
 org.apache.jasper.JspCompilationContext.compile(
JspCompilationContext.java:566)

 org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:308)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
:320)

 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



 On 7/25/07, Mohammed Zabin [EMAIL PROTECTED] wrote:

 In cotrast, i have installed Oracle and worked very well, but MySql
 didn't
 work with me. I am using Connecter/J from MySql website, the beta
 version, I
 put the jar file in the CATALINA_HOME/lib, and i add it to the
 CLASSPATH.
 and I followed the instructions provided in Tomcat documentation,
 exactly,
 Didn't work :(

 On 7/24/07, David Smith [EMAIL PROTECTED] wrote:
 
  I've never dealt with Oracle but have done a lot of MySQL installs
  without a single failure.  Your config outside of the web.xml doesn't
  look wrong in any way.
 
  You might want to put the resource-ref block in your web.xml as
  described in the how-to's.  It doesn't hurt and is part of the
servlet
  spec.
 
  --David
 
 
  Mohammed Zabin wrote:
 
   No, the same error, You know what David?? I put nothing in
 web.xml, I
  am
   confused about this issue, when to use web.xml, and it might be the
   reason
   behind the unsuccessfull MySql Connection, I follow the same
 procedure
  I
   followed to configure Oracle DBCP, I think it must work for MySql,
  right?
  
   On 7/24/07, David Smith [EMAIL PROTECTED] wrote:
  
  
   Try this variant of your code:
  
   Context initContext = new InitialContext();
   DataSource ds  =
   (DataSource)initContext.lookup(java:comp/env/jdbc/TestMySql);
   Connection conn = ds.getConnection ();
  
   out.println(Connection Established);
  
   Essentially when you lookup java:comp/env/jdbc/TestMySql, that's
 the
   full JNDI path to the DataSource and returns a DataSource type
  object,
   not a Context type object.
  
   --David
  
   Mohammed Zabin wrote:
  
Ok thank you, I did the following as you have stated:
   
1. in server.xml:
Resource name=jdbc/TestMySql auth=Container
type=javax.sql.DataSource
  maxActive=100 maxIdle=30 maxWait=1
  username=root password=exam
 driverClassName=
com.mysql.jdbc.Driver
  url=jdbc:mysql://localhost:3306/exam/
2. in context.xml
ResourceLink global=jdbc/TestMySql name=jdbc/TestMySql
 type=
javax.sql.DataSource/
   
3. in my test page:
 Context initContext = new InitialContext();
 Context envContext  =
(Context)initContext.lookup(java:comp/env/jdbc/TestMySql);
 DataSource ds =
(DataSource)envContext.lookup(jdbc/TestMySql);
 Connection conn = ds.getConnection();
   
 out.println(Connection Established);
And i put nothing in web.xml, I have the following error:
   
org.apache.jasper.JasperException: Unable to compile class for
 JSP:
   
   
   
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError (
   DefaultErrorHandler.java:85)
   
org.apache.jasper.compiler.ErrorDispatcher.javacError(
   ErrorDispatcher.java:330)
   
org.apache.jasper.compiler.JDTCompiler.generateClass (
   JDTCompiler.java:415)
   
   
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
   
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
   
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(
   JspCompilationContext.java:566

Re: MySql Connector

2007-07-25 Thread Mohammed Zabin

I did this, but i think that there is an option to enable logging, do u know
it?

On 7/25/07, David Smith [EMAIL PROTECTED] wrote:


I'm starting to think there's something really funny (ie broken) with
your tomcat install.  Could you clean install another instance of tomcat
(preferably downloaded from the tomcat website) and check the code there?

--David

Mohammed Zabin wrote:
 This is all the exception message, I looked inside logs folder, i
 found an
 empty file, it continas nothing :~

 On 7/25/07, David Smith [EMAIL PROTECTED] wrote:

 Your stack trace appears to be incomplete.  Could you post more?  It
 appears to be a compile error and should cite the code in question.

 --David

 Mohammed Zabin wrote:
  For test purposes, i have wrote the following code as a java program
  and it
  worked fine, but when I tried it in a jsp page i got the following
 error:
 
  Class.forName(com.mysql.jdbc.Driver);
  String url = jdbc:mysql://localhost:3306/exam;
  Connection con = DriverManager.getConnection(url,root, exam);
  Statement stmt = con.createStatement();
  ResultSet rs = stmt.executeQuery(Select type from questions);
 
  while( rs.next() ) {
  System.out.println( rs.getString(type) );
  }
 
 
  org.apache.jasper.JasperException: Unable to compile class for JSP:
 
 
 
  Stacktrace:
  org.apache.jasper.compiler.DefaultErrorHandler.javacError(
 DefaultErrorHandler.java:85)
 
  org.apache.jasper.compiler.ErrorDispatcher.javacError(
 ErrorDispatcher.java:330)
 
  org.apache.jasper.compiler.JDTCompiler.generateClass(
 JDTCompiler.java:415)
 
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
  org.apache.jasper.JspCompilationContext.compile(
 JspCompilationContext.java:566)
 
  org.apache.jasper.servlet.JspServletWrapper.service(
 JspServletWrapper.java:308)
 
 
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
 :320)
 
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
 
 


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Bean and Servlet

2007-07-24 Thread Mohammed Zabin

Thank you I solve it using session, particularly:
pageContext.getSession().setAttribute(InQry, qry);

and retreive it in the servlet like this:
String inQry = (String)request.getSession().getAttribute(InQry);

But, I have a question regarding DBCP, it is not wrong to have more than one
CP, isn't it? I mean is it allowed to have a Resource for Oracle and another
for MySql?


On 7/24/07, David Smith [EMAIL PROTECTED] wrote:


Can you post the relevant parts of how/where you call this servlet?
I've never had a problem retrieving a request attribute after it was
added and before the end of the request.

--David

Mohammed Zabin wrote:
 Actually, I wanted to pass this list from within a Tag to be used inside
 another Servlet class, (i.e. the tag class after finishing rendering its
 elements, goes to a servlet, so, i need to pass this list to that
 servlet.
 As i have stated above, i used the following to store the list in the
 request object:

 [code]pageContext.getRequest().setAttribute(QList, list);[/code]

 In the servlet, i used the following to retrive the list:

 ListInteger list = (ListInteger)request.getAttribute(
 QList);

 I tried to access the above list by a small code snippet that prints its
 size:
 [code]out.println( list.size() );[/code]
 But i got an exception stating that a NullPointerException has occured
at
 the size printing statement. That's mean, i think, the list didn't
stored
 correctly in the request object, am I true?


 On 7/23/07, David Smith [EMAIL PROTECTED] wrote:

 Typical design is servlet forwarding to jsp for view.  Tags being jsp
 elements occur after servlets have executed.  So you can see how your
 problem is a little curious in that jsps don't typically forward to
 servlets.  If you are forwarding a request from jsp to servlet, let us
 know.

 However if you are storing a object in a request during jsp execution
 intending it to be available to the servlet on the next request, that
 doesn't work.  The request is cleared and recycled when jsps finish
 writing to the client.  When a new request comes in, the request
 attribute list is empty.  If you need this list to live between
 requests, you need to place it in the session.

 --David

 Mohammed Zabin wrote:

  Thank you Johnny,
  To be specific this is my question
  Hi all
 
  I am trying to pass an object from a tag to a servlet. i did the
  following,
 
  1. In the tag class, i put:
 
  pageContext.getRequest().setAttribute(QList, list);
 
 
 
  The above Tag will go to a servlet, i need to read the above request
  attribute in the servlet, how can i do this?, i tried
 
  ListInteger list = (ListInteger)request.getAttribute(QList);
 
  , but when i tried to access the read list, it gave me
  NullPointerException...What do u think?
 
 
  On 7/23/07, Johnny Kewl [EMAIL PROTECTED] wrote:
 
 
  Hi Mohammed,
  Cant say I really understand the question
 
  In general this is what the Session Objects are for
  So say you have a servlet and a JSP page and say the servlet
  makes the
  bean with the Array List in it then if you
 
  session.setAttribute(MyBean, MyBean);
 
  you can get it (MyBean) back when the next call comes into say the
 JSP
  page
 
  Now if you read up on this you will see you can also set 'request'
  objects and these are good for when you say dispatch a request
 to a
  JSP
  page from the servlet and want to pass a bean across.
 
  Anyway...  if you just google for servlet session and
 setAttribute
  you
  will be on your way... I think ;)
  This area of servlet programming is one of the things that make it
  such a
  powerful technology.
  Have fun...
 
  - Original Message -
  From: Mohammed Zabin [EMAIL PROTECTED]
  To: Tomcat Users List users@tomcat.apache.org
  Sent: Monday, July 23, 2007 11:18 AM
  Subject: Bean and Servlet
 
 
   Hi All
   What is the best way to pass a list collection from a Bean to a
  Servlet?
   Thank you
  
 
 
 
-
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: MySql Connector

2007-07-24 Thread Mohammed Zabin

Ok thank you, I did the following as you have stated:

1. in server.xml:
Resource name=jdbc/TestMySql auth=Container type=javax.sql.DataSource
  maxActive=100 maxIdle=30 maxWait=1
  username=root password=exam driverClassName=
com.mysql.jdbc.Driver
  url=jdbc:mysql://localhost:3306/exam/
2. in context.xml
ResourceLink global=jdbc/TestMySql name=jdbc/TestMySql type=
javax.sql.DataSource/

3. in my test page:
 Context initContext = new InitialContext();
 Context envContext  =
(Context)initContext.lookup(java:comp/env/jdbc/TestMySql);
 DataSource ds = (DataSource)envContext.lookup(jdbc/TestMySql);
 Connection conn = ds.getConnection();

 out.println(Connection Established);
And i put nothing in web.xml, I have the following error:

org.apache.jasper.JasperException: Unable to compile class for JSP:



Stacktrace:

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)

org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



On 7/23/07, David Smith [EMAIL PROTECTED] wrote:


A few things to consider:

1. Either place your Resource definition in server.xml as a
GlobalResource *OR* in your webapp's context.xml file.

2. If you have the Resource defined in the GlobalResources, that's the
only time you need to use a ResourceLink element in context.xml.

3. Drop the autoReconnect parameter in your mysql URL.  It has it's
uses, but not in a pooled environment.

4. You should probably be attempting to use the path
java:comp/env/jdbc/TestMySQL (note the lack of a '/' before comp) as
described in the JNDI howto on tomcat's website.  I think I saw you
using java:/comp/env/jdbc/TestMySQL in one of your posts.

5. Please post relevant messages from your logs if this isn't working.

--David

Mohammed Zabin wrote:

 Would you please be more specific? which file you mean? I have created
 Oracel connection Pool as the stated way above, and it's worked fine,
 shall
 i put resource defeninitoin in context.xml only?

 On 7/22/07, Pid [EMAIL PROTECTED] wrote:


 You only need one resource definition.
 You only need a resource link definition if your resource is a global
 one.

 Simplify your configuration and then post the error message from the
 logs so we can see Tomcat says is wrong.

 p


 Mohammed Zabin wrote:
  Hi All
 
  I have confiured oracle connection pool on my tomacat 6, and it
worked
  fine.
  When i came to configure MySql, I repeated the same steps for Oracle
  databse, with considering the specfication of MySql database. But
it's
  didn't work. Any Help please about configuring MySql,
  I downloaded MySql connector from mysql website and place it in
  CATALINA_HOME/lib directory, and i put the following:
 
  1. in server.xml file:
  Resource name=jdbc/TestMySql auth=Container
  type=javax.sql.DataSource
maxActive=100 maxIdle=30 maxWait=1
username=* password=* driverClassName=
  com.mysql.jdbc.Driver
 
  url=jdbc:mysql://localhost:3306/exam?autoReconnect=true/
 
  2. in web.xml file
  resource-ref
   descriptionOracle Datasource example/description
   res-ref-namejdbc/TestMySql/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
  /resource-ref
 
  3. in context.xml file (on server's context.xml file):
  Resource name=jdbc/TestMySql auth=Container
  type=javax.sql.DataSource
 maxActive=100 maxIdle=30 maxWait=1
 username=* password=* driverClassName=
  com.mysql.jdbc.Driver
 url=jdbc:mysql://localhost:3306/exam/
 
  4. in cotext.xml file ( In my web application's context.xml file):
  ResourceLink global=jdbc/TestMySql name=jdbc/TestMySql type=
  javax.sql.DataSource/
 
  Any Help please?
 






-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: MySql Connector

2007-07-24 Thread Mohammed Zabin

No, the same error, You know what David?? I put nothing in web.xml, I am
confused about this issue, when to use web.xml, and it might be the reason
behind the unsuccessfull MySql Connection, I follow the same procedure I
followed to configure Oracle DBCP, I think it must work for MySql, right?

On 7/24/07, David Smith [EMAIL PROTECTED] wrote:


Try this variant of your code:

Context initContext = new InitialContext();
DataSource ds  =
(DataSource)initContext.lookup(java:comp/env/jdbc/TestMySql);
Connection conn = ds.getConnection();

out.println(Connection Established);

Essentially when you lookup java:comp/env/jdbc/TestMySql, that's the
full JNDI path to the DataSource and returns a DataSource type object,
not a Context type object.

--David

Mohammed Zabin wrote:

 Ok thank you, I did the following as you have stated:

 1. in server.xml:
 Resource name=jdbc/TestMySql auth=Container
 type=javax.sql.DataSource
   maxActive=100 maxIdle=30 maxWait=1
   username=root password=exam driverClassName=
 com.mysql.jdbc.Driver
   url=jdbc:mysql://localhost:3306/exam/
 2. in context.xml
 ResourceLink global=jdbc/TestMySql name=jdbc/TestMySql type=
 javax.sql.DataSource/

 3. in my test page:
  Context initContext = new InitialContext();
  Context envContext  =
 (Context)initContext.lookup(java:comp/env/jdbc/TestMySql);
  DataSource ds = (DataSource)envContext.lookup(jdbc/TestMySql);
  Connection conn = ds.getConnection();

  out.println(Connection Established);
 And i put nothing in web.xml, I have the following error:

 org.apache.jasper.JasperException: Unable to compile class for JSP:



 Stacktrace:
 org.apache.jasper.compiler.DefaultErrorHandler.javacError(
DefaultErrorHandler.java:85)

 org.apache.jasper.compiler.ErrorDispatcher.javacError(
ErrorDispatcher.java:330)

 org.apache.jasper.compiler.JDTCompiler.generateClass(
JDTCompiler.java:415)

 org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
 org.apache.jasper.JspCompilationContext.compile(
JspCompilationContext.java:566)

 org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:308)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
:320)

 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



 On 7/23/07, David Smith [EMAIL PROTECTED] wrote:


 A few things to consider:

 1. Either place your Resource definition in server.xml as a
 GlobalResource *OR* in your webapp's context.xml file.

 2. If you have the Resource defined in the GlobalResources, that's the
 only time you need to use a ResourceLink element in context.xml.

 3. Drop the autoReconnect parameter in your mysql URL.  It has it's
 uses, but not in a pooled environment.

 4. You should probably be attempting to use the path
 java:comp/env/jdbc/TestMySQL (note the lack of a '/' before comp) as
 described in the JNDI howto on tomcat's website.  I think I saw you
 using java:/comp/env/jdbc/TestMySQL in one of your posts.

 5. Please post relevant messages from your logs if this isn't working.

 --David

 Mohammed Zabin wrote:

  Would you please be more specific? which file you mean? I have
created
  Oracel connection Pool as the stated way above, and it's worked fine,
  shall
  i put resource defeninitoin in context.xml only?
 
  On 7/22/07, Pid [EMAIL PROTECTED] wrote:
 
 
  You only need one resource definition.
  You only need a resource link definition if your resource is a
global
  one.
 
  Simplify your configuration and then post the error message from the
  logs so we can see Tomcat says is wrong.
 
  p
 
 
  Mohammed Zabin wrote:
   Hi All
  
   I have confiured oracle connection pool on my tomacat 6, and it
 worked
   fine.
   When i came to configure MySql, I repeated the same steps for
 Oracle
   databse, with considering the specfication of MySql database. But
 it's
   didn't work. Any Help please about configuring MySql,
   I downloaded MySql connector from mysql website and place it in
   CATALINA_HOME/lib directory, and i put the following:
  
   1. in server.xml file:
   Resource name=jdbc/TestMySql auth=Container
   type=javax.sql.DataSource
 maxActive=100 maxIdle=30 maxWait=1
 username=* password=* driverClassName=
   com.mysql.jdbc.Driver
  
   url=jdbc:mysql://localhost:3306/exam?autoReconnect=true/
  
   2. in web.xml file
   resource-ref
descriptionOracle Datasource example/description
res-ref-namejdbc/TestMySql/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
   /resource-ref
  
   3. in context.xml file (on server's context.xml file):
   Resource name=jdbc/TestMySql auth=Container
   type=javax.sql.DataSource

Re: Bean and Servlet

2007-07-24 Thread Mohammed Zabin

I will tell you the procedure; At each time the user clickes the first page
in the site, a random numbers will be generated and stored in the session.
So, i think that each user has its own numbers, right?

On 7/24/07, Caldarale, Charles R [EMAIL PROTECTED] wrote:


 From: Mohammed Zabin [mailto:[EMAIL PROTECTED]
 Subject: Re: Bean and Servlet

 Thank you I solve it using session, particularly:
 pageContext.getSession().setAttribute(InQry, qry);

Are you sure you want to do that?  If multiple requests from the browser
are being processed concurrently, any data at session scope will be
shared amongst them.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: MySql Connector

2007-07-24 Thread Mohammed Zabin

In cotrast, i have installed Oracle and worked very well, but MySql didn't
work with me. I am using Connecter/J from MySql website, the beta version, I
put the jar file in the CATALINA_HOME/lib, and i add it to the CLASSPATH.
and I followed the instructions provided in Tomcat documentation, exactly,
Didn't work :(

On 7/24/07, David Smith [EMAIL PROTECTED] wrote:


I've never dealt with Oracle but have done a lot of MySQL installs
without a single failure.  Your config outside of the web.xml doesn't
look wrong in any way.

You might want to put the resource-ref block in your web.xml as
described in the how-to's.  It doesn't hurt and is part of the servlet
spec.

--David


Mohammed Zabin wrote:

 No, the same error, You know what David?? I put nothing in web.xml, I am
 confused about this issue, when to use web.xml, and it might be the
 reason
 behind the unsuccessfull MySql Connection, I follow the same procedure I
 followed to configure Oracle DBCP, I think it must work for MySql,
right?

 On 7/24/07, David Smith [EMAIL PROTECTED] wrote:


 Try this variant of your code:

 Context initContext = new InitialContext();
 DataSource ds  =
 (DataSource)initContext.lookup(java:comp/env/jdbc/TestMySql);
 Connection conn = ds.getConnection();

 out.println(Connection Established);

 Essentially when you lookup java:comp/env/jdbc/TestMySql, that's the
 full JNDI path to the DataSource and returns a DataSource type object,
 not a Context type object.

 --David

 Mohammed Zabin wrote:

  Ok thank you, I did the following as you have stated:
 
  1. in server.xml:
  Resource name=jdbc/TestMySql auth=Container
  type=javax.sql.DataSource
maxActive=100 maxIdle=30 maxWait=1
username=root password=exam driverClassName=
  com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/exam/
  2. in context.xml
  ResourceLink global=jdbc/TestMySql name=jdbc/TestMySql type=
  javax.sql.DataSource/
 
  3. in my test page:
   Context initContext = new InitialContext();
   Context envContext  =
  (Context)initContext.lookup(java:comp/env/jdbc/TestMySql);
   DataSource ds = (DataSource)envContext.lookup(jdbc/TestMySql);
   Connection conn = ds.getConnection();
 
   out.println(Connection Established);
  And i put nothing in web.xml, I have the following error:
 
  org.apache.jasper.JasperException: Unable to compile class for JSP:
 
 
 
  Stacktrace:
  org.apache.jasper.compiler.DefaultErrorHandler.javacError(
 DefaultErrorHandler.java:85)
 
  org.apache.jasper.compiler.ErrorDispatcher.javacError(
 ErrorDispatcher.java:330)
 
  org.apache.jasper.compiler.JDTCompiler.generateClass(
 JDTCompiler.java:415)
 
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
  org.apache.jasper.JspCompilationContext.compile(
 JspCompilationContext.java:566)
 
  org.apache.jasper.servlet.JspServletWrapper.service(
 JspServletWrapper.java:308)
 
 
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
 :320)
 
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
 
 
  On 7/23/07, David Smith [EMAIL PROTECTED] wrote:
 
 
  A few things to consider:
 
  1. Either place your Resource definition in server.xml as a
  GlobalResource *OR* in your webapp's context.xml file.
 
  2. If you have the Resource defined in the GlobalResources, that's
 the
  only time you need to use a ResourceLink element in context.xml.
 
  3. Drop the autoReconnect parameter in your mysql URL.  It has it's
  uses, but not in a pooled environment.
 
  4. You should probably be attempting to use the path
  java:comp/env/jdbc/TestMySQL (note the lack of a '/' before comp) as
  described in the JNDI howto on tomcat's website.  I think I saw you
  using java:/comp/env/jdbc/TestMySQL in one of your posts.
 
  5. Please post relevant messages from your logs if this isn't
 working.
 
  --David
 
  Mohammed Zabin wrote:
 
   Would you please be more specific? which file you mean? I have
 created
   Oracel connection Pool as the stated way above, and it's worked
 fine,
   shall
   i put resource defeninitoin in context.xml only?
  
   On 7/22/07, Pid [EMAIL PROTECTED] wrote:
  
  
   You only need one resource definition.
   You only need a resource link definition if your resource is a
 global
   one.
  
   Simplify your configuration and then post the error message
 from the
   logs so we can see Tomcat says is wrong.
  
   p
  
  
   Mohammed Zabin wrote:
Hi All
   
I have confiured oracle connection pool on my tomacat 6, and it
  worked
fine.
When i came to configure MySql, I repeated the same steps for
  Oracle
databse, with considering the specfication of MySql database.
 But
  it's
didn't work. Any Help please about configuring

Bean and Servlet

2007-07-23 Thread Mohammed Zabin

Hi All
What is the best way to pass a list collection from a Bean to a Servlet?
Thank you


Tags and Servlets

2007-07-23 Thread Mohammed Zabin

Hi all

I am trying to pass an object from a tag to a servlet. i did the following,

1. In the tag class, i put:

pageContext.getRequest().setAttribute(QList, list);



The above Tag will go to a servlet, i need to read the above request
attribute in the servlet, how can i do this?, i tried

ListInteger list = (ListInteger)request.getAttribute(QList);

, but when i tried to access the read list, it gave me NullPointerException,


any help please

Jotnarta


Re: Bean and Servlet

2007-07-23 Thread Mohammed Zabin

Thank you Johnny,
To be specific this is my question
Hi all

I am trying to pass an object from a tag to a servlet. i did the following,

1. In the tag class, i put:

pageContext.getRequest().setAttribute(QList, list);



The above Tag will go to a servlet, i need to read the above request
attribute in the servlet, how can i do this?, i tried

ListInteger list = (ListInteger)request.getAttribute(QList);

, but when i tried to access the read list, it gave me
NullPointerException...What do u think?


On 7/23/07, Johnny Kewl [EMAIL PROTECTED] wrote:


Hi Mohammed,
Cant say I really understand the question

In general this is what the Session Objects are for
So say you have a servlet and a JSP page and say the servlet makes the
bean with the Array List in it then if you

session.setAttribute(MyBean, MyBean);

you can get it (MyBean) back when the next call comes into say the JSP
page

Now if you read up on this you will see you can also set 'request'
objects and these are good for when you say dispatch a request to a
JSP
page from the servlet and want to pass a bean across.

Anyway...  if you just google for servlet session and setAttribute
you
will be on your way... I think ;)
This area of servlet programming is one of the things that make it such a
powerful technology.
Have fun...

- Original Message -
From: Mohammed Zabin [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, July 23, 2007 11:18 AM
Subject: Bean and Servlet


 Hi All
 What is the best way to pass a list collection from a Bean to a Servlet?
 Thank you



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




MySql Connector

2007-07-22 Thread Mohammed Zabin

Hi All

I have confiured oracle connection pool on my tomacat 6, and it worked fine.
When i came to configure MySql, I repeated the same steps for Oracle
databse, with considering the specfication of MySql database. But it's
didn't work. Any Help please about configuring MySql,
I downloaded MySql connector from mysql website and place it in
CATALINA_HOME/lib directory, and i put the following:

1. in server.xml file:
Resource name=jdbc/TestMySql auth=Container type=javax.sql.DataSource
  maxActive=100 maxIdle=30 maxWait=1
  username=root password=exam driverClassName=
com.mysql.jdbc.Driver

url=jdbc:mysql://localhost:3306/exam?autoReconnect=true/

2. in web.xml file
resource-ref
 descriptionOracle Datasource example/description
 res-ref-namejdbc/TestMySql/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainer/res-auth
/resource-ref

3. in context.xml file (on server's context.xml file):
Resource name=jdbc/TestMySql auth=Container type=javax.sql.DataSource
   maxActive=100 maxIdle=30 maxWait=1
   username=root password=exam driverClassName=
com.mysql.jdbc.Driver
   url=jdbc:mysql://localhost:3306/exam/

4. in cotext.xml file ( In my web application's context.xml file):
ResourceLink global=jdbc/TestMySql name=jdbc/TestMySql type=
javax.sql.DataSource/

Any Help please?


Re: MySql Connector

2007-07-22 Thread Mohammed Zabin

Would you please be more specific? which file you mean? I have created
Oracel connection Pool as the stated way above, and it's worked fine, shall
i put resource defeninitoin in context.xml only?

On 7/22/07, Pid [EMAIL PROTECTED] wrote:


You only need one resource definition.
You only need a resource link definition if your resource is a global one.

Simplify your configuration and then post the error message from the
logs so we can see Tomcat says is wrong.

p


Mohammed Zabin wrote:
 Hi All

 I have confiured oracle connection pool on my tomacat 6, and it worked
 fine.
 When i came to configure MySql, I repeated the same steps for Oracle
 databse, with considering the specfication of MySql database. But it's
 didn't work. Any Help please about configuring MySql,
 I downloaded MySql connector from mysql website and place it in
 CATALINA_HOME/lib directory, and i put the following:

 1. in server.xml file:
 Resource name=jdbc/TestMySql auth=Container
 type=javax.sql.DataSource
   maxActive=100 maxIdle=30 maxWait=1
   username=* password=* driverClassName=
 com.mysql.jdbc.Driver

 url=jdbc:mysql://localhost:3306/exam?autoReconnect=true/

 2. in web.xml file
 resource-ref
  descriptionOracle Datasource example/description
  res-ref-namejdbc/TestMySql/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
 /resource-ref

 3. in context.xml file (on server's context.xml file):
 Resource name=jdbc/TestMySql auth=Container
 type=javax.sql.DataSource
maxActive=100 maxIdle=30 maxWait=1
username=* password=* driverClassName=
 com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/exam/

 4. in cotext.xml file ( In my web application's context.xml file):
 ResourceLink global=jdbc/TestMySql name=jdbc/TestMySql type=
 javax.sql.DataSource/

 Any Help please?






Re: MySql Connector

2007-07-22 Thread Mohammed Zabin

Thank you, what about testing the connection, i am afraid that the test code
is the reason:

Context initContext = new InitialContext();
 Context envContext  = (Context)initContext.lookup(java:/comp/env);
 DataSource ds = (DataSource)envContext.lookup(jdbc/TestMySql);
 Connection conn = ds.getConnection();

 out.println(Connection Established);

what is java:/comp/env??

On 7/22/07, Pid [EMAIL PROTECTED] wrote:


You can define either:

a) Resource inside a Context - either in META-INF/context.xml or
host/appname.xml

b) ResourceLink inside a Context (as above) referring to a global
Resource defined in server.xml.

You're doing both at the moment, so one of them isn't being used,
depending on where you placed the Resource in server.xml.

Just defining a Resource inside your META-INF/context.xml and the
corresponding WEB-INF/web.xml reference should be sufficient.



p




Mohammed Zabin wrote:
 Would you please be more specific? which file you mean? I have created
 Oracel connection Pool as the stated way above, and it's worked fine,
shall
 i put resource defeninitoin in context.xml only?

 On 7/22/07, Pid [EMAIL PROTECTED] wrote:

 You only need one resource definition.
 You only need a resource link definition if your resource is a global
 one.

 Simplify your configuration and then post the error message from the
 logs so we can see Tomcat says is wrong.

 p


 Mohammed Zabin wrote:
  Hi All
 
  I have confiured oracle connection pool on my tomacat 6, and it
worked
  fine.
  When i came to configure MySql, I repeated the same steps for Oracle
  databse, with considering the specfication of MySql database. But
it's
  didn't work. Any Help please about configuring MySql,
  I downloaded MySql connector from mysql website and place it in
  CATALINA_HOME/lib directory, and i put the following:
 
  1. in server.xml file:
  Resource name=jdbc/TestMySql auth=Container
  type=javax.sql.DataSource
maxActive=100 maxIdle=30 maxWait=1
username=* password=* driverClassName=
  com.mysql.jdbc.Driver
 
  url=jdbc:mysql://localhost:3306/exam?autoReconnect=true/
 
  2. in web.xml file
  resource-ref
   descriptionOracle Datasource example/description
   res-ref-namejdbc/TestMySql/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
  /resource-ref
 
  3. in context.xml file (on server's context.xml file):
  Resource name=jdbc/TestMySql auth=Container
  type=javax.sql.DataSource
 maxActive=100 maxIdle=30 maxWait=1
 username=* password=* driverClassName=
  com.mysql.jdbc.Driver
 url=jdbc:mysql://localhost:3306/exam/
 
  4. in cotext.xml file ( In my web application's context.xml file):
  ResourceLink global=jdbc/TestMySql name=jdbc/TestMySql type=
  javax.sql.DataSource/
 
  Any Help please?
 









Paging

2007-07-09 Thread Mohammed Zabin

Hi All

I want to ask about ResultSet paging. I mean, displaying your records on
multiple of pages instead of dumping them all in one page.
In ASP using ADO 2, there is a property called page size, when you set the
property, your recordset will determine how many page your recordset will be
displayed.

My questiion is, how could i implement paging using JDBC, is there such
property in JDBC?

Thank You


Redirection

2007-07-04 Thread Mohammed Zabin

Hi Everybody

I have a servlet that renders some database related values, at the botton of
the page, i want to add a hyberlink to a jsp page, and i want pass to this
jsp page, and i want to pass some values from servlet to jsp???

How could i do this, any help please?

Jotnarta


Re: Redirection

2007-07-04 Thread Mohammed Zabin

Thanks, seems spanish ;), I live Spain, am learning spanish language now,
Gratias,

EL java es Aburrido


On 7/4/07, David Delbecq [EMAIL PROTECTED] wrote:


String url =
response.encodeURL
(/path/to/jsp.jsp?paramX=someValueparamY=someOtherValue);

En l'instant précis du 04/07/07 09:20, Mohammed Zabin s'exprimait en ces
termes:
 Hi Everybody

 I have a servlet that renders some database related values, at the
 botton of
 the page, i want to add a hyberlink to a jsp page, and i want pass to
 this
 jsp page, and i want to pass some values from servlet to jsp???

 How could i do this, any help please?

 Jotnarta



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Redirection

2007-07-04 Thread Mohammed Zabin

Thank you again,

But I want to add a hyber link, that when clicked will transfer the user to
a jsp page, like this:

Click Here for example. how could i do this??


On 7/4/07, David Delbecq [EMAIL PROTECTED] wrote:


String url =
response.encodeURL
(/path/to/jsp.jsp?paramX=someValueparamY=someOtherValue);

En l'instant précis du 04/07/07 09:20, Mohammed Zabin s'exprimait en ces
termes:
 Hi Everybody

 I have a servlet that renders some database related values, at the
 botton of
 the page, i want to add a hyberlink to a jsp page, and i want pass to
 this
 jsp page, and i want to pass some values from servlet to jsp???

 How could i do this, any help please?

 Jotnarta



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Redirection

2007-07-04 Thread Mohammed Zabin

No, it's not what i wanted :)

I have a servlet page with the following address

http://localhost:8080/Exam/servlets/results

in this servlet page, results, i have a hyperlink: *Click Here To view your
Results*

This link is designated to navigate to a jsp page with the following
address:

http://localhost:80808/Exam/jsp/results.jsp

my question is, how could this hyperlink go correctly from within the
servlet page (results) to a jsp page (results.jsp)

Thank you

On 7/4/07, David Delbecq [EMAIL PROTECTED] wrote:


Sorry, it's not spanish but french, totally unrelated languages

as for how to create an hyperlink, just open an html book and look for tag
a href=../a
En l'instant précis du 04/07/07 11:58, Mohammed Zabin s'exprimait en ces
termes:
 Thanks, seems spanish ;), I live Spain, am learning spanish language
now,
 Gratias,

 EL java es Aburrido


 On 7/4/07, David Delbecq [EMAIL PROTECTED] wrote:

 String url =
 response.encodeURL
 (/path/to/jsp.jsp?paramX=someValueparamY=someOtherValue);

 En l'instant précis du 04/07/07 09:20, Mohammed Zabin s'exprimait en
ces
 termes:
  Hi Everybody
 
  I have a servlet that renders some database related values, at the
  botton of
  the page, i want to add a hyberlink to a jsp page, and i want pass to
  this
  jsp page, and i want to pass some values from servlet to jsp???
 
  How could i do this, any help please?
 
  Jotnarta
 


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Redirection

2007-07-04 Thread Mohammed Zabin

Yes Thank you, I found it from your first response, *response.encodeURL*,
Thank you Buddy, my greetings for Sarkoozi ;)

On 7/4/07, Mohammed Zabin [EMAIL PROTECTED] wrote:


No, it's not what i wanted :)

I have a servlet page with the following address

http://localhost:8080/Exam/servlets/results

in this servlet page, results, i have a hyperlink: *Click Here To view
your Results*

This link is designated to navigate to a jsp page with the following
address:

http://localhost:80808/Exam/jsp/results.jsp

my question is, how could this hyperlink go correctly from within the
servlet page (results) to a jsp page (results.jsp)

Thank you

 On 7/4/07, David Delbecq [EMAIL PROTECTED] wrote:

 Sorry, it's not spanish but french, totally unrelated languages

 as for how to create an hyperlink, just open an html book and look for
 tag
 a href=../a
 En l'instant précis du 04/07/07 11:58, Mohammed Zabin s'exprimait en ces
 termes:
  Thanks, seems spanish ;), I live Spain, am learning spanish language
 now,
  Gratias,
 
  EL java es Aburrido
 
 
  On 7/4/07, David Delbecq [EMAIL PROTECTED] wrote:
 
  String url =
  response.encodeURL
  (/path/to/jsp.jsp?paramX=someValueparamY=someOtherValue);
 
  En l'instant précis du 04/07/07 09:20, Mohammed Zabin s'exprimait en
 ces
  termes:
   Hi Everybody
  
   I have a servlet that renders some database related values, at the
   botton of
   the page, i want to add a hyberlink to a jsp page, and i want pass
 to
   this
   jsp page, and i want to pass some values from servlet to jsp???
  
   How could i do this, any help please?
  
   Jotnarta
  
 
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





Performance

2007-06-25 Thread Mohammed Zabin

Hi All
I have developed a web site that opens a recordset at start, and while
looping through records of the main ResultSet i Open a new ResultSet for
each record, to get a specific information, then close it. like this:

while( rs.next() ) {
  Statement stmt = dbConn.createStatement();
  ResultSet newRs = stmt.executeQuery(SOME QUERY);
  ..
  .
  *Some Code Here*
  .
  .

  stmt.close();
  newRs.close();
}

I feel that this way is resource-consuming, is it or not, and if it is, what
is the best way to code this code??

Thanks


Re: Null

2007-06-24 Thread Mohammed Zabin

Thank you very much for your detailed illustration. But the compiler
complies that there is no such methods isNull() and wasNull()
???


On 6/21/07, Reinhardt Christiansen [EMAIL PROTECTED] wrote:



- Original Message -
From: Mohammed Zabin [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Thursday, June 21, 2007 6:45 AM
Subject: Null


 Hi All

 Anyone knows how to deal with null values in JDBC ResultSet??

 I am trying to render a table in jsp page that read its value from the
 database, sometimes, the database returns null values, and so, the whole
 table couldn't be rendered. Is there any way to deal with null values.


The correct way to detect nulls in a JDBC ResultSet is rather different
from
the replies you've had so far. You should detect the presence of nulls in
a
given result set row by using the ResultSet.isNull() method.

So, let's say that we have a result set called 'rs' (you will probably
have
used a Statement or PreparedStatement or some other technique to get your
result set from the database):

   Statement stmt = ; //an arbitrary Statement object
   ResultSet rs = stmt.executeQuery(select employee_number, last_name,
first_name, middle_initial from employee_table);

Now, on to the matter of nulls. Let's say that you are working your way
through your ResultSet. As you know, you get the rows of the ResultSet one
row at a time, using the next() method, as follows:

   while (rs.next()) { //as long as there are rows in the result set
   //handle one row of the result set
   }

Within the while loop, each iteration of the loop will handle one complete
row of the result set.

Let's assume you don't know which columns of the result set are null and
you
want to display the values in each column of the result set exactly as
they
appear in the result set, except that when the value is null, you want to
display the word unknown. Here's what you would need to do:


   String empno = null;
   String lastname = null;
   String firstname = null;
   String midinit = null;

   while (rs.next()) {

   empno = rs.getString(employee_number); //get the employee number
from this row of the result set
   if (rs.wasNull()) { //if the employee number is null
   System.out.println(Employee Number is unknown);
   }
   else {
   System.out.println(Employee Number is  + empno);
   }

   lastname = rs.getString(last_name); //get the last name from this
row of the result set
   if (rs.wasNull()) { //if the last name is null
   System.out.println(Last Name is unknown);
   }
   else {
   System.out.println(Last Name  is  + lastname);
   }

   firstname = rs.getString(first_name); //get the first name from
this row of the result set
   if (rs.wasNull()) { //if the first name is null
   System.out.println(First Name is unknown);
   }
   else {
   System.out.println(First Name is  + firstname);
   }


   midinit = rs.getString(middle_initial); //get the middle initial
from this row of the result set
   if (rs.wasNull()) { //if the middle initial is null
   System.out.println(Middle Initial is unknown);
   }
   else {
   System.out.println(Middle Initial is  + midinit);
   }

   }

Although this example uses only result set columns that are being stored
in
Strings, the technique differs very little for non-text data. Let's say
that
we had a column called annual_salary in our result set, where the
annual_salary was an integer containing the number of dollars that the
person earned per year. Let's assume that some people are still
negotiating
their salaries so that the salary is stored as null for those people until
the salary has been fully agreed.. The technique to handle the salary
would
look like this:

   int salary = null;

   while (rs.next()) {
   salary = getInt(annual_salary); //get the salary from this row of
the result set
   if (rs.isNull()) { //if the salary is null
   System.out.println(Annual Salary is unknown);
   }
   else {
   System.out.println(Annual Salary is  + salary);
   }


I hope this helps you with your null handling!

--
Rhino


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Null

2007-06-21 Thread Mohammed Zabin

Hi All

Anyone knows how to deal with null values in JDBC ResultSet??

I am trying to render a table in jsp page that read its value from the
database, sometimes, the database returns null values, and so, the whole
table couldn't be rendered. Is there any way to deal with null values.

Thanks


Re: Null

2007-06-21 Thread Mohammed Zabin

I tried it the other way, if( rs.getString(field) == null ) but the
compiler plames that null can't be compared to string

On 6/21/07, Tim Funk [EMAIL PROTECTED] wrote:



if (null == rs.getString(col_foo)) {
   out.println(tdnbsp;/td);
} else {
   // Evil since this doesn't escape the xml - for edutainment only
   out.println(td + rs.getString(col_foo) + /td);
}

-Tim

Mohammed Zabin wrote:
 Hi All

 Anyone knows how to deal with null values in JDBC ResultSet??

 I am trying to render a table in jsp page that read its value from the
 database, sometimes, the database returns null values, and so, the whole
 table couldn't be rendered. Is there any way to deal with null values.

 Thanks



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Design

2007-06-19 Thread Mohammed Zabin

Hi All

I am developing an online exam site as a graduation project. I have some
questions regardsing the design:

1. In such a program which is a web site that introduce some multiple choice
questions, and shows the result of user answers, DO I HAVE TO USE EJB??


Re: Design

2007-06-19 Thread Mohammed Zabin

I am using a Tag that render the whole questions, can i create another tag
that deals with user request?

On 6/19/07, Kevin Wilhelm [EMAIL PROTECTED] wrote:


No!

This sounds like a simple webapp to me. Just use some Servlet Container
(Tomcat) and have all of the presentation (JSP), business and persistence
things handled in ONE engine.

- Original Message -
From: Mohammed Zabin [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, June 19, 2007 9:26 AM
Subject: Design


 Hi All

 I am developing an online exam site as a graduation project. I have some
 questions regardsing the design:

 1. In such a program which is a web site that introduce some multiple
 choice
 questions, and shows the result of user answers, DO I HAVE TO USE EJB??



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Design

2007-06-19 Thread Mohammed Zabin

What learning curve?

On 6/19/07, ben short [EMAIL PROTECTED] wrote:


Id suggest having a look at the spring web mvc stuff it can help you
simplify form submissions by mapping request params to objects so you
don't have to do, although there will be a slight learning curve.

Just my 2 pence :)

On 6/19/07, Kevin Wilhelm [EMAIL PROTECTED] wrote:
 I'd take the approach with Servlets/JSP that handle user inputs. You
could
 in deed use tags for the inputs and process them with suitable
controllers
 in the logic tier. May be there are simpler ways to proceed with
 questionaires.


 - Original Message -
 From: Mohammed Zabin [EMAIL PROTECTED]
 To: Tomcat Users List users@tomcat.apache.org
 Sent: Tuesday, June 19, 2007 9:42 AM
 Subject: Re: Design


 I am using a Tag that render the whole questions, can i create another
tag
  that deals with user request?
 
  On 6/19/07, Kevin Wilhelm [EMAIL PROTECTED] wrote:
 
  No!
 
  This sounds like a simple webapp to me. Just use some Servlet
Container
  (Tomcat) and have all of the presentation (JSP), business and
persistence
  things handled in ONE engine.
 
  - Original Message -
  From: Mohammed Zabin [EMAIL PROTECTED]
  To: Tomcat Users List users@tomcat.apache.org
  Sent: Tuesday, June 19, 2007 9:26 AM
  Subject: Design
 
 
   Hi All
  
   I am developing an online exam site as a graduation project. I have
   some
   questions regardsing the design:
  
   1. In such a program which is a web site that introduce some
multiple
   choice
   questions, and shows the result of user answers, DO I HAVE TO USE
EJB??
  
 
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: DBCP

2007-05-26 Thread Mohammed Zabin

Thank you

You know what, all that advises made me somewhat confused, i have reread
Tomcat Documentation, now, am not sure about the following:
1. Which is best, servlet.xml or context.xml?
2. If it is servlet.xml, which servlet.xml, is it the config file for the
container, or my web application servlet.xml file.
3. Where shall i put jdbc driver class file, in my web application META-INF
or in Tomcat lib folder.

I susbect with jdbc driver, if you look at otn.oracle, you will find many
drivers for all jdks, but there is no one for JDK 6.


On 5/26/07, Pid [EMAIL PROTECTED] wrote:


Mohammed Zabin wrote:
 Thank you Christ
 For instance, I usually see oracle.jdbc.driver.OracleDriver instead
of
 what you have above.

 It's as you stated above. But with Oracle 9i and onwards, the driver
 must be
 oracle.jdbc.OracleDriver, anyways,
 i am looking for a solution, and I am sure that i'll find one, thank you

If you've not found it yet you need to carefully re-read the advice
we've offered.  I think we've identified the problem and advised a
solution each time, I also think you're changing more than just what
we've recommended you change, and thus introducing more problems.

Your last issue was that you have moved the Resource definition to
GlobalResources, then failed to add the ResourceLink that makes it
available to the Context.

Your previous issue was that you hadn't added the driver jar to the
correct place for Tomcat's classloaders to find it.

The issue before that* was that your Resource config definition was
incorrect, as were the previous two attempts.

Before that your JSP was faulty as you hadn't imported any of the
classes you needed.


p


* Hopefully I've got these in the right order.


server.xml  : GlobalResource def
yourapp.xml : Context def, ResourceLink
web.xml : web app deployment desc, Resource Ref
your.jsp: imports, active code





 On 5/25/07, Christopher Schultz [EMAIL PROTECTED] wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Mohammed,

 Mohammed Zabin wrote:
  I put the jar file in my WEB-INF/lib and CATALINA_HOME/lib and
 CLASSPATH,
  but nothing changed, I got the same error

 No, you are getting a different error. The first one was
 ClassNotFoundException. Now, you are getting:

  org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
  JDBC driver of class '' for connect URL 'null'

 Those are not the same.

 Search the archives for Cannot create JDBC driver of class '' and I'm
 sure you'll find this question answered hundreds of times over.

 It usually turns out to be an incorrect JDBC URL or an incorrect driver
 class name. Please check these over /carefully/:

  driverClassName=oracle.jdbc.OracleDriver
  url=jdbc:oracle:thin:@127.0.0.1:1521:orcldb

 For instance, I usually see oracle.jdbc.driver.OracleDriver instead
of
 what you have above.

 - -chris

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.7 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFGVvxA9CaO5/Lv0PARArmAAJsEdBWX6X0TcjTLZ30hFYNjACEAZQCgr9+d
 7ag9qjj7Q+Uxg23E0P21XyU=
 =EAkm
 -END PGP SIGNATURE-

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]








Re: DBCP

2007-05-26 Thread Mohammed Zabin

Thank you Pid for your patience with me, Thank you all guys, the problem
finally sovled, and the connection established.

The problem was because of i didn't state the ResourceLink, I put it like
this:

ResourceLink name=jdbc/myoracle type=javax.sql.DataSource
global=jdbc/myoracle/

in Context.xml, and i removed all occurences of jdbc class drivers but in
CATALINA_HOME/lib.

By the way, it is the advice of David Smith and Pid. Thank you guys, Thank
you ver much :).

Jotnarta


On 5/26/07, Pid [EMAIL PROTECTED] wrote:


Mohammed Zabin wrote:
 Thank you

(Please just reply to the list, not 'all')

 You know what, all that advises made me somewhat confused, i have reread
 Tomcat Documentation, now, am not sure about the following:
 1. Which is best, servlet.xml or context.xml?

You must add information to all of config files, it's not optional, I
think the documentation is pretty clear on what needs to be added to
each file.

(Below,  ...  is a location or name of something on your system).


 2. If it is servlet.xml, which servlet.xml, is it the config file for
the
 container, or my web application servlet.xml file.

I'm not aware of a Tomcat configuration file called servlet.xml.
Tomcat uses the following files (in addition to your web app's files):

tomcat/conf/server.xml  - main config
tomcat/conf/context.xml - default/all contexts
tomcat/conf/web.xml - main config


You can configure the Context by placing the definition in -

EITHER:
tomcat/conf/hostname/contextname.xml

OR:
webapp/META-INF/context.xml

You should also configure your servlet definitions and the remainder of
your application as per the spec in:

webapp/WEB-INF/web.xml


 3. Where shall i put jdbc driver class file, in my web application
META-INF
 or in Tomcat lib folder.

Not META-INF, WEB-INF and META-INF are different locations, with
different purposes. You can place the oracle jar file in -

EITHER:
tomcat/lib

OR:
webapp/WEB-INF/lib


 I susbect with jdbc driver, if you look at otn.oracle, you will find
many
 drivers for all jdks, but there is no one for JDK 6.

It's not the driver, it's your config.  Tomcat+Oracle is successfully
deployed by many people all over the world.



So, in summary, as an *example* to demonstrate some possible locations
for various bits of config, you might have:

Resource def in GlobalResources, 'testhost' Host def:
  /path/to/tomcat6/conf/server.xml

ResourceLink in Context:
  /path/to/tomcat6/conf/testhost/ROOT.xml

oracle-XXX.jar in
  /path/to/tomcat6/lib

Resource ref, servlets in:
  /path/to/testhost/webapps/ROOT/WEB-INF/web.xml

JSP in:
  /path/to/testhost/webapps/ROOT/test.jsp




p








p.s. Chuck, if you read this, I'm betting that you'll need to get your
path attribute standard response ready.




 On 5/26/07, Pid [EMAIL PROTECTED] wrote:

 Mohammed Zabin wrote:
  Thank you Christ
  For instance, I usually see oracle.jdbc.driver.OracleDriver
instead
 of
  what you have above.
 
  It's as you stated above. But with Oracle 9i and onwards, the driver
  must be
  oracle.jdbc.OracleDriver, anyways,
  i am looking for a solution, and I am sure that i'll find one, thank
 you

 If you've not found it yet you need to carefully re-read the advice
 we've offered.  I think we've identified the problem and advised a
 solution each time, I also think you're changing more than just what
 we've recommended you change, and thus introducing more problems.

 Your last issue was that you have moved the Resource definition to
 GlobalResources, then failed to add the ResourceLink that makes it
 available to the Context.

 Your previous issue was that you hadn't added the driver jar to the
 correct place for Tomcat's classloaders to find it.

 The issue before that* was that your Resource config definition was
 incorrect, as were the previous two attempts.

 Before that your JSP was faulty as you hadn't imported any of the
 classes you needed.


 p


 * Hopefully I've got these in the right order.


 server.xml  : GlobalResource def
 yourapp.xml : Context def, ResourceLink
 web.xml : web app deployment desc, Resource Ref
 your.jsp: imports, active code





  On 5/25/07, Christopher Schultz [EMAIL PROTECTED] wrote:
 
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
 
  Mohammed,
 
  Mohammed Zabin wrote:
   I put the jar file in my WEB-INF/lib and CATALINA_HOME/lib and
  CLASSPATH,
   but nothing changed, I got the same error
 
  No, you are getting a different error. The first one was
  ClassNotFoundException. Now, you are getting:
 
   org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
   JDBC driver of class '' for connect URL 'null'
 
  Those are not the same.
 
  Search the archives for Cannot create JDBC driver of class '' and
 I'm
  sure you'll find this question answered hundreds of times over.
 
  It usually turns out to be an incorrect JDBC URL or an incorrect
 driver
  class name. Please check these over /carefully/:
 
   driverClassName=oracle.jdbc.OracleDriver
   url

Re: DBCP

2007-05-25 Thread Mohammed Zabin

It didn't work, I put the following in Context.xml:
Resource name=jdbc/mydb
auth=Container
type=oracle.jdbc.pool.OracleDataSource
factory=oracle.jdbc.pool.OracleDataSourceFactory
user=hr
password=hr
driverClassName=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@localhost:1521:orcldb
maxActive=20 maxIdle=10 maxwait=-1/
and i got the following exception:


javax.servlet.ServletException: javax.naming.NamingException: Could
not load resource factory class [Root exception is
java.lang.ClassNotFoundException:
oracle.jdbc.pool.OracleDataSourceFactory]

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:75)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

is there any jar file that should be in lib???


On 5/24/07, Christopher Schultz [EMAIL PROTECTED] wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mohammed,

Mohammed Zabin wrote:
 You know what? I am confusing with this. Shall i put the following code
in
 web.xml in my web application or web.xml on config folder, shall i use
 server.xml or context.xml

Use META-INF/context.xml in your WAR file or deployment directory. Don't
use ${TOMCAT_HOME}/conf/Catalina/[host]/[app].xml unless there's a
really good reason to do so.

Put your Resource in context.xml and remove all Resource
configuration from server.xml.

Remove any resource-ref you have in your web.xml.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGVZCk9CaO5/Lv0PARAvY4AJ9LdP/csNjVWn3ZU9OVzv527gyWygCfTJmS
3EScAagRpgYlErF8uPLvF9E=
=MAx6
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: DBCP

2007-05-25 Thread Mohammed Zabin

I did, in Tomcat 6 documentation, it's mentioned that classes12.jar must be
placed in CATALINA_HOME/lib, and i put the jar file there, but still, it's
don't work

On 5/25/07, Caldarale, Charles R [EMAIL PROTECTED] wrote:


 From: Mohammed Zabin [mailto:[EMAIL PROTECTED]
 Subject: Re: DBCP

 i have downloaded JDBC driver from otn.oracle classes12.zip and i
 changed it to classes12.jar, and put it in CLASSPATH.

The CLASSPATH environment variable should not be used for Tomcat (or for
any other Java application, for that matter); the standard Tomcat
startup mechanisms rightly ignore it.

The JDBC driver jar must be placed in the Tomcat 6 lib directory in
order to use connection pooling.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: DBCP

2007-05-25 Thread Mohammed Zabin

anyways, i put the jar file in my classpath, and this will override the lib
folder i think, isn't it?

On 5/25/07, Javier Ortiz [EMAIL PROTECTED] wrote:


Yes but not in the same path as in previous versions.

On 5/25/07, Mohammed Zabin [EMAIL PROTECTED] wrote:

 Thank you
 Lib folder in CATALINA_HOME, as mentioned in Tomact 6, isn't it?


 On 5/25/07, Javier Ortiz [EMAIL PROTECTED] wrote:
 
  Are you aware of the new placing of files in 6.x? There's a new lib
  folder.
  Put the file there and try again.
 
  On 5/25/07, Mohammed Zabin [EMAIL PROTECTED] wrote:
  
   Hello Geeks
  
   Following is my problem, I am trying to configure my Tomcat 6 to
 connect
   to
   my localhost Oracle 10g Database, following is my server.xml file :
  
   Resource name=jdbc/myoracle auth=Container
 type=javax.sql.DataSource driverClassName=
   oracle.jdbc.OracleDriver
 url=jdbc:oracle:thin:@127.0.0.1:1521:orcldb
 username=hr password=hr maxActive=20
  maxIdle=10
 maxWait=-1/
  
   and i put the following in web.xml:
  
   resource-ref
   descriptionOracle Datasource example/description
   res-ref-namejdbc/myoracle/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
   /resource-ref
   and the following is code is the JSP code:
  
  
   %@ page import=javax.naming.Context,javax.naming.InitialContext,
   javax.naming.NamingException,javax.sql.DataSource, java.sql.* %
  
   %
 Context initContext = new InitialContext();
 Context envContext  =
(Context)initContext.lookup(java:/comp/env);
 DataSource ds = (DataSource)envContext.lookup(jdbc/myoracle);
 Connection conn = ds.getConnection();
  
 out.println( Connection Established );
   %
  
   After running the jsp page, i got the following error:
  
   org.apache.jasper.JasperException: javax.servlet.ServletException:
   org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
   driver of class '' for connect URL 'null'
  
org.apache.jasper.servlet.JspServletWrapper.handleJspException
 (
   JspServletWrapper.java:532)
   org.apache.jasper.servlet.JspServletWrapper.service(
   JspServletWrapper.java:408)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(
   JspServlet.java:320)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java
  :266)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  
   i have downloaded JDBC driver from otn.oracle classes12.zip and i
   changed it to classes12.jar, and put it in CLASSPATH.
  
   I am working on this problem almost from 2 weeks, i didn't know what
   the problem is, any help plzz
  
 




DBCP

2007-05-25 Thread Mohammed Zabin

Hello Geeks

Following is my problem, I am trying to configure my Tomcat 6 to connect to
my localhost Oracle 10g Database, following is my server.xml file :

Resource name=jdbc/myoracle auth=Container
 type=javax.sql.DataSource driverClassName=
oracle.jdbc.OracleDriver
 url=jdbc:oracle:thin:@127.0.0.1:1521:orcldb
 username=hr password=hr maxActive=20 maxIdle=10
 maxWait=-1/

and i put the following in web.xml:

resource-ref
descriptionOracle Datasource example/description
res-ref-namejdbc/myoracle/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref
and the following is code is the JSP code:


%@ page import=javax.naming.Context,javax.naming.InitialContext,
javax.naming.NamingException,javax.sql.DataSource, java.sql.* %

%
 Context initContext = new InitialContext();
 Context envContext  = (Context)initContext.lookup(java:/comp/env);
 DataSource ds = (DataSource)envContext.lookup(jdbc/myoracle);
 Connection conn = ds.getConnection();

 out.println( Connection Established );
%

After running the jsp page, i got the following error:

org.apache.jasper.JasperException: javax.servlet.ServletException:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:532)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

i have downloaded JDBC driver from otn.oracle classes12.zip and i
changed it to classes12.jar, and put it in CLASSPATH.

I am working on this problem almost from 2 weeks, i didn't know what
the problem is, any help plzz


Re: DBCP

2007-05-25 Thread Mohammed Zabin

Thank you Pid


Yeah, where exactly in the server.xml did you put this?


I put it in GlobalNamingResources tag in server.xml


On 5/25/07, Pid [EMAIL PROTECTED] wrote:


Mohammed Zabin wrote:
 Hello Geeks

I'm not sure what the appropriate response is but I'll try to sneak
something passed my language filter:

Hello X,

 Following is my problem, I am trying to configure my Tomcat 6 to connect
to
 my localhost Oracle 10g Database, following is my server.xml file :

 Resource name=jdbc/myoracle auth=Container
  type=javax.sql.DataSource driverClassName=
 oracle.jdbc.OracleDriver
  url=jdbc:oracle:thin:@127.0.0.1:1521:orcldb
  username=hr password=hr maxActive=20 maxIdle=10
  maxWait=-1/

Yeah, where exactly in the server.xml did you put this?

Tomcat is now telling you that it can't even find the name of the
driver, which I think you told us in your previous thread it could, but
couldn't find the class.

All you had to do was add the oracle driver to CATALINA_HOME/lib or your
WEB-INF/lib and you should have been done...


p



 and i put the following in web.xml:

 resource-ref
 descriptionOracle Datasource example/description
 res-ref-namejdbc/myoracle/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainer/res-auth
 /resource-ref
 and the following is code is the JSP code:


 %@ page import=javax.naming.Context,javax.naming.InitialContext,
 javax.naming.NamingException,javax.sql.DataSource, java.sql.* %

 %
  Context initContext = new InitialContext();
  Context envContext  = (Context)initContext.lookup(java:/comp/env);
  DataSource ds = (DataSource)envContext.lookup(jdbc/myoracle);
  Connection conn = ds.getConnection();

  out.println( Connection Established );
 %

 After running the jsp page, i got the following error:

 org.apache.jasper.JasperException: javax.servlet.ServletException:
 org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
 driver of class '' for connect URL 'null'
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(
JspServletWrapper.java:532)

 org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:408)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
:320)

 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

 i have downloaded JDBC driver from otn.oracle classes12.zip and i
 changed it to classes12.jar, and put it in CLASSPATH.

 I am working on this problem almost from 2 weeks, i didn't know what
 the problem is, any help plzz






Re: DBCP

2007-05-25 Thread Mohammed Zabin

Thank you
Lib folder in CATALINA_HOME, as mentioned in Tomact 6, isn't it?


On 5/25/07, Javier Ortiz [EMAIL PROTECTED] wrote:


Are you aware of the new placing of files in 6.x? There's a new lib
folder.
Put the file there and try again.

On 5/25/07, Mohammed Zabin [EMAIL PROTECTED] wrote:

 Hello Geeks

 Following is my problem, I am trying to configure my Tomcat 6 to connect
 to
 my localhost Oracle 10g Database, following is my server.xml file :

 Resource name=jdbc/myoracle auth=Container
   type=javax.sql.DataSource driverClassName=
 oracle.jdbc.OracleDriver
   url=jdbc:oracle:thin:@127.0.0.1:1521:orcldb
   username=hr password=hr maxActive=20
maxIdle=10
   maxWait=-1/

 and i put the following in web.xml:

 resource-ref
 descriptionOracle Datasource example/description
 res-ref-namejdbc/myoracle/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainer/res-auth
 /resource-ref
 and the following is code is the JSP code:


 %@ page import=javax.naming.Context,javax.naming.InitialContext,
 javax.naming.NamingException,javax.sql.DataSource, java.sql.* %

 %
   Context initContext = new InitialContext();
   Context envContext  = (Context)initContext.lookup(java:/comp/env);
   DataSource ds = (DataSource)envContext.lookup(jdbc/myoracle);
   Connection conn = ds.getConnection();

   out.println( Connection Established );
 %

 After running the jsp page, i got the following error:

 org.apache.jasper.JasperException: javax.servlet.ServletException:
 org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
 driver of class '' for connect URL 'null'
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(
 JspServletWrapper.java:532)
 org.apache.jasper.servlet.JspServletWrapper.service(
 JspServletWrapper.java:408)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(
 JspServlet.java:320)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java
:266)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

 i have downloaded JDBC driver from otn.oracle classes12.zip and i
 changed it to classes12.jar, and put it in CLASSPATH.

 I am working on this problem almost from 2 weeks, i didn't know what
 the problem is, any help plzz




Re: DBCP

2007-05-25 Thread Mohammed Zabin

I put the jar file in my WEB-INF/lib and CATALINA_HOME/lib and CLASSPATH,
but nothing changed, I got the same error

On 5/25/07, Mohammed Zabin [EMAIL PROTECTED] wrote:


Thank you Pid

 Yeah, where exactly in the server.xml did you put this?

I put it in GlobalNamingResources tag in server.xml


 On 5/25/07, Pid [EMAIL PROTECTED] wrote:

 Mohammed Zabin wrote:
  Hello Geeks

 I'm not sure what the appropriate response is but I'll try to sneak
 something passed my language filter:

 Hello X,

  Following is my problem, I am trying to configure my Tomcat 6 to
 connect to
  my localhost Oracle 10g Database, following is my server.xml file :
 
  Resource name=jdbc/myoracle auth=Container
   type=javax.sql.DataSource driverClassName=
  oracle.jdbc.OracleDriver
   url= jdbc:oracle:thin:@127.0.0.1:1521:orcldb
   username=hr password=hr maxActive=20
 maxIdle=10
   maxWait=-1/

 Yeah, where exactly in the server.xml did you put this?

 Tomcat is now telling you that it can't even find the name of the
 driver, which I think you told us in your previous thread it could, but
 couldn't find the class.

 All you had to do was add the oracle driver to CATALINA_HOME/lib or your
 WEB-INF/lib and you should have been done...


 p



  and i put the following in web.xml:
 
  resource-ref
  descriptionOracle Datasource example/description
  res-ref-namejdbc/myoracle/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  /resource-ref
  and the following is code is the JSP code:
 
 
  %@ page import=javax.naming.Context,javax.naming.InitialContext,
  javax.naming.NamingException,javax.sql.DataSource , java.sql.* %
 
  %
   Context initContext = new InitialContext();
   Context envContext  = (Context)initContext.lookup(java:/comp/env);
   DataSource ds = (DataSource)envContext.lookup(jdbc/myoracle);
   Connection conn = ds.getConnection();
 
   out.println( Connection Established );
  %
 
  After running the jsp page, i got the following error:
 
  org.apache.jasper.JasperException : javax.servlet.ServletException:
  org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
  driver of class '' for connect URL 'null'
  org.apache.jasper.servlet.JspServletWrapper.handleJspException (
 JspServletWrapper.java:532)
 
  org.apache.jasper.servlet.JspServletWrapper.service(
 JspServletWrapper.java:408)
 
  org.apache.jasper.servlet.JspServlet.serviceJspFile(
 JspServlet.java:320)
 
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
  i have downloaded JDBC driver from otn.oracle classes12.zip and i
  changed it to classes12.jar, and put it in CLASSPATH.
 
  I am working on this problem almost from 2 weeks, i didn't know what
  the problem is, any help plzz
 






DBCP

2007-05-24 Thread Mohammed Zabin

*Hi All*
**
*I want to use DBCP to connect my localhost Oracle Database, I have write
the following in servlet.xml file:*

Resource name=jdbc/myoracledb auth=Container
 type=javax.sql.DataSource /

   ResourceParams name=jdbc/myoracledb
  parameter
 namefactory/name
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameter
 namedriverClassName/name
 valueoracle.jdbc.OracleDriver/value
  /parameter
  parameter
 nameurl/name
 valuejdbc:oracle:thin:@127.0.0.1:1521:mine/value
  /parameter
  parameter
 nameusername/name
 valuehr/value
  /parameter
  parameter
 namepassword/name
 valuehr/value
  /parameter
  parameter
 namemaxActive/name
 value20/value
  /parameter
  parameter
 namemaxIdle/name
 value10/value
  /parameter
  parameter
 namemaxWait/name
 value-1/value
  /parameter
   /ResourceParams
 /GlobalNamingResources

*and the following in web.xml file:*

resource-ref
  descriptionOracle Datasource example/description
  res-ref-namejdbc/myoracledb/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref

*and following is my JSP code:*


%@ page import=javax.sql.*, javax.naming.*, java.sql.* %

%
 Context initContext = new InitialContext();
 Context envContext  = (Context)initContext.lookup(java:/comp/env);
 DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
 Connection conn = ds.getConnection();

 out.println( Connection Established );
%

*When running the above jsp page, i got the following exception:*

*org.apache.jasper.JasperException: javax.servlet.ServletException:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:532)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*

Any Help Please, I am working to solving this problem from one week, I
am lost, what is the reason for this exception, any help will be
apprecieated

Jotnarta


Re: DBCP

2007-05-24 Thread Mohammed Zabin

I am using tomcat 6, and another thing, i have changed my configuration
parameters to the following:


Resource name=jdbc/myoracle auth=Container
 type=javax.sql.DataSource
driverClassName=oracle.jdbc.OracleDriver
 url=jdbc:oracle:thin:@127.0.0.1:1521:mysid
 username=scott password=tiger maxActive=20 maxIdle=10
 maxWait=-1/




On 5/24/07, David Rodríguez Fernández [EMAIL PROTECTED] wrote:


What tomcat version do you have?

-Mensaje original-
De: Mohammed Zabin [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 24 de mayo de 2007 12:03
Para: users@tomcat.apache.org
Asunto: DBCP

*Hi All*
**
*I want to use DBCP to connect my localhost Oracle Database, I have write
the following in servlet.xml file:*

Resource name=jdbc/myoracledb auth=Container
 type=javax.sql.DataSource /

   ResourceParams name=jdbc/myoracledb
  parameter
 namefactory/name
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameter
 namedriverClassName/name
 valueoracle.jdbc.OracleDriver/value
  /parameter
  parameter
 nameurl/name
 valuejdbc:oracle:thin:@127.0.0.1:1521:mine/value
  /parameter
  parameter
 nameusername/name
 valuehr/value
  /parameter
  parameter
 namepassword/name
 valuehr/value
  /parameter
  parameter
 namemaxActive/name
 value20/value
  /parameter
  parameter
 namemaxIdle/name
 value10/value
  /parameter
  parameter
 namemaxWait/name
 value-1/value
  /parameter
   /ResourceParams
/GlobalNamingResources

*and the following in web.xml file:*

resource-ref
  descriptionOracle Datasource example/description
  res-ref-namejdbc/myoracledb/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref

*and following is my JSP code:*


%@ page import=javax.sql.*, javax.naming.*, java.sql.* %

%
Context initContext = new InitialContext();
Context envContext  = (Context)initContext.lookup(java:/comp/env);
DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
Connection conn = ds.getConnection();

out.println( Connection Established ); %

*When running the above jsp page, i got the following exception:*

*org.apache.jasper.JasperException: javax.servlet.ServletException:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver
of
class '' for connect URL 'null'

org.apache.jasper.servlet.JspServletWrapper.handleJspException
(JspServletWra
pper.java:532)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
:4
08)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*

Any Help Please, I am working to solving this problem from one week, I am
lost, what is the reason for this exception, any help will be apprecieated

Jotnarta




--

La Información incluida en el presente correo electrónico es SECRETO
PROFESIONAL Y CONFIDENCIAL, siendo para el uso exclusivo del
destinatario arriba mencionado. Si usted lee este mensaje y no es el
destinatario señalado, el empleado o el agente responsable de entregar
el mensaje al destinatario, o ha recibido esta comunicación por error,
le informamos que esta totalmente prohibida cualquier divulgación,
distribución o reproducción de esta comunicación, y le rogamos que nos
lo notifique inmediatamente y nos devuelva el mensaje original a la
dirección arriba mencionada.

Gracias.

The information contained in this e-mail is LEGALLY PRIVILEDGED AND
CONFIDENTIAL and is intended only for the use of the addressee named
above. If the reader of this message is not the intended recipient or
the employee or agent responsible for delivering the message to the
intended recipient, or you have received this communication in error,
please be aware that any dissemination, distribution or duplication of
this communication is strictly prohibited, and please notify us
immediately and return the original message to us at the address above.

Thank you.



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: DBCP

2007-05-24 Thread Mohammed Zabin

You know what? I am confusing with this. Shall i put the following code in
web.xml in my web application or web.xml on config folder, shall i use
server.xml or context.xml

On 5/24/07, David Rodríguez Fernández [EMAIL PROTECTED] wrote:


I'm using tomcat 5.5, and for this kind of things i'm creating a xml file
in
the {TOMCATHOME}/conf/Catalina/localhost/AppName.xml
With a content like this:
# cat /etc/tomcat-5.5/Catalina/localhost/AppName.xml
Context path=/AppName docBase=AppName debug=5 reloadable=true
crossContext=true
   Resource name=jdbc/conexion auth=Container
type=javax.sql.DataSource
   driverClassName=oracle.jdbc.driver.OracleDriver
   url=jdbc:oracle:thin:@192.168.1.1:1521:SIDBD username=scott
password=tiger
   maxActiVe=3 maxIdle=1 maxWait=-1 /
/Context





-Mensaje original-
De: Mohammed Zabin [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 24 de mayo de 2007 12:24
Para: Tomcat Users List
Asunto: Re: DBCP

I am using tomcat 6, and another thing, i have changed my configuration
parameters to the following:


Resource name=jdbc/myoracle auth=Container
 type=javax.sql.DataSource
driverClassName=oracle.jdbc.OracleDriver
 url=jdbc:oracle:thin:@127.0.0.1:1521:mysid
 username=scott password=tiger maxActive=20 maxIdle=10
 maxWait=-1/




On 5/24/07, David Rodríguez Fernández [EMAIL PROTECTED]
wrote:

 What tomcat version do you have?

 -Mensaje original-
 De: Mohammed Zabin [mailto:[EMAIL PROTECTED] Enviado el: jueves, 24
 de mayo de 2007 12:03
 Para: users@tomcat.apache.org
 Asunto: DBCP

 *Hi All*
 **
 *I want to use DBCP to connect my localhost Oracle Database, I have
 write the following in servlet.xml file:*

 Resource name=jdbc/myoracledb auth=Container
  type=javax.sql.DataSource /

ResourceParams name=jdbc/myoracledb
   parameter
  namefactory/name
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
   /parameter
   parameter
  namedriverClassName/name
  valueoracle.jdbc.OracleDriver/value
   /parameter
   parameter
  nameurl/name
  valuejdbc:oracle:thin:@127.0.0.1:1521:mine/value
   /parameter
   parameter
  nameusername/name
  valuehr/value
   /parameter
   parameter
  namepassword/name
  valuehr/value
   /parameter
   parameter
  namemaxActive/name
  value20/value
   /parameter
   parameter
  namemaxIdle/name
  value10/value
   /parameter
   parameter
  namemaxWait/name
  value-1/value
   /parameter
/ResourceParams
 /GlobalNamingResources

 *and the following in web.xml file:*

 resource-ref
   descriptionOracle Datasource example/description
   res-ref-namejdbc/myoracledb/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
 /resource-ref

 *and following is my JSP code:*


 %@ page import=javax.sql.*, javax.naming.*, java.sql.* %

 %
 Context initContext = new InitialContext(); Context envContext  =
 (Context)initContext.lookup(java:/comp/env);
 DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
 Connection conn = ds.getConnection();

 out.println( Connection Established ); %

 *When running the above jsp page, i got the following exception:*

 *org.apache.jasper.JasperException: javax.servlet.ServletException:
 org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
 driver of class '' for connect URL 'null'

 org.apache.jasper.servlet.JspServletWrapper.handleJspException
 (JspServletWra
 pper.java:532)

 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.
 java
 :4
 08)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*

 Any Help Please, I am working to solving this problem from one week, I
 am lost, what is the reason for this exception, any help will be
 apprecieated

 Jotnarta




 --

 La Información incluida en el presente correo electrónico es SECRETO
 PROFESIONAL Y CONFIDENCIAL, siendo para el uso exclusivo del
 destinatario arriba mencionado. Si usted lee este mensaje y no es el
 destinatario señalado, el empleado o el agente responsable de entregar
 el mensaje al destinatario, o ha recibido esta comunicación por error,
 le informamos que esta totalmente prohibida cualquier divulgación,
 distribución o reproducción de esta comunicación, y le rogamos que nos
 lo notifique inmediatamente y nos devuelva el mensaje original a la
 dirección arriba mencionada.

 Gracias.

 The information contained in this e-mail is LEGALLY PRIVILEDGED AND
 CONFIDENTIAL and is intended only for the use of the addressee named
 above. If the reader of this message is not the intended

Re: JDBC

2007-05-22 Thread Mohammed Zabin

Thank you buddy, I have another confusing question for me,
I have two web.xml files, one in conf/web.xml and one in my application
under WEB-INF,
When configuring connection pool, which one shall i use? or shall i put the
configuration parameters in both of them??

Thank you


On 5/22/07, ben short [EMAIL PROTECTED] wrote:


Have a look here..


http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

On 5/22/07, Mohammed Zabin [EMAIL PROTECTED] wrote:
 Hi All

 Am new on this, i want to know how to configure Database Connection
Pooling
 to use Oracle Database?? anyhelp will be appreciated.

 Jotnarta


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: JDBC

2007-05-22 Thread Mohammed Zabin

with your example, i don't have to put extra parameters in web.xml or
servlet.xml? just in context.xml???

On 5/22/07, Zdeněk Vráblík [EMAIL PROTECTED] wrote:


Hi,

here is example of Resource configration. Put it in context.xml file.

Resource name=Name
 auth=Container
 type=oracle.jdbc.pool.OracleDataSource
 factory=oracle.jdbc.pool.OracleDataSourceFactory
 user=oraUserName
 password=oraUserPass
 driverClassName=oracle.jdbc.driver.OracleDriver
 url=jdbc:oracle:thin:@IPAddress:1521:orcl
 maxActive=20 maxIdle=10 maxwait=-1/


java code to get connection:

DataSource ds = (DataSource) ctxt.lookup(java:/comp/env/ + poolName);
OracleConnection   conn   = ds.getConnection();

There is used another datasource type in OC4J

http://www.oracle.com/technology/sample_code/tech/java/codesnippet/j2ee/jdbc/JDBC_in_J2EE.html

Regards,
Zdenek

On 5/22/07, Mohammed Zabin [EMAIL PROTECTED] wrote:
 Hi All

 Am new on this, i want to know how to configure Database Connection
Pooling
 to use Oracle Database?? anyhelp will be appreciated.

 Jotnarta


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: JDBC

2007-05-22 Thread Mohammed Zabin

Thank you Foo,
I but the following in the context.xml:

*Resource name=Name
auth=Container
type=oracle.jdbc.pool.OracleDataSource
factory=oracle.jdbc.pool.OracleDataSourceFactory
user=hr
password=hr
driverClassName=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@localhost:1521:orcldb
maxActive=20 maxIdle=10 maxwait=-1/*
**
and I have this jsp code:


*%@ page import=javax.sql.DataSource %*

*%
 Context initContext = new InitialContext();
 Context envContext  = (Context)initContext.lookup(java:/comp/env);
 DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
 Connection conn = ds.getConnection();

 out.println( Got the connection );
%*

but, i got the following error:

*org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 4 in the jsp file: /jsp/testDBCP.jsp
Context cannot be resolved to a type
1: %@ page import=javax.sql.DataSource %
2:
3: %
4:   Context initContext = new InitialContext();
5:   Context envContext  = (Context)initContext.lookup(java:/comp/env);
6:   DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
7:   Connection conn = ds.getConnection();


An error occurred at line: 4 in the jsp file: /jsp/testDBCP.jsp
InitialContext cannot be resolved to a type
1: %@ page import=javax.sql.DataSource %
*

On 5/22/07, Foo Shyn [EMAIL PROTECTED] wrote:


Not both of them. It's context.xml if u're using Tomcat 5.0 or above, or
server.xml if u're using Tomcat 4.1 or below, which is located in the
conf folder in Tomcat root path.

check this link out :
http://forums.oracle.com/forums/thread.jspa?messageID=1489914

Hope that helps.
FooShyn

Mohammed Zabin wrote:
 Thank you buddy, I have another confusing question for me,
 I have two web.xml files, one in conf/web.xml and one in my application
 under WEB-INF,
 When configuring connection pool, which one shall i use? or shall i
 put the
 configuration parameters in both of them??

 Thank you


 On 5/22/07, ben short [EMAIL PROTECTED] wrote:

 Have a look here..



http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html


 On 5/22/07, Mohammed Zabin [EMAIL PROTECTED] wrote:
  Hi All
 
  Am new on this, i want to know how to configure Database Connection
 Pooling
  to use Oracle Database?? anyhelp will be appreciated.
 
  Jotnarta
 

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 

 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.5.467 / Virus Database: 269.7.6/814 - Release Date: 5/21/2007
2:01 PM



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: JDBC

2007-05-22 Thread Mohammed Zabin

Thank you Foo for your patience with me,
I did imported all the needed classes, but i got the following exception:


*exception *

*org.apache.jasper.JasperException: An exception occurred processing
JSP page /jsp/testDBCP.jsp at line 7

4:   Context initContext = new InitialContext();
5:   Context envContext  = (Context)initContext.lookup(java:/comp/env);
6:   DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
7:   Connection conn = ds.getConnection();
8:
9:   out.println( The Connection Gotted Fine );
10: %


Stacktrace:

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*

**

*root cause *

*javax.servlet.ServletException:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*

**

*root cause*

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'

org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)

org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:62)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

*root cause*

java.lang.NullPointerException
sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
java.sql.DriverManager.getDriver(DriverManager.java:253)

org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)

org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:62)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)




On 5/22/07, Foo Shyn [EMAIL PROTECTED] wrote:


The jsp doesn't import the class for Context and Initial Context. Put
them in as how u inport the Datasource would do.

HTH
FooShyn

Mohammed Zabin wrote:
 Thank you Foo,
 I but the following in the context.xml:

 *Resource name=Name
 auth=Container
 type=oracle.jdbc.pool.OracleDataSource
 factory=oracle.jdbc.pool.OracleDataSourceFactory
 user=hr
 password=hr
 driverClassName=oracle.jdbc.driver.OracleDriver
 url=jdbc:oracle:thin:@localhost:1521:orcldb
 maxActive=20 maxIdle=10 maxwait=-1/*
 **
 and I have this jsp code:


 *%@ page import=javax.sql.DataSource %*

 *%
  Context initContext = new InitialContext();
  Context envContext  = (Context)initContext.lookup(java:/comp/env);
  DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
  Connection conn = ds.getConnection();

  out.println( Got the connection );
 %*

 but, i got the following error:

 *org.apache.jasper.JasperException: Unable to compile class for JSP:

 An error occurred at line: 4 in the jsp file: /jsp/testDBCP.jsp
 Context cannot be resolved to a type
 1: %@ page import=javax.sql.DataSource %
 2:
 3: %
 4:   Context initContext = new

Re: JDBC

2007-05-22 Thread Mohammed Zabin

When searching on Tomcat documentation, i found that it uses both server.xmland
web.xml, again, I got the same error,

*org.apache.jasper.JasperException: An exception occurred processing
JSP page /jsp/testDBCP.jsp at line 7

4:   Context initContext = new InitialContext();
5:   Context envContext  = (Context)initContext.lookup(java:/comp/env);
6:   DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
7:   Connection conn = ds.getConnection();
8:
9:   out.println( The Connection Gotted Fine );
10: %


Stacktrace:

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*

**

*root cause *

*javax.servlet.ServletException:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*




On 5/22/07, Foo Shyn [EMAIL PROTECTED] wrote:


Check out ur resource name, it is different from the one u use to get ur
connection pooling. The resource name must be the same as your lookup
name.

HTH
FooShyn

Mohammed Zabin wrote:
 Thank you Foo for your patience with me,
 I did imported all the needed classes, but i got the following
exception:


 *exception *

 *org.apache.jasper.JasperException: An exception occurred processing
 JSP page /jsp/testDBCP.jsp at line 7

 4:   Context initContext = new InitialContext();
 5:   Context envContext  =
(Context)initContext.lookup(java:/comp/env);
 6:   DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
 7:   Connection conn = ds.getConnection();
 8:
 9:   out.println( The Connection Gotted Fine );
 10: %


 Stacktrace:
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(
JspServletWrapper.java:515)

 org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:408)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
:320)

 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*

 **

 *root cause *

 *javax.servlet.ServletException:
 org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
 driver of class '' for connect URL 'null'
 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
PageContextImpl.java:855)

 org.apache.jasper.runtime.PageContextImpl.handlePageException(
PageContextImpl.java:784)

 org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:73)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:384)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
:320)

 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*

 **

 *root cause*

 org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
 driver of class '' for connect URL 'null'
 org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(
BasicDataSource.java:780)

 org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(
BasicDataSource.java:540)

 org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:62)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:384)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
:320)

 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

 *root cause*

 java.lang.NullPointerException
 sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
 sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
 sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307

Oracle 10g with Tomcat 6

2007-05-22 Thread Mohammed Zabin

Hi All
I want to conigure DBCP to connect to Oracle 10g on my localhost on Tomcat6.
I did the following error, I don't know how to solve it, is there is a
third-party jar file that must be added to classpath???

*1. I put the following in server.xml*
*Resource name=jbdc/myoracledb auth=Container
 type=javax.sql.DataSource /

   ResourceParams name=jdbc/myoracledb
  parameter
 namefactory/name
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameter
 namedriverClassName/name
 valueoracle.jdbc.OracleDriver/value
  /parameter
  parameter
 nameurl/name
 valuejdbc:oracle:thin:@127.0.0.1:1521:orcldb/value
  /parameter
  parameter
 nameusername/name
 valuehr/value
  /parameter
  parameter
 namepassword/name
 valuehr/value
  /parameter
  parameter
 namemaxActive/name
 value20/value
  /parameter
  parameter
 namemaxIdle/name
 value10/value
  /parameter
  parameter
 namemaxWait/name
 value-1/value
  /parameter
   /ResourceParams*

*2. The following in web.xml:*
*resource-ref
  descriptionOracle Datasource example/description
  res-ref-namejdbc/myoracledb/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref*

3. And here is my JSP Code:

%@ page import=javax.sql.*, javax.naming.*, java.sql.* %

%
 Context initContext = new InitialContext();
 Context envContext  = (Context)initContext.lookup(java:/comp/env);
 DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
 Connection conn = ds.getConnection();

 out.println( Connection Established );
%

When running the page, i got the following error:

*org.apache.jasper.JasperException: An exception occurred processing
JSP page /jsp/testDBCP.jsp at line 7

4:   Context initContext = new InitialContext();
5:   Context envContext  = (Context)initContext.lookup(java:/comp/env);
6:   DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb);
7:   Connection conn = ds.getConnection();
8:
9:   out.println( Connection Established );
10: %


Stacktrace:

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*

**

*root cause *

*javax.servlet.ServletException:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*


Configuring PoolMan for MySQL

2007-03-28 Thread Mohammed Zabin

Hi All

I am wondering what is the steps to configure poolman to run with MYSQL
Database over tomcat Apache?

Regards