Re: Migration 4.1.27 to 4.1.30 - Servlet-Configuration won't work

2004-06-23 Thread Veniamin Fichin
[EMAIL PROTECTED] wrote:
Hi all,
I want to migrate a single webapplication from Tomcat 4.1.27 to Tomcat
4.1.30.
So I installed the new version on my server.
After configuration I copied my webapplication from 4.1.27 to 4.1.30. It is
a ROOT-webapp.
In this application there a 3 servlets with the follwing mapping configured:
servlet-mapping
servlet-namelogin/servlet-name
url-pattern/login//url-pattern
/servlet-mapping
servlet-mapping
servlet-nameappmanager/servlet-name
url-pattern/lappmanager/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameapp/servlet-name
url-pattern/*/url-pattern
/servlet-mapping
In 4.1.27 I can call http://xxx/login and http://xxx/appmanager without any
problems. Every other request goes to the app-servlet.
In 4.1.30 every request goes to the app-servlet. Even http://xxx/login and
http://xxx/appmanager.
   Is this a typo or not?
* You have /lappmanager URL pattern (see first l letter), but 
request for http://xxx/appmanager;.
* Second, you have /login/ URL pattern (see suffix slash), but request 
for http://xxx/login;.

   So none of your mappings triggered, what leads to default app-server 
invocation.

And also the method request.getPathInfo() return null. I don't know why.
   As of request.getPathInfo() method, please read J2EE's specs, it says:
cut
Returns:
a String, decoded by the web container, specifying extra path 
information that comes after the servlet path but before the query 
string in the request URL; or null if the URL does not have any extra 
path information
/cut

   So for example you'd have request URL like 
http://servername/webapp/mappedname/and/this/fake/path;, getPathInfo() 
would return /and/this/fake/path, I guess. In your case it's null.

  - Jens
--
Veniamin Fichin
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: AW: Migration 4.1.27 to 4.1.30 - Servlet-Configuration won't wor k

2004-06-23 Thread Veniamin Fichin
[EMAIL PROTECTED] wrote:
Oh sorry, that is just a typo.
That's the right mapping (don't know, where the l came from):
 servlet-mapping
 servlet-nameappmanager/servlet-name
 url-pattern/appmanager/url-pattern
 /servlet-mapping
And the login-Request is http://xxx/login/, and not http://xxx/login.
The curious is, that it works fine with tomcat 4.1.27.
I tried various requests with and without additional path informations.
getPathInfo still returns null. It is very strange...
   This' really strange, is it acceptable for you to upgrage to 5.x 
branch and try some simple mappings there?

--
Veniamin Fichin
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Caused by: java.lang.IllegalStateException: Context path is already in use

2004-06-17 Thread Veniamin Fichin
Arsen A. Gutsal wrote:
Getting subj during deploying into root () context.
Who may help me?
   May be there really is another context at this path? Check all path 
attributes of Context element(s) in your server.xml .

--
Veniamin Fichin
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to know if platform is Windows or Linux from jsp?

2004-06-02 Thread Veniamin Fichin
Francisco José Arnau Vives wrote:
How to know if platform is Windows or Linux from a jsp file in order to
define variables to access to the file system?
   java.lang.System#getProperty(os.name)
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: stopping-restarting Tomcat

2004-06-02 Thread Veniamin Fichin
[EMAIL PROTECTED] wrote:
	Does one need to stop-restart Tomcat server every time when a servlet is changed/compiled ? The restart takes lots of time during the development and testing of web application. Is there any way to expedite this.
   reloadable=true attribute of Context tag will do what you want. 
See tomcat-docs/config/context.html .

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: stopping-restarting Tomcat

2004-06-02 Thread Veniamin Fichin
Nitschke Michael wrote:
Reloadable does the job only if the servlet changes, if you want to add
another servlet you still have to Stop tomcat change the web.xml and
start it again, afterwards the reloadable would work again.
  Original question was about reloading (already deployed) servlet, so 
reloadable attribute is enough, but yes, when you add a new one, you 
should edit web.xml and restarting Tomcat or redeploy entire webapp.

mfg
Michael Nitschke
-Original Message-
From: Veniamin Fichin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 02, 2004 12:53 PM
To: Tomcat Users List
Subject: Re: stopping-restarting Tomcat

[EMAIL PROTECTED] wrote:
	Does one need to stop-restart Tomcat server every time when a
servlet is changed/compiled ? The restart takes lots of time during the
development and testing of web application. Is there any way to expedite
this.
reloadable=true attribute of Context tag will do what you want. 
See tomcat-docs/config/context.html .

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: default for reloadable setting

2004-06-02 Thread Veniamin Fichin
Ronald Klop wrote:
The docs on 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html do 
not mention the default setting of reloadable.
Does anybody know what it is?
   Just try it! :-) IMHO reasonable default setting is false.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: maxPostSize and file upload

2004-06-02 Thread Veniamin Fichin
Ronald Klop wrote:
Does the maxPostSize setting for the Connector in server.xml affect the 
max. size of a file upload?
   Since file upload occurs with POST method, yes it restricts upload 
file size.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: maxPostSize and file upload

2004-06-02 Thread Veniamin Fichin
Ronald Klop wrote:
Is it possible that this does not work?
The docs 
(http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/ajp.html) say 
that the default is 2MB, but I can download much larger files.
Is this a bug or a feature?
   Don't know, I never used it. Additionally, I have no ajp.html file 
in my Tomcat-5.0.16 distribution, that's strange, 'cause online site has 
it. Try to set maxPostSize to 2Mb explicitlyto see if it will work.
   It was a long time ago when I read one article on PHP file upload 
where it was said that you can't determine a size of uploading data 
before it at least reaches defined limit, furthermore an error only 
arised when upload is finished regardless of its actual size (will it be 
100Mb or even 100Gb). But I may be wrong.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Session Timeout and Direct Reference to login page

2004-05-27 Thread Veniamin Fichin
Jonathan Eric Miller wrote:
The strange thing is that this page seems to only intermittently be
displayed. i.e. it is catching the case where the session expires, but, in
some cases since I'm using container based security, it is going back to the
login page. Sometimes it goes to this page first, and then brings up the
login page. Other times, it just goes straight to the login page. I need to
look into it further. I have SingleSignOn enabled, so, I'm not sure if that
   May be it's working so fast you sometimes don't notice this 
redirection, and sometimes do?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How does Tomcat manage sesssions ?

2004-05-26 Thread Veniamin Fichin
Xavier MOGHRABI wrote:
Hi,
I've read the documentation but I don't understand clearly where can I 
configure TOmcat to use *PersistentManager* instead of *StandardManager*.

Do you know it ?
   Shortly:
Context docBase=app.war path=/app
 !-- ... --
 Manager className=org.apache.catalina.session.PersistentManager
   saveOnRestart=false
  Store className=org.apache.catalina.session.FileStore/
 /Manager
 !-- ... --
/Context
   By the way, I wrote this lines to disable default manager behavoiur 
to store sessions between server shutdown/startup. But SESSIONS.ser is 
still appearing, can anybody explain this?

Xavier
Shapira, Yoav a écrit :
Hi,
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/manager.html
http://jakarta.apache.org/tomcat/faq/misc.html#persist
Yoav Shapira
Millennium Research Informatics
 

-Original Message-
From: Xavier MOGHRABI [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 25, 2004 11:29 AM
To: Tomcat Users List
Subject: How does Tomcat manage sesssions ?
Hello,
I'm instested to know how does Tomcat manage user sessions. I'd like to
build a robust application that can survive after server's crashes.
Thereby, I'd like that the application is able to recover the session
  
to
 

allow users to go on their work where they were.
I've searched information on tomcat's website and I've read that in
using clustering features it would be possible to share sessions with
differents Tomcat instances by storing them in a shared storage such as
DBMS or XML file.
Thus, I thought my application could save sessions in a DBMS to recover
them after crashes or network failure. However I don't know how to do
this. Does somebody could bring me more documentation or tell me more
about it.
I would like to know :
- how should I configure Tomcat for doing that ?
- how tomcat save sessions and what does it do of objets linked to the
session ?
- how can I recover sessions and get it back to the right user?
Thanks for your help.
Xavier
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  


This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, 
proprietary and/or privileged.  This e-mail is intended only for the 
individual(s) to whom it is addressed, and may not be saved, copied, 
printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your 
computer system and notify the sender.  Thank you.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Session Timeout and Direct Reference to login page

2004-05-21 Thread Veniamin Fichin
Jonathan Eric Miller wrote:
Yeah, that seems like it would work. I'm wondering if I could maybe use a
filter by itself though and not use the listener and do something like the
following.
1. Intercept all requests with a filter.
2. Get the HttpSession out of the request. Get the session ID by calling
HttpSession.getId();
3. Get the cookie array and see if there is a cookie named jsessionid. If
there is, compare the two session IDs. If they are different forward to
sessionexpired.jsp to display error page. Otherwise, continue as normal.
   I've just tried this way, it works. Look at example .java file in 
attach for example, it's Filter implementation. Thanks for the 
suggestion, it's very useful.

package org.unchqua.test.servlet;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Cookie;

public class NewSessionFilter implements Filter {

private FilterConfig fconf;

public void init(FilterConfig arg0) throws ServletException {
fconf=arg0;
}

public void doFilter(ServletRequest req, ServletResponse resp,
 FilterChain fchain) throws IOException, ServletException {
boolean newManualSession=false;
String fromSession=null;
if (((HttpServletRequest)req).getSession(false)!=null) {
fromSession=((HttpServletRequest)req).getSession(false).getId();
}
if (fromSession==null) {
fromSession=((HttpServletRequest)req).getSession().getId();
newManualSession=true;
}
String fromCookie=null;
Cookie[] cooks=((HttpServletRequest)req).getCookies();
if (cooks!=null) {
for (int i=0; icooks.length; i++) {
if (cooks[i].getName().equals(JSESSIONID)) {
fromCookie=cooks[i].getValue();
break;
}
}
}
ServletOutputStream out=resp.getOutputStream();
out.println(newManualSession ? Session manually created : );
out.println(fromSession!=null ? From session: +fromSession : No session);
out.println(fromCookie!=null ? From cookies: +fromCookie : No session id in 
cookies);
if (fromSession==null  fromCookie==null)
out.println(Session is completely new);
else if (fromSession==null  fromCookie!=null)
out.println(Session lived but has been expired);
//fchain.doFilter(req, resp);
}

public void destroy() {
fconf=null;
}

}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: Session Timeout and Direct Reference to login page

2004-05-20 Thread Veniamin Fichin
Jonathan Eric Miller wrote:
Thanks. I think option #1 is what I'm looking for. What I don't understand
is what I need to do with the session listener though?
I don't understand how to determine whether the new session is truly new, or
if it's a new session because a previous session timed out. Could I use a
filter and check the incoming session ID and if the session ID isn't in the
list of session IDs that the server knows about, assume that it's an expired
session?
   Yes, this may be the right solution. Store a hash in a singleton 
class and fill it with session ids that has expired (add a new hash pair 
in every invocation of sessionDestroyed()). And at every request check that:
0) HttpSession.isNew()==true .
1) HttpServletRequest.getCookies() array contains an entry that matches 
one of your hash pairs.
   That way you may determine if that session is truly new or an 
expired one. It's just a guess.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: error sset

2004-05-12 Thread Veniamin Fichin
agarlita,dan wrote:

I have some questions about error customisation.
I want to change the look of 500 Error. (that is
org.apache.jasper.JasperException)
so, I want to redirect all strings to the new page.
so, for example the 404 error is simple becouse we know that is Page Not
Found
but, the 500 Error can report errors like According to the TLD or the tag
file, attribute operation is mandatory for tag sql
how can I send that string (exception string) in the new page?
   First, create custom error page, then mention it in web.xml like this:

error-page
 error-code500/error-code
 location/error.jsp/location!-- Your page name --
/error-page
   (Look at web-app_2_3.dtd to see where you must put it -- the order 
of XML tags is important).
   That page should declare itself as error page (%@ page ... 
isErrorPage=true ... %). When a 500 error occurs, container will 
invoke this page, setting exception scripting variable (JSP 2.0 
section 1.4.3) or javax.servlet.jsp.jspException request attribute 
(JSP 1.2 section 2.4.2) to the appropriate Throwable object.
   To get your exception string, try Throwable.getMessage() .

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Applet to Servlet session fails

2004-04-23 Thread Veniamin Fichin
[EMAIL PROTECTED] wrote:

I have a JSP page that has an applet embeded in it. The Applet talks to a
Servlet. I have a session within the JSP when I try to access the session
within my Servlet, I get NullPointerException as there is no session
object.
How do I get the session object in my Servlet that is present in the JSP? I
am using Tomcat 5.0.19
If you use OBJECT ... HTML tag, you can pass parameter to applet 
with PARAM ... tag, namely JSESSIONID. Inside applet you call 
servlet with that session id, that way everybody will know the same 
session. I had this model once and it worked.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Session browsing/modifying

2004-04-23 Thread Veniamin Fichin
Hello all!

   Can anybody tell me how can I archive subj? I need to view all 
sessions rotating in a server and have an ability to modify their 
content, mainly for testing/debugging purposes.
   I'm able to walk through Tomcat containers hierarchy

ServerFactory.getServer()
server.findServices()
service.getContainer()
container.findChildren()
container.getManager()
manager.findSessions()
   ...and so on, (privileged=true), but I wonder if there are already 
any application which can do it for me?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: setting cookies in servlet and read inside the JSP

2004-04-20 Thread Veniamin Fichin
Emerson Cargnin wrote:

How do I read a cookie (inside a JSP) that I created inside a servlet. 
It looks that it has different path properties and so when I'm inside 
the JSP it can't read the cookie...
   There is javax.servlet.http.Cookie.setPath(String) which obviously 
works as it named. :-) After that call 
HttpServletResponse.addCookie(Cookie).

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: SESSION PROBLEM in UNIX

2004-04-20 Thread Veniamin Fichin
MUKUND Premchander wrote:

 I am using tomcat 3.2 not tomcat 4.0 hence as per your suggestion 
I did try and implement HttpSessionBindingListener and  put the object
into the session in the same jsp ,
the valueBound was called but when the session access threw null pointer
exception valueUnbound was not called  
   No-no, you need to implement HttpSessionListener, not 
HttpSessionBindingListener. The former interface will alert you when a 
session is created and destroyed, that way you will know if your session 
does away for example by container or just disappears, that's the bug. 
And still, try somehow to determine if JSESSIONID is passed with each 
request (use filter, HTTP sniffer or anything). If this cookie is 
passed, but session continuously lost, this must be the bug.
   And 3.x version is now outdated a little, so may be there was a bug 
in session handling, but nobody will fix it these days. Consider upgrade 
to at least 4.x serie, that way you may hope someone will help you in 
case of trouble.

And when I gave a sop the request.getSession(false) printed the same
session object .
I did try with NN and I get the same problem .
Kindly help with your comments 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Deploy a directory on Tomcat 5.0

2004-04-20 Thread Veniamin Fichin
[EMAIL PROTECTED] wrote:

I have a directory that contains servlets. This directory, named testdir,
sits on the server, but not in Tomcat 5.0 ( or webapps/WEB-INF/classes).
How do I deploy this directory?
I went to Tomcat Manager, and tried to enter the values in the following
fields, but it didn't work:
Do I also need an XML Configuration file. If so, which one? And where to
put it?
   Yes, you'll need it. Read 
tomcat-docs/deployer-howto.html#Context%20descriptors .

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: shared/lib again...

2004-04-19 Thread Veniamin Fichin
Julio César Aguilar wrote:

I've done several tests in Windows and this is what I found.
To remember my settings
No CATALINA_BASE defined. Tests done with CATALINA_HOME/shared/lib.

1. As being told, I can find jars put in CATALINA_HOME/common/lib.

2.
   What exactly the moment when CNFE is thrown? You said that the 
applications is not even start due to CNFE, so that classes are needed 
during deployment or while normal application functioning?
The original problem was with a Filter, which was started at deployment.
   Then to my opinion this is due to Filter initialization (not 
run-time usage) as implemented in Tomcat: it uses a classloader that 
sees private webapp libraries (WEB-INF/lib/*) and libraries common to 
both webapp and Tomcat itself (CATALINA_HOME/common/lib/*), but not 
CATALINA_HOME/shared/lib/* . Hey, anybody with internals knowlegde can 
clarify this?

If I place the jar that contains the Filter class in WEB-INF/lib then the
application starts, but looking for classes needed after deployment 
(during a normal run) I can't find them if the corresponding jars are in shared/lib.

3. Something I had not mentioned about my application (I did not thought 
it was relevant) is that it lives outside the CATALINA_HOME directory, 
is referred to by a context.xml file in 
CATALINA_HOME/conf/Catalina/localhost.
   I don't think this is relevant eithter...

Using a test application in CATALINA_HOME/webapps and compiling the 
IsThereThisClass servlet provided by Veniamin I can finally find the 
classes within shared/lib.
   Stop, now I've messed up. :-) Your code can not find some jars in 
question, but mine does?? That code simply get servlet's classloader and 
searches a class by given name. So while it gets an ordinary 
this.getClass().getClassLoader(), it legally uses a classloader 
mentioned in Tomcat's docs as WebappX classloader, which surely should 
find all classes in its classpath.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: pageEncoing and contentType

2004-04-19 Thread Veniamin Fichin
Hello Seiji.

   What it means character is not encoded correctly? If PDF content 
is unreadable, then that's PDF file problem, not Tomcat. Is this PDF 
opens correctly by itself, i.e. when you open it through Adobe Reader?
   Anyway, just do response.setContentType(application/pdf) and let 
browser open it accordingly.

seiji takegata wrote:

I'm trying to generate PDF document directory from JSP using 
itext library. I have an encoding problem.

I put pageEncoding and contentType attributes in page directive 
as:

%@ page contentType=application/pdf%
%@ page pageEncoding=Shift_JIS%
Then tomcat (or jasper) translates them like:

response.setContentType(application/pdf;charset=Shift_JIS);

IE will not open AdobeReader, show download dialog instead.

If I do not specify pageEncoding, then the line above will be:

response.setContentType(application/pdf);

AdobeReader opens as I expect. But character is not encoded 
correctory.

I wonder why charset=Shift_JIS is added to contentType string.
I want remove it from the contentType string, or remove whole 
the line. I think I can specify contentType by 

response.setCotentType(application/pdf);


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: pageEncoing and contentType

2004-04-19 Thread Veniamin Fichin
seiji takegata wrote:

Hi Veniamin,
Thank you for your reply.
   What it means character is not encoded correctly? If PDF content 
is unreadable, then that's PDF file problem, not Tomcat. Is this PDF 
opens correctly by itself, i.e. when you open it through Adobe Reader?
   Anyway, just do response.setContentType(application/pdf) and let 
browser open it accordingly.

I tried. Then Japanese characters are all dimed (converted to 
randome characters like noise). 

Because itext asumes Japanese character as Shift_JIS encoded, 
but Tomcat default is UTF-8, so I have to specify pageEncoding 
attribute in page directive.
   Sorry, I don't know what is itext for, text-pdf translator?
   Try this:
%@ page contentType=application/pdf; charset=ISO-8859-1
 pageEncoding=Shift_JIS %
   Is this what you want to archive -- set response type to look like 
PDF without any particular encoding, and to tell Jasper that your source 
encoded with Shift_JIS?
   By the way, it's Jasper who thinks that JSPs are in UTF-8, but 
Tomcat assumes ISO-8859-1 (HTTP standard AFAIK) when processing 
request/response.

I can see PDF content is correct when I save it as a file and
open with Adobe Reader.
My point is why tomcat put charset option to contentType when I 
specify pageEncoding attribute. I might write code to generate
image from String, then the content should not be attributed
like charset=Shift_JIS. but still I need to specify 
pageEncoding attribute for correct character encoding.

I just want tomcat to stop adding charset option when 
pageEncoding attribute is specified.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: pageEncoing and contentType

2004-04-19 Thread Veniamin Fichin
seiji takegata wrote:

   Try this:

%@ page contentType=application/pdf; charset=ISO-8859-1
 pageEncoding=Shift_JIS %
I tried. This time jasper generates:
response.setContentType(application/pdf; charset=ISO-8859-1);
   OK, and with that you still can't get PDF right?
   Maybe you should query tomcat-dev list about how (and if you really 
need) to override Jasper's behaviour on inserting pageEncoding value 
into Content-Type header. All I found is:

org.apache.jasper.compiler.Validator
public static void validate(Compiler, Node.Nodes)
throws JasperException;
   In that method there is some logic that determines ...; 
charset=... value in case this substring is absent in contentType 
page directive.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: shared/lib again...

2004-04-16 Thread Veniamin Fichin
Julio César Aguilar wrote:

   If you use multiple instance Tomcat's feature, this may be the case. 
In Windows I'm using a single instance of tomcat, there's no 
CATALINA_BASE so it should be the same as CATALINA_HOME if I understand 
correctly.
   Then I don't know... My installation is that:

Win2K
Java is 1.4.1_01
CATALINA_HOME=D:\Tomcat-5.0.16
CATALINA_BASE=D:\Projects\CA (or any other)
   %CATALINA_BASE%\shared\lib contains jars needed by most 
applications, and that classes are visible to application. Removing 
CATALINA_BASE variable and placing jars into %CATALINA_HOME%\shared\lib 
still works.
   I just wrote a simple servlet that looks for the class whose name is 
passed as parameter.

IsThereThisClass.java
package org.unchqua.test.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class IsThereThisClass extends HttpServlet {

public void doGet (HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType(text/plain);
PrintWriter out=resp.getWriter();
String cn=req.getParameter(cn);
ClassLoader cnLoader=null;
if (cn==null) {
out.println(No class name given, I want \cn\ parameter);
return;
}
out.print(The class \+cn+\ is);
try {
cnLoader=this.getClass().getClassLoader().loadClass(cn)
  .getClassLoader();
}
catch (ClassNotFoundException cnfe) {
out.print( not);
}
out.println( found);
if (cnLoader!=null) {
out.println(Loader:\n--\n+cnLoader+--);
}
}
}
/IsThereThisClass.java
   Map it to any working application and call it like 
classfind?cn=com.example.your.package.YourClass to see if it is visible 
to any webapp's classloader.
   What exactly the moment when CNFE is thrown? You said that the 
applications is not even start due to CNFE, so that classes are needed 
during deployment or while normal application functioning?

In Linux I'm using a single binary of tomcat and have the jar in 
CATALINA_BASE/shared/lib.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: SESSION PROBLEM in UNIX

2004-04-15 Thread Veniamin Fichin
MUKUND Premchander wrote:

Thank you for your reply .

I use IE 6 as my browser in windows and tomcat on HP unix.
I meant that ,all I did was open a browser window load my application,
goto a particular page Set page to refresh for every 10 secs(
application had a combo box to set interval of refresh).After few
refresh I get a null pointer exception and realize that the session is
null suddenly .( I repeat I don't get this issue when I run tomcat in
windows) 
   Anyway, first try to localize the problem, there are some ways:
* implement javax.servlet.http.HttpSessionListener interface to see 
what's happening with your sessions;
* install RequestDumperFilter filter into your application to see every 
request and response data;
* sniff HTTP traffic (don't know how...)
* try another browser (I don't force you to throw IE, just try another 
one), for example Mozilla has excellent tool named Live HTTP headers 
which shows all HTTP request/response headers.

   That way you will see if a session invalidates normally for whatever 
reason or it lost somehow.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: shared/lib again...

2004-04-15 Thread Veniamin Fichin
Julio Cesar Aguilar wrote:
I've read the ClassLoading part of Tomcat documentation and searched this list 
but I've still found no clue to my recent problem:

Tomcat 5.0.19
JDK 1.4.2_03
Windows XP
I have several applications running with a common jar of my own in each 
WEB-INF/lib and everthing works.
If I move that jar to %CATALINA_HOME%/shared/lib the applications wont start 
reporting a CNFE about a class in the previously mentioned jar.
   If you use multiple instance Tomcat's feature, this may be the case. 
According to class-loader-howto.html, shared classloader looks its 
classes in $CATALINA_BASE/shared/lib , not in $CATALINA_HOME/shared/lib 
. I just tried this and it works.
   Alternatively you can place your .jar in $CATALINA_HOME/common/lib .

I can reproduce the problem in Linux (same version of Tomcat and JDK) placing 
the jar in CATALINA_BASE/shared/lib or CATALINA_HOME/shared/lib.

Is there something that has to be done to be able to share a jar through 
applications?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: jsessionid parameter not being accepted

2004-04-15 Thread Veniamin Fichin
Malcolm Warren wrote:

I wish it was as easy as you say...
I know that I don't have to implement my own url re-writing, but I did, 
and it was a long time ago!
Right now I don't really want to re-write everything - sending the 
jsessionid as an ordinary parameter worked in Jrun, can't it work in 
Tomcat?
   You may be required to implement custom Manager (see 
org.apache.catalina.Manager interface), where you'll put your session id 
generation logic. But if you are not absolutely forced to use that 
old-fashined url-rewrite style, you should use session mechanism 
described in Servlet spec. That spec also mentions url-rewrite solution, 
when a user have switched cookie off, but still it is advisable to use 
response.encodeURL(String) method.
   Read description of 
javax.servlet.http.HttpServletResponse.encodeURL(String) for a more 
advanced explanation.

On Thu, 15 Apr 2004 15:25:00 +0200, Ralph Einfeldt 
[EMAIL PROTECTED] wrote:

- You don't have to implement your own url re-writing
- The time is long gong when the session id was a parameter,
  it's now before the ?
Just throw away your url rewiting and use rsponse.encodeUrl()
instead.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: directory structure and porting issues

2004-04-12 Thread Veniamin Fichin
QM wrote:

: - Finally, is it the best practice to hard-code the 'context' prefix in 
: your application?

JSTL.  I forget the exact tag names, but any JSTL reference will have
them listed.  There's a tag for creating context-relative links, and (I
believe) one for creating context-relative image tags.
  Yes, William, take a look at JSTL specification, it's here: 
http://jcp.org/aboutJava/communityprocess/final/jsr052/ . See subsection 
7.1 .

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: SESSION VARIABLE BECOMES NULL AFTER SOME REFRESH

2004-04-12 Thread Veniamin Fichin
Peter Guyatt wrote:

Hi There,

The NPE is coming from the { if (session == null || session.isNew()) }
since even if session is null then you are still trying to call a method of
session.
   According to Java language specification, 15.24 Conditional-Or 
Operator ||, it's not so. That says that right-hand operator only 
executes when left-hand operator is false, so in this code session!=null.

-Original Message-
From: MUKUND Premchander [mailto:[EMAIL PROTECTED]
Sent: 12 April 2004 11:19
To: [EMAIL PROTECTED]
Subject: SESSION VARIABLE BECOMES NULL AFTER SOME REFRESH
Hi,

I have a jsp page which is refreshed atuomatically every 10 seconds.I
get and put values in the session by using the implicit session variable
. Everything works fine for say 2-3 mins after that the session becomes
null and throws a null pointer exception.
IN the try block I even have a code as
try {
 if (session == null || session.isNew()) {
//do something
  } else {
 //do otherwise
  }
 }catch(Exception e )
 { //print stack trace and value of session }
I get a null pointer exception and session is preinted as null but even
the if block is noit executed . I printed the value of
request.getSession(false);.This gives me session object ,where as the
implicit session does not have this after many refresh interval . During
the first few refresh both have the same value.
   May be some logic deep in your code invalidates session somehow? You 
can set up RequestDumperFilter to look at HTTP headers you (your 
browser) send and what is received. I don't know if that filter 
available in Tomcat 3.2, 'cause I use it since 4.1 time, but you can 
grab it from recent Tomcat distribution. Or you can use 
javax.servlet.http.HttpSessionListener to be notified when a session is 
about to be invalidated or timed out.

Also note that this runs fine in Windows ,I get this problem only in
UNIX . I use tomcat 3.2 in unix and view using IE in windows


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Servlet on Tomcat + Oracle +ISU 8859-8 (Hebrew CharSet) - encodin g problem

2004-04-02 Thread Veniamin Fichin
Hi there.

   May be this bug report 
http://issues.apache.org/bugzilla/show_bug.cgi?id=23929 will enlighten 
you, me and others who have issues with i18n. Very professional 
explanation of the problem, thanks to Remy.

[EMAIL PROTECTED] wrote:

The problem:
I am using Oracle 8.1.7 DB , in a Charest ISU 8859-9-8 ( Hebrew ), I use a
thin client as the JDBC driver .
I have a servlet that all it does is getting and updating one of the table
cut/
I  use the doGet method of a servlet to get parameters to retrieve from
Oracle. this is done through the URL, for example :
I send the parameters like this :
http://localhost:8080/myapp/myapp?name=yair
http://localhost:8080/myapp/myapp?name=yairfamily=fine family=fine
for name= yair, family = fine
 
There is no problem in getting and inserting English characters.
There is a problem when i try to get or to insert Hebrew characters.
i get  in DB , for both if i write yair in the url in Hebrew , or i
write yair in %E9%E9%E9%F8 which is the decimal representation 
 
For example , if i insert a string in Hebrew , it looks like this ? (
in SQL +)
 
this is how i get the requests from the url
Enumeration paramEnum = request.getParameterNames(); // get request
parameters from the url , in param/value pairs
String myParam = (String) paramEnum.nextElement(); //get parameter
String myValue = request.getParameter(myParam);  //get value
 
String myStatment = insert into mytable values('19', '+myValue+') insert
to table 19 , myvalue
ResultSet rs = stmt.executeQuery(myStatment);
 
does any one have a solution for that ?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: JSP Include and URL encoding

2004-04-02 Thread Veniamin Fichin
Dennis Thrysøe wrote:

Hi,

I'm having problems including a JSP page from another JSP page using 
parameters with special characters.

I looked through the archives, but couldn't find anything about this issue.
   Try this URL: 
http://issues.apache.org/bugzilla/show_bug.cgi?id=23929 . Connector 
attributes mentioned there available since 5.0.19, as I understand.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Servlet on Tomcat + Oracle +ISU 8859-8 (Hebrew CharSet) - encodin g problem

2004-03-31 Thread Veniamin Fichin
This is my problem also, and sadly it's so since long time I use Tomcat.

   I've attach a simple little test case .war file to reproduce the 
problem. There are four HTML forms there, two of them submits to JSP 
page (GET and POST methods), others go to servlet (same methods).
   On top of it is a select field allowing to define an encoding for 
future submits. It acts as following: after choosing it and submitting 
that select the JSP page is reloaded with that encoding, setting its 
response.setContentType() and setting session attribute named 
tHAVW07QUf (for uniqueness, see below). Now, one can submit any form 
presented below.
   I've deployed a filter.SetCharacterEncodingFilter (taken from 
standard Tomcat distribution), with one modification: during every 
request it reads session attribute tHAVW07QUf and sets requests' 
encoding accordingly. If that attribute is absent, it reads its init 
parameter given in web.xml as usually. So, instead of hard-coding 
character incoding in web.xml, I can set it online. According to 
filters.RequestDumperFilter (also Tomcat's standard filter) it works.
   So, let's see what we have here. The result on my machine is that 
any GET methods produces broken output of the parameter passed as 
URL-encoded %XX%XX%XX string, actual encoding of which is set by select 
box on the first page. Any combinations of encoding, submit methods and 
target actions (JSP or Servlet) give me broken output, except two of 
them -- utf-8 POST to JSP and utf-8 POST to Servlet.
   I looked at Tomcat's some source files, namely 
org.apache.catalina.util.RequestUtil.URLDecode(byte[], String) and 
org.apache.catalina.util.RequestUtil.parseParameters(java.util.Map, 
byte[], String), and see how url-encoded request parameters are parsed, 
but I don't know if it's the right place to see.
   Ah, and one note. I tried to run Tomcat with 
-Dfile.encoding=koi8-r option to set default byte[]-String conversion 
mapping to koi8-r (for example), and even this does not help me much, 
though it sets the new default.
   This behaviour was there on 4.x and 5.x versions, seems like nothing 
is changing.

   I don't state that I've done all tests correctly, so in any error 
please fix my mind. The only question is: how one can universally and 
correctly handle non-ASCII request parameters and get rightly decoded 
output?

[EMAIL PROTECTED] wrote:

Hi all ,
i have a problem with encoding and decoding, from a servlet , running on
Tomcat , to Oracle DB.
I hope it is the right forum for that , and i appologize if ti is not ..
 
The problem:
I am using Oracle 8.1.7 DB , in a Charest ISU 8859-9-8 ( Hebrew ), I use a
thin client as the JDBC driver .
I have a servlet that all it does is getting and updating one of the table
 
The character set in the servlet is too , ISO 8859-8 . This is done this
way:
 
public void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  
  request.setCharacterEncoding(ISO-8859-8);
  response.setContentType(Text/html; ISO-8859-8);
  .
} 

I  use the doGet method of a servlet to get parameters to retrieve from
Oracle. this is done through the URL, for example :
I send the parameters like this :
http://localhost:8080/myapp/myapp?name=yair
http://localhost:8080/myapp/myapp?name=yairfamily=fine family=fine
for name= yair, family = fine
 
There is no problem in getting and inserting English characters.
There is a problem when i try to get or to insert Hebrew characters.
i get  in DB , for both if i write yair in the url in Hebrew , or i
write yair in %E9%E9%E9%F8 which is the decimal representation 
 
For example , if i insert a string in Hebrew , it looks like this ? (
in SQL +)

 
this is how i get the requests from the url
Enumeration paramEnum = request.getParameterNames(); // get request
parameters from the url , in param/value pairs
String myParam = (String) paramEnum.nextElement(); //get parameter
String myValue = request.getParameter(myParam);  //get value
 
String myStatment = insert into mytable values('19', '+myValue+') insert
to table 19 , myvalue
ResultSet rs = stmt.executeQuery(myStatment);
 
does any one have a solution for that ?



charset.renametowar.gz
Description: GNU Zip compressed data
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

[Fwd: Re: Servlet on Tomcat + Oracle +ISU 8859-8 (Hebrew CharSet) - encodin g problem]

2004-03-31 Thread Veniamin Fichin
   Some fixes to WAR file posted recently. Now POST methods all work 
fine, but none of GET.

 Original Message 
Subject: Re: Servlet on Tomcat + Oracle +ISU 8859-8 (Hebrew CharSet) - 
encodin g problem
Date: Wed, 31 Mar 2004 14:34:27 +0400
From: Veniamin Fichin [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
References: [EMAIL PROTECTED]

This is my problem also, and sadly it's so since long time I use Tomcat.

I've attach a simple little test case .war file to reproduce the
problem. There are four HTML forms there, two of them submits to JSP
page (GET and POST methods), others go to servlet (same methods).
On top of it is a select field allowing to define an encoding for
future submits. It acts as following: after choosing it and submitting
that select the JSP page is reloaded with that encoding, setting its
response.setContentType() and setting session attribute named
tHAVW07QUf (for uniqueness, see below). Now, one can submit any form
presented below.
I've deployed a filter.SetCharacterEncodingFilter (taken from
standard Tomcat distribution), with one modification: during every
request it reads session attribute tHAVW07QUf and sets requests'
encoding accordingly. If that attribute is absent, it reads its init
parameter given in web.xml as usually. So, instead of hard-coding
character incoding in web.xml, I can set it online. According to
filters.RequestDumperFilter (also Tomcat's standard filter) it works.
So, let's see what we have here. The result on my machine is that
any GET methods produces broken output of the parameter passed as
URL-encoded %XX%XX%XX string, actual encoding of which is set by select
box on the first page. Any combinations of encoding, submit methods and
target actions (JSP or Servlet) give me broken output, except two of
them -- utf-8 POST to JSP and utf-8 POST to Servlet.
I looked at Tomcat's some source files, namely
org.apache.catalina.util.RequestUtil.URLDecode(byte[], String) and
org.apache.catalina.util.RequestUtil.parseParameters(java.util.Map,
byte[], String), and see how url-encoded request parameters are parsed,
but I don't know if it's the right place to see.
Ah, and one note. I tried to run Tomcat with
-Dfile.encoding=koi8-r option to set default byte[]-String conversion
mapping to koi8-r (for example), and even this does not help me much,
though it sets the new default.
This behaviour was there on 4.x and 5.x versions, seems like nothing
is changing.
I don't state that I've done all tests correctly, so in any error
please fix my mind. The only question is: how one can universally and
correctly handle non-ASCII request parameters and get rightly decoded
output?
[EMAIL PROTECTED] wrote:

Hi all ,
i have a problem with encoding and decoding, from a servlet , running on
Tomcat , to Oracle DB.
I hope it is the right forum for that , and i appologize if ti is not ..
 
The problem:
I am using Oracle 8.1.7 DB , in a Charest ISU 8859-9-8 ( Hebrew ), I use a
thin client as the JDBC driver .
I have a servlet that all it does is getting and updating one of the table
 
The character set in the servlet is too , ISO 8859-8 . This is done this
way:
 
public void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  
  request.setCharacterEncoding(ISO-8859-8);
  response.setContentType(Text/html; ISO-8859-8);
  .
} 

I  use the doGet method of a servlet to get parameters to retrieve from
Oracle. this is done through the URL, for example :
I send the parameters like this :
http://localhost:8080/myapp/myapp?name=yair
http://localhost:8080/myapp/myapp?name=yairfamily=fine family=fine
for name= yair, family = fine
 
There is no problem in getting and inserting English characters.
There is a problem when i try to get or to insert Hebrew characters.
i get  in DB , for both if i write yair in the url in Hebrew , or i
write yair in %E9%E9%E9%F8 which is the decimal representation 
 
For example , if i insert a string in Hebrew , it looks like this ? (
in SQL +)

this is how i get the requests from the url
Enumeration paramEnum = request.getParameterNames(); // get request
parameters from the url , in param/value pairs
String myParam = (String) paramEnum.nextElement(); //get parameter
String myValue = request.getParameter(myParam);  //get value
 
String myStatment = insert into mytable values('19', '+myValue+') insert
to table 19 , myvalue
ResultSet rs = stmt.executeQuery(myStatment);
 
does any one have a solution for that ?




charset.renametowar.gz
Description: GNU Zip compressed data
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: [Fwd: Re: Servlet on Tomcat + Oracle +ISU 8859-8 (Hebrew Char Set)- encodin g problem]

2004-03-31 Thread Veniamin Fichin
[EMAIL PROTECTED] wrote:

Thanks Veniamin Fichin,
Can you copy paste your code that solves the problem?
   The output encoding of view.jsp page was hard-coded utf-8 value. I 
changed it to be more flexible by lookling into session attribute which 
was set previously. Code snipped follows.

--- view.jsp: ---

%
String encoding=(String)session.getAttribute(tHAVW07QUf);
if (session!=null) {
response.setContentType(text/html; charset=+encoding);
}
%
%@ page pageEncoding=utf-8 info=Test: localized parameters%
!-- ... JSP body ... --
--- / view.jsp: ---

   Session attribute setting you can see in source code. But bear in 
mind that this fix works with POST method only (at least for me).

Regards 
Yair Fine
2all: have anybody interested in this topic tried that .war? What's the 
results?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


JNDI DBCP resources, another problem.

2003-02-03 Thread Veniamin Fichin
Hello list.

   I fought with that for about two weeks recently and had done it, so 
my JNDIRealm works. But! Now servlet that just gets a connection from 
JNDI resource and tries to query database is broken! Situation is that:

...
GlobalNamingResource
 Resource ... /
 ResourceParams
  ...
 /ResourceParams
/GlobalNamingResource
...
Context
 ResourceLink ... /
  Realm ... /
/Context
...

works with JNDIRealm, but not with common servlet getting resource from 
JNDI, and

...
Context
 Resource ... /
 ResourceParams
  ...
 /ResourceParams
 Realm ... /
/Context
...

works with servlet but not with JNDIRealm! It's only two options to have 
a resource in JNDI -- define it inside GlobalNamingResource or inside 
Context , and each of it works separately but not simultaneously.

Any advice/suggestion/RTFM link will be GREATELY appreciated because I'm 
really want to know what's going on behind the scene to not ask such a 
stupid questions again.

Thanks a lot.

--
Veniamin Fichin  [EMAIL PROTECTED]
Programmer athttp://www.rbcsoft.ru/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JNDI DBCP resources, another problem.

2003-02-03 Thread Veniamin Fichin
Veniamin Fichin wrote:


Hello list.

   I fought with that for about two weeks recently and had done it, so 
my JNDIRealm works. But! Now servlet that just gets a connection from 
JNDI resource and tries to query database is broken! Situation is that:

   Correction: not JNDIRealm, but DataSourceRealm. Sorry for inconvenience.


...
GlobalNamingResource
 Resource ... /
 ResourceParams
  ...
 /ResourceParams
/GlobalNamingResource
...
Context
 ResourceLink ... /
  Realm ... /
/Context
...

works with JNDIRealm, but not with common servlet getting resource from 
JNDI, and

...
Context
 Resource ... /
 ResourceParams
  ...
 /ResourceParams
 Realm ... /
/Context
...

works with servlet but not with JNDIRealm! It's only two options to have 
a resource in JNDI -- define it inside GlobalNamingResource or inside 
Context , and each of it works separately but not simultaneously.

Any advice/suggestion/RTFM link will be GREATELY appreciated because I'm 
really want to know what's going on behind the scene to not ask such a 
stupid questions again.

Thanks a lot.

--
Veniamin Fichin  [EMAIL PROTECTED]
Programmer athttp://www.rbcsoft.ru/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: DataSourceRealm -- solved

2003-01-24 Thread Veniamin Fichin
Jacob Kjome wrote:


You don't have to pur your Resource and ResourceParam tags in 
GlobalNamingResources .  Just put them inside your Context take and 
things will work fine.

   That's why I began this thread -- this configuration does not work.

...
Context
 Resource /
 ResourceParams
...
 /ResourceParams
 Realm /
/Context
...

   doesn't work, but

...
GlobalNamingResource
 Resource /
 ResourceParams
...
 /ResourceParams
/GlobalNamingResource
...
Context
 ResourceLink /
 Realm /
/Context

   works. And from exploring source code it looks like this.
   Method open:

--= [ cut ] =--
StandardServer server = (StandardServer) ServerFactory.getServer();
Context context = server.getGlobalNamingContext();
DataSource dataSource = (DataSource)context.lookup(dataSourceName);
return dataSource.getConnection();
--= [ / cut ] =--

   It's a global naming context that is searched for a JNDI name 
requested. Am I right?

Jake

At 07:01 PM 1/23/2003 +0300, you wrote:


Hello list!

   Recently I posted a question about how to make DataSourceRealm 
work. After waiting for an answer here and in tomcat-dev list, I've 
finally gone it. So for those who want to use it, here are my steps.
   Configure server.xml to have Resource ... and ResourceParams 
... in GlobalNamingResource tag. Have a link to this resource using 
ResourceLink ... inside your Context. And configute Realm ... 
referencing to corresponding DataSource JNDI name (use absolute 
reference, i.e. starting with java:/comp/env , not relative like 
jdbc/something). Example server.xml and web.xml are in attach. If 
anybody will see any errors in these files, I'd be happy to hear them.
   Though I have one question. What if I don't want to have Resource 
... defined in global area? For example, I have several Contexts and 
want to use this resource in one of them only. Will ResourceLink's 
existance in one Context be the guarantee that only this Context will 
have an access to Resource, but not the others?

--= [ cut ] =--

--
Veniamin Fichin  [EMAIL PROTECTED]
Programmer athttp://www.rbcsoft.ru/


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




DataSourceRealm -- solved

2003-01-23 Thread Veniamin Fichin
Hello list!

   Recently I posted a question about how to make DataSourceRealm work. 
After waiting for an answer here and in tomcat-dev list, I've finally 
gone it. So for those who want to use it, here are my steps.
   Configure server.xml to have Resource ... and ResourceParams ... 
in GlobalNamingResource tag. Have a link to this resource using 
ResourceLink ... inside your Context. And configute Realm ... 
referencing to corresponding DataSource JNDI name (use absolute 
reference, i.e. starting with java:/comp/env , not relative like 
jdbc/something). Example server.xml and web.xml are in attach. If 
anybody will see any errors in these files, I'd be happy to hear them.
   Though I have one question. What if I don't want to have Resource 
... defined in global area? For example, I have several Contexts and 
want to use this resource in one of them only. Will ResourceLink's 
existance in one Context be the guarantee that only this Context will 
have an access to Resource, but not the others?

--
Veniamin Fichin  [EMAIL PROTECTED]
Programmer athttp://www.rbcsoft.ru/
?xml version=1.0 encoding=UTF-8 ?
Server port=8005 shutdown=SHUTDOWN debug=0
 GlobalNamingResources
  Resource name=jdbc/datasource
type=javax.sql.DataSource
auth=Container
scope=Unshareable
description=Database resource for webapp project /
  ResourceParams name=jdbc/esljsp
   parameter
nameurl/name
valuejdbc:oracle:thin:@www.dbhost.com:1521:sid/value
   /parameter
   parameter
namedriverClassName/name
valueoracle.jdbc.driver.OracleDriver/value
   /parameter
   parameter
nameusername/name
valueusername/value
   /parameter
   parameter
namepassword/name
valuepassword/value
   /parameter
   parameter
namemaxActive/name
value20/value
typejava.lang.Integer/type
   /parameter
   parameter
namemaxIdle/name
value10/value
typejava.lang.Integer/type
   /parameter
   parameter
namemaxWait/name
value5000/value
typejava.lang.Long/type
   /parameter
   parameter
namedefaultAutoCommit/name
valuefalse/value
typejava.lang.Boolean/type
   /parameter
   parameter
namedefaultReadOnly/name
valuefalse/value
typejava.lang.Boolean/type
   /parameter
   parameter
namevalidationQuery/name
valueselect count(PRIMARYKEY_ID) from TABLE/value
   /parameter
   parameter
nameremoveAbandoned/name
valuetrue/value
   /parameter
   parameter
nameremoveAbandonedTimeout/name
value60/value
   /parameter
   parameter
namelogAbandoned/name
valuetrue/value
   /parameter
   parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
   /parameter
  /ResourceParams
 /GlobalNamingResources
 Service name=Tomcat-Standalone
  Connector className=org.apache.coyote.tomcat4.CoyoteConnector
 port=8080
 minProcessors=5
 maxProcessors=75
 enableLookups=true
 acceptCount=10
 debug=0
 connectionTimeout=2
 useURIValidationHack=false /
  Engine name=Standalone
  defaultHost=localhost
  debug=99
   Logger className=org.apache.catalina.logger.FileLogger
   verbosity=4
   prefix=catalina_log.
   timestamp=true
   suffix=.txt /
   Host name=localhost
 debug=99
 appBase=webapps 
 unpackWARs=true
 autoDeploy=true
Logger className=org.apache.catalina.logger.FileLogger
verbosity=4
directory=logs
prefix=localhost_log.
timestamp=true
suffix=.txt /
Context path=/webapp
 docBase=webapp/web
 reloadable=true
 debug=99
 swallowOutput=true
 Logger className=org.apache.catalina.logger.FileLogger
 verbosity=4
 prefix=localhost_webapp_log.
 timestamp=true
 suffix=.txt /
 ResourceLink name=jdbc/datasource
   global=java:comp/env/jdbc/datasource
   type=javax.sql.DataSource /
 Realm className=org.apache.catalina.realm.DataSourceRealm
dataSourceName=jdbc/datasource
debug=99
userTable=T_USERS
userNameCol=NAME
userCredCol=PASSWORD
userRoleTable=T_USERROLES
roleNameCol=ROLENAME /
/Context
   /Host
  /Engine
 /Service
/Server
?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app PUBLIC
 -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;

web-app
 resource-ref
  descriptionOracle database resource for esljsp project/description
  res-ref-namejdbc/esljsp/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  res-sharing-scopeUnshareable/res-sharing-scope
 /resource-ref
 security-constraint
  web-resource-collection
   web-resource-nameAdministrator's interface/web-resource-name

Re: Jasper and big html files

2003-01-20 Thread Veniamin Fichin
Hello, Nome!

 I have a problem with both Jasper and Jasper2. If I have a huge
 piece of HTML inserted between two  statements, the generated
 out.println() on the compiled code outputs just the first
 8192 characters. I tried to  play with the 'largefile' option
 in the /conf/web.xml:

   May be it's a default value of buffer size of a JSP file? Look at 
%@ page buffer=... % directive, its default is 8kb.

--
Veniamin Fichin  [EMAIL PROTECTED]
Programmer athttp://www.rbcsoft.ru/


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



javax.naming.NameNotFoundException: Name java: is not bound in thisContext

2003-01-16 Thread Veniamin Fichin
Hello list!

   I wrote a message about this problem yesterday, but did not receive 
any reply. I can accept the fact that nobody faced this problem, but may 
be somebody have done similar task before, and can share your experience 
with me and others?
   Lets describe the problem. I want to restrict access to some area at 
my site using FORM authentication. I've added Realm definition in 
config.xml:

Realm className=org.apache.catalina.realm.DataSourceRealm
   dataSourceName=java:/comp/env/jdbc/esljsp
   debug=5
   userTable=T_USERS
   userNameCol=NAME
   userCredCol=PASSWORD
   userRolesTable=T_USERROLES
   roleNameCol=ROLENAME /

...and security constraints in web.xml:

security-constraint
 web-resource-collection
  web-resource-nameAdministrator's interface/web-resource-name
  url-pattern/adm/*/url-pattern
  http-methodGET/http-method
  http-methodPOST/http-method
 /web-resource-collection
 auth-constraint
  role-nameAdministrator/role-name
 /auth-constraint
/security-constraint
login-config
 auth-methodFORM/auth-method
 realm-nameAdministrator's interface/realm-name
 form-login-config
  form-login-page/login.jsp/form-login-page
  form-error-page/login_error.jsp/form-error-page
 /form-login-config
/login-config
security-role
 role-nameAdministrator/role-name
/security-role

   During Tomcat startup process, I see following in logs:

2003-01-16 12:56:19 DataSourceRealm[/esljsp]: Exception performing 
authentication
javax.naming.NameNotFoundException: Name java: is not bound in this Context
	at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
	at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:463)
	at 
org.apache.catalina.realm.DataSourceRealm.start(DataSourceRealm.java:582)
	at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:3543)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
	at org.apache.catalina.core.StandardService.start(StandardService.java:497)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
	at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
	at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

   And these lines appears in logs _before_ configuring DataSource, 
which completes fine. I've been told that this may be due to different 
classloaders (Catalina level and WebApp level), but I'm not sure, 
because it's strange -- to be unable to find java: name...
   I can (or at least try to) use JDBCRealm to make it work, but as 
soon as I have DataSource properly configured, I want to use it. I 
tested it in a servlet, and it works.

--
Veniamin Fichin  [EMAIL PROTECTED]
Programmer athttp://www.rbcsoft.ru/


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



Re: javax.naming.NameNotFoundException: Name java: is not bound inthis Context

2003-01-16 Thread Veniamin Fichin
Thanks for your reply!
See below...

Roberts, Eric wrote:


Hi,

Try this:

First define your DataSource resource e.g.
Resource name=jdbc/esljsp auth=Container scope=Shareable type=javax.sql.DataSource/

and add the necessary ResourceParams name=jdbc/esljsp
and the parameters.
then define your Realm using:

dataSourceName=jdbc/esljsp


   I already have these lines in config.xml:

--= [ server.xml ] =--
 Resource name=jdbc/esljsp
   type=javax.sql.DataSource
   auth=Container
   scope=Shareable
   description=Database resource for esljsp project /
 ResourceParams name=jdbc/esljsp
!-- various parameters not shown here --
 /ResourceParams
 Realm className=org.apache.catalina.realm.DataSourceRealm
dataSourceName=java:/comp/env/jdbc/esljsp
debug=5
userTable=T_USERS
userNameCol=NAME
userCredCol=PASSWORD
userRolesTable=T_USERROLES
roleNameCol=ROLENAME /
--= [ / server.xml ] =--

   If I haven't them there, I wouldn't be able to connect to database 
in my servlets, getting DataSource through JNDI. But servlets work just 
fine.
   And exception is thrown while Tomcat starts up, telling me that 
java: name is not found, so this must not be configuration problem.

HTH

Eric

-Original Message-


--= [ cut ] =--


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: javax.naming.NameNotFoundException: Name java: is not bound inthis Context

2003-01-16 Thread Veniamin Fichin
Roberts, Eric wrote:


Yes, but the resource name is jdbc/esljsp - java:comp/env/jdbc/esljsp would be used in a servlet using JNDI such as:

 ctx = new InitialContext();
 Context envCtx = (Context) ctx.lookup(java:/comp/env/);
 DataSource ds = (DataSource) envCtx.lookup(/jdbc/esljsp);


   Servlet snippet:

--= [ cut ] =--
try {
javax.naming.InitialContext initCtx=new InitialContext();
javax.naming.Context envCtx=
  (Context)initCtx.lookup(java:/comp/env);
javax.sql.DataSource ds=(DataSource)envCtx.lookup(jdbc/esljsp);
}
catch (NamingException ne) {
out.println(ne);
}
--= [ / cut ] =--

   And it works. But dataSourceName attribute from DataSourceRealm is not.


Regards

Eric

-Original Message-


--= [ cut ] =--


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: javax.naming.NameNotFoundException: Name java: is not bound inthis Context

2003-01-16 Thread Veniamin Fichin
Roberts, Eric wrote:


Sorry - missed it earlier - in the Realm definition, I think it should be just resourceName=jdbc/esljsp - not dataSourceName=jdbc/esljsp


   That's odd. There is no resourceName attribute in DataSourceRealm 
documentation. I looked at the source of it and saw 
(set|get)DataSourceName only.
   And I see that tomcat docs is wrong in DataSourceRealm description, 
because attribute list there is not reflect real things in code.
   Now I'm trying to look into the sources, but I'm not so hacky...

-Original Message-
From: Veniamin Fichin [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 16. Jänner 2003 12:26
To: Tomcat Users List
Subject: Re: javax.naming.NameNotFoundException: Name java: is not bound
in this Context

Roberts, Eric wrote:


Yes, but the resource name is jdbc/esljsp - java:comp/env/jdbc/esljsp would be used in a servlet using JNDI such as:

ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup(java:/comp/env/);
DataSource ds = (DataSource) envCtx.lookup(/jdbc/esljsp);



Servlet snippet:

--= [ cut ] =--
try {
 javax.naming.InitialContext initCtx=new InitialContext();
 javax.naming.Context envCtx=
   (Context)initCtx.lookup(java:/comp/env);
 javax.sql.DataSource ds=(DataSource)envCtx.lookup(jdbc/esljsp);
}
catch (NamingException ne) {
 out.println(ne);
}
--= [ / cut ] =--

And it works. But dataSourceName attribute from DataSourceRealm is not.


Regards

Eric

-Original Message-


--= [ cut ] =--


--
Veniamin Fichin  [EMAIL PROTECTED]
Programmer athttp://www.rbcsoft.ru/


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: javax.naming.NameNotFoundException: Name java: is not bound inthis Context

2003-01-16 Thread Veniamin Fichin
Roberts, Eric wrote:


Just some other things which may help:

I define my Realm datasource in the GlobalNamingResource element of server.xml and this is where the parameters are also defined.
Any Context requiring authentication is defined with privileged=true.
My Realm is defined within the Engine element - as the last item.


   Thanks, but this didn't help either. :-(

 I am using 4.1.18 also - but upgraded from 4.1.12

   I use 4.1.18 upgraded from 4.1.16 . Really, I use Multiple 
instances of Tomcat scheme, keeping $CATALINA_BASE the same, and just 
point $CATALINA_HOME to newly downloaded and un-tar.gz-iped directory of 
Tomcat. This way, only configs stay the same, and are reviewed only to 
reflect what new version's docs say.


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



DataSourceRealm -- unbounded context name

2003-01-15 Thread Veniamin Fichin
Hello list!

   Currently I'm trying to protect some area at my site with FORM based 
authentication. Following Servlet 2.3 specification, I wrote this 
configutation:

--= [ server.xml ] =--
 Resource name=jdbc/esljsp
   type=javax.sql.DataSource
   auth=Container
   scope=Unshareable
   description=Database resource for esljsp project /
 ResourceParams name=jdbc/esljsp
!-- various parameters --
 /ResourceParams
 Realm className=org.apache.catalina.realm.DataSourceRealm
dataSourceName=java:/comp/env/jdbc/esljsp
debug=5
userTable=T_USERS
userNameCol=NAME
userCredCol=PASSWORD
userRolesTable=T_USERROLES
roleNameCol=ROLENAME /
/Context
--= [ / server.xml ] =--

--= [ web.xml ] =--
 resource-ref
  descriptionOracle database resource for esljsp project/description
  res-ref-namejdbc/esljsp/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  res-sharing-scopeUnshareable/res-sharing-scope
 /resource-ref
 security-constraint
  web-resource-collection
   web-resource-nameAdministrator's interface/web-resource-name
   url-pattern/adm/*/url-pattern
   http-methodGET/http-method
   http-methodPOST/http-method
  /web-resource-collection
  auth-constraint
   role-nameAdministrator/role-name
  /auth-constraint
 /security-constraint
 login-config
  auth-methodFORM/auth-method
  realm-nameAdministrator's interface/realm-name
  form-login-config
   form-login-page/login.jsp/form-login-page
   form-error-page/login_error.jsp/form-error-page
  /form-login-config
 /login-config
 security-role
  role-nameAdministrator/role-name
 /security-role
--= [ / web.xml ] =--

   But as far as I see, this configuration is not relevant with a 
problem, because at the Tomcat startup, this exception is thrown:

2003-01-15 15:20:28 DataSourceRealm[/esljsp]: Exception performing 
authentication
javax.naming.NameNotFoundException: Name java: is not bound in this Context
	at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
	at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:463)
	at 
org.apache.catalina.realm.DataSourceRealm.start(DataSourceRealm.java:582)
	at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:3543)

--= [ cut ] =--

   But if I use test servlet to obtain java:/comp/env/jdbc/esljsp JNDI 
name, it returns in right state -- it's BasicDataSource instance.
   I've tried some hopeless variation like /comp/env/jdbc/esljsp , 
jdbc/esljsp , with no success.
   Does anybody know what kind of trouble it may be?


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



DataSourceRealm does not exists?

2003-01-14 Thread Veniamin Fichin
Hi list!

I've faces the strange problem that I don't understand.

I need to configure some authentication at some part of our site, so I 
chose FORM based authentication through DataSourceRealm described in 
Realm Configuration HOW-TO.
First, I've mentioned that explanation about DataSourceRealm and 
attribute list are strangely similar to JDBCRealm one (is it just a 
copypaste?) -- that is, in some places there is JDBCRealm where 
DataSourceRealm should be.
Second, attribute list for DSR has no differences with JDBCR -- how 
should I declare jndi name for a data source? But it the Example 
subsection below there is dataSourceName attribute, and className is 
org.apache.catalina.realm.DataSourceRealm instead of 
org.apache.catalina.realm.JDBCRealm listed in attrubute list above. Is 
it documentation error or not?
Third, and most strangest, is that there is _no_ 
org.apache.catalina.realm.DataSourceRealm class in my Tomcat 
distribution! I looked in $TOMCAT_HOME/server/catalina.jar and didn't 
find this class.

My Tomcat is 4.1.16, OS is Win2k.
I've searched marc.theaimsgroup.com and Google, and didn't find any 
message related to my question.


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



Re: DataSourceRealm does not exists?

2003-01-14 Thread Veniamin Fichin
Sorry for the stupid post, found my fault... DataSourceRealm is in 
4.1.18, shame on me...
I have another question now. Servlet 2.3 spec, subsection J2EE12.5.3.1 
Login Form Notes, says that for FORM based authentication action form 
attribute should always be j_security_check.
I think I set constraints right, because I see login page when I request 
any page in closed area. But after submitting the form my URL becomes 
/context/j_security_check, and nothing happens. Should I provide any 
servlet mapping to make it work?

--= [ cut ] =--
form action=j_security_check method=POST
 input type=text name=j_username value=br
 input type=text name=j_password value=br
 input type=submit
/form
--= [ / cut ] =--

Veniamin Fichin wrote:

Hi list!

I've faces the strange problem that I don't understand.


--= [ cut ] =--


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Why included pages fills with '????????' ?

2003-01-14 Thread Veniamin Fichin
Andrew Guts wrote:

 When I include templates using %@ include % i see a lot of '?'
 instead of text. When using jsp:include  all seems as expected.
 Why so?

Maybe you should use %@ page pageEncoding=... % ?


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Cannot load JDBC driver class 'null'

2002-12-20 Thread Veniamin Fichin
Hello list!

Chandolu, Yuva wrote:
 Hi,

 I get the error org.apache.jasper.JasperException: Cannot load JDBC
 driver class 'null'.
 What is this and how can I proceed from here? I have Tomcat 4.1.12,
 JDK1.4.1 installed and have DBCP 1.0, Pool 1.0, Collections 2.0, and
 Oracle's jdbc driver classes12.jar(classes12.zip renamed to .jar) in
 commons\lib folder. I tried removing javax.sql.* stuff from Oracle
 jdbc driver it did not work. I have also tried re-creating the
 classes12.jar from classes12.zip - no luck.
 Please some one help me.

 Thanks
 Yuva

I received this exception from time to time before, but I don't 
understand why is that. That is, one reload gives me null driver class, 
and another reload is fine. Now it's stable nd working. The only advise 
I can give you is to recheck your configuration files. Recently I posted 
my files here, and you can find them it attach. This confiugration works 
for me.


xmljsp.zip
Description: Zip compressed data
--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


Re: ClassCastException when using BasicDataSource

2002-12-20 Thread Veniamin Fichin
Tuncay Baskan wrote:

 I'm trying to use a JNDI name for a JDBC resource. Configuration is
 as follows:

 Tomcat 4.0.3
 DBCP 1.0

 In the server.xml, I have the following DefaultContext entry. (It must
 be DefaultContext because there are 3 other webapps that use the same
 database)

--= cut =--

 parameter
   nameurl/name
   valuejdbc:mysql://quantranet:3306/eproject?autoReconnet=true/value
 /parameter

May be this is not the problem you faced, but you have a typo here -- 
autoReconnet lacks last c letter.


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



DBCP test

2002-12-19 Thread Veniamin Fichin
Hello list!

May be I've made a mistake in my previous post with the same subject, 
when I asked a question after thanking people for helping me and 
providing many lines of my (now) working configuration. I guess nobody 
just saw it.
The question is: what is the way to check if DBCP is really used, and I 
get pooled connection, but not just newly created each time I request 
for it?


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



DBCP test

2002-12-18 Thread Veniamin Fichin
Hello list!

Thanks to Robert Sowders, John and Craig, I've finally set DBCP up. For 
those who still trying to do the same, here is my configuration. If 
anybody have issues about it, please respond.

--= [ server.xml snippet ]=--
 Resource name=jdbc/esljsp
   type=javax.sql.DataSource
   auth=Container
   scope=Unshareable
   description=Database resource for esljsp project /
 ResourceParams name=jdbc/esljsp
  parameter
   nameurl/name
   valuejdbc:oracle:thin:@dbhost:1521:sid/value
  /parameter
  parameter
   namedriverClassName/name
   valueoracle.jdbc.driver.OracleDriver/value
  /parameter
  parameter
   nameusername/name
   valuedbusername/value
  /parameter
  parameter
   namepassword/name
   valuedbpasswd/value
  /parameter
  parameter
   namemaxActive/name
   value20/value
   typejava.lang.Integer/type
  /parameter
  parameter
   namemaxIdle/name
   value10/value
   typejava.lang.Integer/type
  /parameter
  parameter
   namemaxWait/name
   value5000/value
   typejava.lang.Long/type
  /parameter
  parameter
   namedefaultAutoCommit/name
   valuefalse/value
   typejava.lang.Boolean/type
  /parameter
  parameter
   namedefaultReadOnly/name
   valuefalse/value
   typejava.lang.Boolean/type
  /parameter
  parameter
   namevalidationQuery/name
   valueselect count(MODULE_ID) from MODULE/value
  /parameter
  parameter
   namefactory/name
   valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
 /ResourceParams
--= [ / server.xml snippet ]=--

This is not exactly what I want, because I wanted to use Oracle's DBCP 
implementation instead of Jakarta's one. But I'll take more 
investigation on it.

--= [ / web.xml snippet ]=--
 resource-ref
  descriptionOracle database resource for esljsp project/description
  res-ref-namejdbc/esljsp/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  res-sharing-scopeUnshareable/res-sharing-scope
 /resource-ref
--= [ / web.xml snippet ]=--

--= [ index.jsp ] =--
%@ page info=Database access test|Index page
 contentType=text/html; charset=utf-8
 import=javax.naming.InitialContext, javax.naming.Context
 import=javax.sql.DataSource
 import=java.sql.Connection, java.sql.Statement
 import=java.sql.ResultSet
%
html
 head
  titleDatabase access test: index page/title
 /head
 body
%
Context initCtx=new InitialContext();
Context envCtx=(Context)initCtx.lookup(java:comp/env);
DataSource ds=(DataSource)envCtx.lookup(jdbc/esljsp);
//out.print(br+ds);
Connection con=ds.getConnection();
//out.print(br+con);
Statement stmt=con.createStatement(ResultSet.TYPE_FORWARD_ONLY,
   ResultSet.CONCUR_READ_ONLY);
//out.print(br+stmt);
ResultSet sections=stmt.executeQuery(select MODULE_ID, NAME, 
TABLE_NAME, SYSTEM_NAME from MODULE order by MODULE_ID asc);
//out.print(br+sections);
while (sections.next()) {
out.print(br+sections.getInt(1));
out.print(br+sections.getString(2));
out.print(br+sections.getString(3));
out.print(br+sections.getString(4));
out.print(brnbsp;);
}
%
 /body
/html
--= [ index.jsp ] =--

Now I have a question. How do I make sure that connections are really 
taken from pool, and not maden each time I ask for a new one? I'm sure 
there is some simple technique to check it, but I don't know where to 
look in...


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



Re: DBCP question

2002-12-06 Thread Veniamin Fichin
Roberts, Eric wrote:


Try this way instead - it works for me!


Thanks, I'll try it. I just thought that I cat use Oracle dbcp 
implementation only, without BasicDataSourceFactory Tomcat alternative.

Server.xml:
Resource description=Oracle database resource for esljsp project 
name=jdbc/esljsp-oracle 
auth=Container 
type=javax.sql.DataSource/
.
.
ResourceParams name=jdbc/esljsp-oracle
.
.
parameter
namedriverClassName/name
valueoracle.jdbc.driver.OracleDriver/value
/parameter
parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
parameter
nameurl/name
valuejdbc:oracle:thin:@db.server.ru:1521:sidvalue/value
/parameter.
.

web.xml:
.
.
  resource-ref
   descriptionOracle database resource for esljsp project/description
   res-ref-namejdbc/esljsp-oracle/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
  /resource-ref
.
.

Source:
.
.
import javax.naming.Context;
import javax.naming.InitialContext;
.
.
ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup(java:/comp/env/);
DataSource ds = (DataSource) envCtx.lookup(/esljsp-oracle);

Hope this helps!


--= [ original post cut ] =--


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: How to set Multiple instances for tomcat?

2002-12-04 Thread Veniamin Fichin
Tushar Kulkarni wrote:


Hi I want to set multiple instances for tomcat4. How do I do that?
Thanks


In the Tomcat documentation there are some explanation about it. Mainly 
you have to set CATALINA_HOME to point to your Tomcat installation, and 
 CATALINA_BASE pointing to directory where you want to store your 
particular instance.

P.S. Fix your year settings -- it's 2002 now. ;-)


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



Re: Apache Index page jsp and sessionid with JKMount *.jsp

2002-11-14 Thread Veniamin Fichin
Turner, John wrote:


That's pretty much the solution...this has come up before.  

By the time JK gets involved, Apache is just about done with the URL...it
doesn't perform any rewriting, etc. it's just looking for a match.

But in my understanding first of all when Apache is requested to process 
some directory (for example, http://www.somehost.com/test/), it tries to 
invoke any file listed in its DirectoryIndex directive, then he finds 
index.jsp and invokes it, causing to jk to wake up. So Apache is first 
in action, and jk is following it. Am I right?

The elegant solution is probably using mod_rewrite to rewrite requests
ending in / to /index.jsp.

John


-Original Message-
From: Chad Cannell [mailto:ccannell;elogex.com]
Sent: Wednesday, November 13, 2002 3:45 PM
To: Tomcat Users List
Subject: Apache Index page jsp and sessionid with JKMount *.jsp


I am trying to set Apache's index file to index.jsp. It is 
not working.
--= [ cut ] =--


Using Apache 2.0, ajp13. Tomcat 3.2x

Chad




--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




Re: mod_jk build problems

2002-11-01 Thread Veniamin Fichin
Madere, Colin wrote:


The docs at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/index.html
dont' quite seem to cover everything (you know what I mean).  I build with
the --enable-jni since it is suggested for Apache 2.0 and I get a
jk_jnicb.so but I don't get a mod_jk.so as the documentation suggests.
Is it correct behavior that a mod_jk.so NOT get built when using that
build option?  If so, would help if that was noted in docs.


I faced the same behaviour. I went to the directory 
jk/native/apache-2.0/ and found a target mod_jk.so in Makefile.
So just type make mod_jk.so and you'll get it.

But yes, it is a bug, and it should be reported.



--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org



Re: multiple servlet instances?

2002-10-24 Thread Veniamin Fichin
Craig R. McClanahan wrote:


A have to implement some functionality that related to multiple
instances. I need a servlet which accepts common http requests from
client-side applets. When a next request arrives, servlet must
register a client somehow (for example, store its name and, possibly,
access password) and not to close a connection. And, at any time (may
be seconds, minutes or even hours), it have to send every client some
portion of information based on client's needs. In other words, it's a
server-push.
So, I need to share an information between servlets so each of them
cat send it to corresponding client.

How can I do this? This task is too complicated for me, since I'm only
starting write in Java.

Thank you for every answer!



Sounds like you should *really* be using something other than HTTP for
this kind of thing, since there is no such thing as a real server push.
You might investigate using some sort of IRC environment, or packages like
Jabber http://www.jabber.org.


Yes. I only thought that I can thread my servlet so each new client 
and serve them separately.

It's possible to simulate server-push using web browsers that periodically
poll for new information, but the approach doesn't scale very well -- most
of the time your server will get hammered by requests that don't end up
changing anything, and you can't get information out any faster than the
polling interval of your clients.


It would be too simple, and it's unacceptable.
So, you think it's not possible to do such a thing using Tomcat as an 
servlet container?

No matter what underlying technology you end up with, I'd suggest doing
some research on how multiple threads work in Java.  One good starting
place for that is the Java Language Tutorial
(http://java.sun.com/docs/books/tutorial).


Thank you for your help!



--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org




Re: Security RISK !

2002-10-24 Thread Veniamin Fichin
Tim Funk wrote:


You'll want to protect your WEB-INF directory as well as any properties 
files. You can do that by using by the following in your httpd.conf: 
(This should be the syntax)

Files ~ \.properties$
Order allow,deny
Deny from all
Satisfy All
/Files

Directory ~ /WEB-INF/
Order allow,deny
Deny from all
Satisfy All
/Directory

Recently I did something else. Say, I have a webapp named mine in 
Tomcat, and have this line in httpd.conf:

Alias  /mine /var/www/tomcat/webapps/mine/web

I've made the web direcroty following recommendations described in 
section Source Organization of Tomcat docs 
(http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/source.html).
So, instead of denying any access to WEB-INF directory, I wrote:

Alias /mine/WEB-INF /something_that_does_not_exists

And, when I access http://localhost/mine/WEB-INF , I get 404 Not found 
 error instead of 403 Forbidden . I think you will be more confusive 
for the intruder if he'll be told that WEB-INF don't even exists there.
Or is this less secure to do that?



--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org



Re: multiple servlet instances?

2002-10-23 Thread Veniamin Fichin
Craig R. McClanahan wrote:

May be my question is not too close to this topic, but it may be 
related. It is below...

I was reading in a book today that JSP implementations are still
permitted to create multiple instances of the ... servlet in order to
provide improved performance. Does Tomcat/Jasper do this? Might there
be multiple instances of a servlet (JSP-generated or otherwise) in my
JVM?


You might want to be cautious believing anything that book says about any
topic, unless it correctly explains what is really going on.  What book
said this?

For anything from Servlet 2.2 on (that's quite a long while back), it is
not legal for the container to create more than one instance of a
particular servlet definition *unless* that servlet implements the
SingleThreadModel interface (or the JSP page has the
isThreadSafe=false attribute on its % page % directive).

The other thing to note is that doing this would not improve performance
-- at best, it will have zero impact, but it's actually pretty likely to
be negative (because the container is going to have to manage the multiple
instances, because the maximum number of simultaneous requests to that
servlet is now limited to the pool size you've configured, and because
they take up more memory space).

The only reason that SingleThreadModel exists is to allow you to create a
servlet or JSP page that stores per-request state information in instance
variables of the underlying class.  This is not a good programming
practice -- you should instead use local variables only, so that a single
instance of your servlet or JSP page can handle any number of simultaneous
requests.


I'm not familiar with Tomcat internal, but doesn't Tomcat instantiate 
a new servlet for each request to it?

A have to implement some functionality that related to multiple 
instances. I need a servlet which accepts common http requests from 
client-side applets. When a next request arrives, servlet must 
register a client somehow (for example, store its name and, possibly, 
access password) and not to close a connection. And, at any time (may 
be seconds, minutes or even hours), it have to send every client some 
portion of information based on client's needs. In other words, it's a 
server-push.
So, I need to share an information between servlets so each of them 
cat send it to corresponding client.

How can I do this? This task is too complicated for me, since I'm only 
starting write in Java.

Thank you for every answer!



--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org



Re: [ANNOUNCEMENT] JK2 Released as 2.0.1

2002-10-09 Thread Veniamin Fichin

Mladen Turk wrote:

 The Jakarta-Tomcat-Connector team is pleased to announce the 
 availability of JK2 2.0.1.
 
 Binaries and source versions of the release are available and can be 
 downloaded from :
 
 http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk2/release/v2.0.1/

May be a stupid question, but I'm new to Tomcat, and don't even know what a 
connector is. :-(

I can't compile jakarta-tomcat-connectors-jk2-2.0.1-src.tar.gz from 
jakarta.apache.org/builds/jakarta-tomcat-connectors/jk2/release/v2.0.1/src/ , because 
it has not some directories in this archive, as ant said.
So I additionally have downloaded 
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.12/src/jakarta-tomcat-connectors-4.1.12-src.tar.gz
 and found it more consistent.
Should I merge both distributions in order to compile it?
Is the jakarta-tomcat-connectors-4.1.12-src.tar.gz just an API declaration, and 
jakarta-tomcat-connectors-jk2-2.0.1-src.tar.gz a concrete implementation of one of the 
connection protocols? Am I right?



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




JSP source code exposure in Tomcat 4.x

2002-09-24 Thread Veniamin Fichin

Rossen Raykov wrote:

   Tomcat 4.x JSP source exposure security advisory
 
 1. Summary
 Tomcat 4.0.4 and 4.1.10 (probably all other earlier versions also) are
 vulnerable to source code exposure by using the default servlet
 org.apache.catalina.servlets.DefaultServlet.
--= [ cut ] =--
 3. Solution:
   3.1 Upgrade to the last releases 4.0.5 and 4.1.12
   See
 http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/ for the last
 releases.

I'm a newbie to Tomcat and JSP at all, so I have a question: can this upgrade be done 
by using new binaries only, not by upgrading an entire distribution including configs? 
I don't want to overwrite my configure files, because it took some time for me to 
understand its structure and meaning.



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]