Re: Desperate: Tomcat 5.5. j_security_check

2006-12-22 Thread Gregor Schneider

god, what a bloody crap, i'm about to dump this whole tomcat into the
bin and jump out of the window

now i've tried to set up a memory-realm, and i'm getting the following
error for a change:

DEBUG http-8080-Processor4 org.apache.catalina.authenticator.FormAuthenticator
- Authenticating username 'tomcat'
DEBUG http-8080-Processor4 org.apache.catalina.authenticator.FormAuthenticator
- Authenticating username 'tomcat'
ERROR http-8080-Processor4 org.apache.catalina.realm.JAASRealm - Unexpected err
or
java.lang.SecurityException: Unable to locate a login configuration
   at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:97)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct

The server.xml looks as follows:

   Engine name=Catalina defaultHost=localhost
   !--Realm className=org.apache.catalina.realm.UserDatabaseRealm
   resourceName=UserDatabase /--

   !-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users --
   Resource name=UserDatabase auth=Container
 type=org.apache.catalina.UserDatabase
 description=User database that can be updated and saved
 factory=org.apache.catalina.users.MemoryUserDatabaseFactory
 pathname=conf/tomcat-users.xml /

My $CATALINA_HOME/conf/tomcat-users.xml looks like this:

?xml version='1.0' encoding='utf-8'?
tomcat-users
 role rolename=tomcat/
 role rolename=manager/
 role rolename=admin/
 user username=tomcat password=tomcat
roles=tomcat,admin,manager,clueuser/
/tomcat-users

The WEB-INF of my application as follows:

?xml version=1.0 encoding=ISO-8859-1?
web-app version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
   security-constraint
   web-resource-collection
   web-resource-nameProtected Area/web-resource-name
   url-pattern/*/url-pattern
   /web-resource-collection
   auth-constraint
   role-nameclueuser/role-name
   /auth-constraint
   /security-constraint
   !-- test --
   login-config
   auth-methodFORM/auth-method
   realm-nameClue4Bereich/realm-name
   form-login-config

form-login-page/login_clue/loginForm.html/form-login-page
   form-error-page/login_clue/error.html/form-error-page
   /form-login-config
   /login-config
   !-- end test --
   security-role
   descriptionCLUE-Users/description
   role-nameclueuser/role-name
   /security-role

The login-form shows up, and then I'm forwarded to my error-page

Is there something wrong with the JDK-installation?

Any suggestions where I might take a look at?

Clueless

Greg

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



Form based authentaction but not for static resources

2006-12-22 Thread Peter Coppens

Tomcat fans,

I have a (I assume basic) question wrt servlet/tomcat
authentication/authorization

First let me indicate I would like my URL to always be something like 
http://host/username

I have configured a security-constraint like

security-constraint
  web-resource-collection
web-resource-namemyapp/web-resource-name
  url-pattern/*/url-pattern
  http-methodPOST/http-method
  http-methodGET/http-method
/web-resource-collection
auth-constraint
  role-nameuser/role-name
 /auth-constraint
 /security-constraint


I would however like to have some static resources accessible without any
authentication. Typically these would be identified with 
http://host/resouce/appstyle.css etc.

The reason is that I would like to have the login page use an external
stylesheet and/or some images.

Is that at all possible? Any guidelines how to achieve that?

Thanks,

Peter
-- 
View this message in context: 
http://www.nabble.com/Form-based-authentaction-but-not-for-static-resources-tf2870124.html#a8021941
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: Desperate: Tomcat 5.5. j_security_check

2006-12-22 Thread mylene

Hi Gregor,

Shouldn't you add a clueuser to your tomcat-users.xml?

Mylene

On 12/22/06, Gregor Schneider [EMAIL PROTECTED] wrote:

god, what a bloody crap, i'm about to dump this whole tomcat into the
bin and jump out of the window

now i've tried to set up a memory-realm, and i'm getting the following
error for a change:

 DEBUG http-8080-Processor4 org.apache.catalina.authenticator.FormAuthenticator
- Authenticating username 'tomcat'
 DEBUG http-8080-Processor4 org.apache.catalina.authenticator.FormAuthenticator
- Authenticating username 'tomcat'
 ERROR http-8080-Processor4 org.apache.catalina.realm.JAASRealm - Unexpected err
or
 java.lang.SecurityException: Unable to locate a login configuration
at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:97)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct

The server.xml looks as follows:

Engine name=Catalina defaultHost=localhost
!--Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=UserDatabase /--

!-- Editable user database that can also be used by
 UserDatabaseRealm to authenticate users --
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
  description=User database that can be updated and saved
  factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /

My $CATALINA_HOME/conf/tomcat-users.xml looks like this:

?xml version='1.0' encoding='utf-8'?
tomcat-users
  role rolename=tomcat/
  role rolename=manager/
  role rolename=admin/
  user username=tomcat password=tomcat
roles=tomcat,admin,manager,clueuser/
/tomcat-users

The WEB-INF of my application as follows:

?xml version=1.0 encoding=ISO-8859-1?
web-app version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
security-constraint
web-resource-collection
web-resource-nameProtected Area/web-resource-name
url-pattern/*/url-pattern
/web-resource-collection
auth-constraint
role-nameclueuser/role-name
/auth-constraint
/security-constraint
!-- test --
login-config
auth-methodFORM/auth-method
realm-nameClue4Bereich/realm-name
form-login-config

form-login-page/login_clue/loginForm.html/form-login-page
form-error-page/login_clue/error.html/form-error-page
/form-login-config
/login-config
!-- end test --
security-role
descriptionCLUE-Users/description
role-nameclueuser/role-name
/security-role

The login-form shows up, and then I'm forwarded to my error-page

Is there something wrong with the JDK-installation?

Any suggestions where I might take a look at?

Clueless

Greg

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





--
Mylene

Books just wanna be FREE! See what I mean at:
http://bookcrossing.com/friend/mylene

-
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: Form based authentaction but not for static resources

2006-12-22 Thread Mikolaj Rydzewski

Peter Coppens wrote:

security-constraint
  web-resource-collection
web-resource-namemyapp/web-resource-name
  url-pattern/*/url-pattern
  

Use pattern like *.jsp, *.do or /secure/*


--
Mikolaj Rydzewski [EMAIL PROTECTED]



smime.p7s
Description: S/MIME Cryptographic Signature


Which class i have missed?

2006-12-22 Thread Wang Penghui
Hello, Everyone,

After install tomcat 5.5.20 in RHEL4, i have tested the jsp-examples
which distributed with the tomcat package.

The uri i have used is http://domainname:8080/jsp-examples.

But there is two example features report errors.

1. jsp:attribute and jsp:body
2. Custom tag example

HTTP Status 500 -

type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
org.apache.jasper.runtime.PageContextImpl.access$1100(PageContextImpl.java:65)
org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:763)
java.security.AccessController.doPrivileged(Native Method)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:761)
org.apache.jsp.jsp2.jspattribute.jspattribute_jsp._jspService(jspattribute_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

root cause
java.lang.NoClassDefFoundError
org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:707)
org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:697)
org.apache.jsp.jsp2.jspattribute.jspattribute_jsp._jspService(jspattribute_jsp.java:51)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.20 logs.


So i think i must missing some class in the tomcat installation. Could
someone pick me up?

Thanks very much

Wang Penghui


-
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: Multi processor issue

2006-12-22 Thread Marziou, Gael

 Can you suggest a fix? I'm not sure how this kind of thing 
 could be safely veto'd... for instance, it might actually be 
 appropriate for a RequestDispatcher to be re-used in some 
 context (say, repeating a request twice) or even to do so 
 with different threads, as long as the access is done 
 strictly serially.

Do you mean submittingan enhancement request with some proposed code?

 Fantastic! I'm glad we were able to help, even if it did take a while.

Yes and I want to thank all the people from the mailing list for their
good advices and also for giving me additional motivation to investigate
further.

Gael 

-
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: Desperate: Tomcat 5.5. j_security_check

2006-12-22 Thread Mark Thomas
Gregor Schneider wrote:
 now i've tried to set up a memory-realm, and i'm getting the following
 error for a change:
 
 DEBUG http-8080-Processor4
 org.apache.catalina.authenticator.FormAuthenticator
 - Authenticating username 'tomcat'
 DEBUG http-8080-Processor4
 org.apache.catalina.authenticator.FormAuthenticator
 - Authenticating username 'tomcat'
 ERROR http-8080-Processor4 org.apache.catalina.realm.JAASRealm -

It looks like your memory realm is not correctly configured as Tomcat
is trying to use a JAASRealm.

 The server.xml looks as follows:
 
Engine name=Catalina defaultHost=localhost
!--Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=UserDatabase /--

And there is why. You need to uncomment the realm in order to use it.
Note you are using the UserDatabaseRealm, not the MemoryRealm. This
should read.
Engine name=Catalina defaultHost=localhost
Realm className=org.apache.catalina.realm.UserDatabaseRealm
   resourceName=UserDatabase /

 
!-- Editable user database that can also be used by
 UserDatabaseRealm to authenticate users --
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
  description=User database that can be updated and saved
 
 factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /

Is this within GlobalNamingResources ?

 
 My $CATALINA_HOME/conf/tomcat-users.xml looks like this:

Looks OK.

 The WEB-INF of my application as follows:

Also looks OK

 Is there something wrong with the JDK-installation?

Not that I can see from the logs you posted.

HTH,

Mark

-
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: Re-executing a servlet request

2006-12-22 Thread David Kerber

Caldarale, Charles R wrote:

From: David Smith [mailto:[EMAIL PROTECTED] 
Subject: Re: Re-executing a servlet request


2. With sessions -- the original params are stored in the
session and page 1 uses them in the absence of form params
-- ie when completing the process.
   



Have to be careful with storing data in sessions.  If the client has
multiple browser windows or tabs open to the same webapp, they will
likely be sharing the session object.

- Chuck
 

I'm willing to live with that risk; that's unlikely in this app, and 
won't cause a problem even if they do.


Dave



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



JK Connector

2006-12-22 Thread wolverineny ny

Hello,

How can I configure JK connector to redirect all requests to a particular
webapp.

http://localhost/index.html  
http://localhost:8080/myapp/index.html

I am trying not to expose the webapp name myapp in the URL. I cannot
configure myapp as a *default* app on Tomcat either. Do I need to use some
kind of URL rewriting or is there a simple elegant solution?

Please let me know if you need more details.

thanks,

Raj


Re: Re-executing a servlet request

2006-12-22 Thread David Kerber

David Smith wrote:

So you want to effectively save the parameters from the original 
request to page 1 and then use them when you come back to page 1.  I 
can see two options:


1. Sessionless -- each page propogates the original params as hidden 
fields until you return to page 1 where it makes use of them.
2. With sessions -- the original params are stored in the session and 
page 1 uses them in the absence of form params -- ie when completing 
the process.


I've been trying to do this with sessions, but can't figure out the 
details:. I can handle extracting the original params and storing them 
away no problem, but can't figure out how to build the request again and 
re-initiate it, to bring that page up again.  Can you give me an example 
or a link?  I've tried quite a bit of googling, but must not have hit 
upon the right combination of terms yet.


Dave



--David

David Kerber wrote:


Ok, I'll try:

My app is started with a .jsp.  On it the user enters a location ID.  
When they click the submit button, it sends the request to a servlet 
(call it page 1)  which brings up information from a database about 
that location, and gives them the option to make changes to the 
information for the location, stepping through 3 more pages, all from 
servlets.  After the last page is done, I want to return to the first 
servlet page (page 1) with the same request parameters as it was 
originally requested with, so that the site information is 
re-requested from the database, and they will then see the same site, 
but with the data changed to reflect what they just entered.


All of this works right now, except that I haven't figured out how to 
return to servlet page 1 with the same request parameters it had the 
first time, *as if* it had been requested from the jsp, but without 
them needing to re-enter the location ID and clicking on the submit 
button again.  How can I do that?


Thanks for any suggestions!
Dave


Hassan Schroeder wrote:


On 12/21/06, David Kerber [EMAIL PROTECTED] wrote:


Nobody has a suggestion about this?




Sure. I suggest you rephrase what you're actually trying to accomplish,
because the original made utterly no sense to me :-)

FWIW,






-
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: Multi processor issue

2006-12-22 Thread Mark Thomas
Caldarale, Charles R wrote:
 Since query information is normally unique to a request, I think the
 above could be construed that the RequestDispatcher is cognizant of the
 query string.  If so, each RequestDispatcher would be associated with a
 specific request.

I agree that the RD is cognizant of the query string but I don't see
that this prevents the RD from being re-used. The RD merges its query
string (specified on creation) with the query string of the request
passed to the include/forward method. No reason it can't do this
several times.

 SRV.15.2.8 ServletContext, getRequestDispatcher(String):
 The resource can be dynamic or static.
 
 Since dynamic resources can come and go and their existence can be
 dependent on specific requests, there is an implication that a
 RequestDispatcher is associated with the request it has been created
 for.

I see where you are coming form here but this strikes me as an
application issue.

 Send lawyers, guns, and money.  (That's not in the spec, but perhaps
 should be.)

He he. Indeed!

What does it for me is:
a) that you can obtain an RD from the context;
b) SRV.8.1 that states:
The method uses the path to look up a servlet ... wraps it with a
RequestDispatcher object, and returns the resulting object.

In my mind this aligns RDs more with servlets than requests.

I plan to look at modifying the current RD code over the holiday.

Mark

-
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: Re-executing a servlet request

2006-12-22 Thread David Smith
You won't be able to re-compose the request object as if it was just
submitted.  The quickest, dirtiest way is to just stow the form params
in the session upfront and then use them from the session later.

Example:

c:if test=${not empty param.mySubmitBtn}
  c:set var=mySessProp scope=session value=${param.myFormField} /
  c:set var=mySessProp2 scope=session value=${param.myFormField2} /
  !-- Keep going though all the form fields you want to save. --
/c:if

pYour request for ${SessProp} follows:/p
.

--David

David Kerber wrote:

 David Smith wrote:

 So you want to effectively save the parameters from the original
 request to page 1 and then use them when you come back to page 1.  I
 can see two options:

 1. Sessionless -- each page propogates the original params as hidden
 fields until you return to page 1 where it makes use of them.
 2. With sessions -- the original params are stored in the session and
 page 1 uses them in the absence of form params -- ie when completing
 the process.


 I've been trying to do this with sessions, but can't figure out the
 details:. I can handle extracting the original params and storing them
 away no problem, but can't figure out how to build the request again
 and re-initiate it, to bring that page up again.  Can you give me an
 example or a link?  I've tried quite a bit of googling, but must not
 have hit upon the right combination of terms yet.

 Dave


 --David

 David Kerber wrote:

 Ok, I'll try:

 My app is started with a .jsp.  On it the user enters a location
 ID.  When they click the submit button, it sends the request to a
 servlet (call it page 1)  which brings up information from a
 database about that location, and gives them the option to make
 changes to the information for the location, stepping through 3 more
 pages, all from servlets.  After the last page is done, I want to
 return to the first servlet page (page 1) with the same request
 parameters as it was originally requested with, so that the site
 information is re-requested from the database, and they will then
 see the same site, but with the data changed to reflect what they
 just entered.

 All of this works right now, except that I haven't figured out how
 to return to servlet page 1 with the same request parameters it had
 the first time, *as if* it had been requested from the jsp, but
 without them needing to re-enter the location ID and clicking on the
 submit button again.  How can I do that?

 Thanks for any suggestions!
 Dave


 Hassan Schroeder wrote:

 On 12/21/06, David Kerber [EMAIL PROTECTED] wrote:

 Nobody has a suggestion about this?




 Sure. I suggest you rephrase what you're actually trying to
 accomplish,
 because the original made utterly no sense to me :-)

 FWIW,





 -
 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: Re-executing a servlet request

2006-12-22 Thread David Smith
Oooops.  Minor point in code, but one that could trip someone up if they
copy paste my code:

pYour request for ${SessProp} follows:/p

should read:

pYour request for ${mySessProp} follows:/p

--David

David Smith wrote:

You won't be able to re-compose the request object as if it was just
submitted.  The quickest, dirtiest way is to just stow the form params
in the session upfront and then use them from the session later.

Example:

c:if test=${not empty param.mySubmitBtn}
  c:set var=mySessProp scope=session value=${param.myFormField} /
  c:set var=mySessProp2 scope=session value=${param.myFormField2} /
  !-- Keep going though all the form fields you want to save. --
/c:if

pYour request for ${SessProp} follows:/p
.

--David

David Kerber wrote:

  

David Smith wrote:



So you want to effectively save the parameters from the original
request to page 1 and then use them when you come back to page 1.  I
can see two options:

1. Sessionless -- each page propogates the original params as hidden
fields until you return to page 1 where it makes use of them.
2. With sessions -- the original params are stored in the session and
page 1 uses them in the absence of form params -- ie when completing
the process.
  

I've been trying to do this with sessions, but can't figure out the
details:. I can handle extracting the original params and storing them
away no problem, but can't figure out how to build the request again
and re-initiate it, to bring that page up again.  Can you give me an
example or a link?  I've tried quite a bit of googling, but must not
have hit upon the right combination of terms yet.

Dave



--David

David Kerber wrote:

  

Ok, I'll try:

My app is started with a .jsp.  On it the user enters a location
ID.  When they click the submit button, it sends the request to a
servlet (call it page 1)  which brings up information from a
database about that location, and gives them the option to make
changes to the information for the location, stepping through 3 more
pages, all from servlets.  After the last page is done, I want to
return to the first servlet page (page 1) with the same request
parameters as it was originally requested with, so that the site
information is re-requested from the database, and they will then
see the same site, but with the data changed to reflect what they
just entered.

All of this works right now, except that I haven't figured out how
to return to servlet page 1 with the same request parameters it had
the first time, *as if* it had been requested from the jsp, but
without them needing to re-enter the location ID and clicking on the
submit button again.  How can I do that?

Thanks for any suggestions!
Dave


Hassan Schroeder wrote:



On 12/21/06, David Kerber [EMAIL PROTECTED] wrote:

  

Nobody has a suggestion about this?




Sure. I suggest you rephrase what you're actually trying to
accomplish,
because the original made utterly no sense to me :-)

FWIW,
  




-
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: Which class i have missed?

2006-12-22 Thread David Smith
And how did you install tomcat (rpm package or .tar.gz dl from
tomcat.apache.org)? Did you set permissions on all the folders and files
so tomcat can read them?


--David

Wang Penghui wrote:

Hello, Everyone,

After install tomcat 5.5.20 in RHEL4, i have tested the jsp-examples
which distributed with the tomcat package.

The uri i have used is http://domainname:8080/jsp-examples.

But there is two example features report errors.

1. jsp:attribute and jsp:body
2. Custom tag example

HTTP Status 500 -

type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
org.apache.jasper.runtime.PageContextImpl.access$1100(PageContextImpl.java:65)
org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:763)
   java.security.AccessController.doPrivileged(Native Method)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:761)
org.apache.jsp.jsp2.jspattribute.jspattribute_jsp._jspService(jspattribute_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
   java.security.AccessController.doPrivileged(Native Method)
   javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
   org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

root cause
java.lang.NoClassDefFoundError
org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:707)
org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:697)
org.apache.jsp.jsp2.jspattribute.jspattribute_jsp._jspService(jspattribute_jsp.java:51)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.20 logs.


So i think i must missing some class in the tomcat installation. Could
someone pick me up?

Thanks very much

Wang Penghui


-
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: Re-executing a servlet request

2006-12-22 Thread David Kerber

David Smith wrote:


You won't be able to re-compose the request object as if it was just
submitted.  The quickest, dirtiest way is to just stow the form params
in the session upfront and then use them from the session later.
 

Are you saying that I can't build a request and execute it directly, and 
therefore will need to check for the stored parameters on the page that 
I'm re-opening?




Example:

c:if test=${not empty param.mySubmitBtn}
 c:set var=mySessProp scope=session value=${param.myFormField} /
 c:set var=mySessProp2 scope=session value=${param.myFormField2} /
 !-- Keep going though all the form fields you want to save. --
/c:if

pYour request for ${SessProp} follows:/p
.

--David

David Kerber wrote:

 


David Smith wrote:

   


So you want to effectively save the parameters from the original
request to page 1 and then use them when you come back to page 1.  I
can see two options:

1. Sessionless -- each page propogates the original params as hidden
fields until you return to page 1 where it makes use of them.
2. With sessions -- the original params are stored in the session and
page 1 uses them in the absence of form params -- ie when completing
the process.
 


I've been trying to do this with sessions, but can't figure out the
details:. I can handle extracting the original params and storing them
away no problem, but can't figure out how to build the request again
and re-initiate it, to bring that page up again.  Can you give me an
example or a link?  I've tried quite a bit of googling, but must not
have hit upon the right combination of terms yet.

Dave

   


--David

David Kerber wrote:

 


Ok, I'll try:

My app is started with a .jsp.  On it the user enters a location
ID.  When they click the submit button, it sends the request to a
servlet (call it page 1)  which brings up information from a
database about that location, and gives them the option to make
changes to the information for the location, stepping through 3 more
pages, all from servlets.  After the last page is done, I want to
return to the first servlet page (page 1) with the same request
parameters as it was originally requested with, so that the site
information is re-requested from the database, and they will then
see the same site, but with the data changed to reflect what they
just entered.

All of this works right now, except that I haven't figured out how
to return to servlet page 1 with the same request parameters it had
the first time, *as if* it had been requested from the jsp, but
without them needing to re-enter the location ID and clicking on the
submit button again.  How can I do that?

Thanks for any suggestions!
Dave


Hassan Schroeder wrote:

   


On 12/21/06, David Kerber [EMAIL PROTECTED] wrote:

 


Nobody has a suggestion about this?
   




Sure. I suggest you rephrase what you're actually trying to
accomplish,
because the original made utterly no sense to me :-)

FWIW,
 





-
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: Re-executing a servlet request

2006-12-22 Thread David Smith
Yes.  I'm saying the original request won't be available.  One other
alternative I can think of is for the last page submit to add all the
saved params to the request for page 1.  Last page example form tag:
form action=page1.jsp?frmParam1=valuefrmParam2=value

--David

David Kerber wrote:

 David Smith wrote:

 You won't be able to re-compose the request object as if it was just
 submitted.  The quickest, dirtiest way is to just stow the form params
 in the session upfront and then use them from the session later.
  

 Are you saying that I can't build a request and execute it directly,
 and therefore will need to check for the stored parameters on the page
 that I'm re-opening?


 Example:

 c:if test=${not empty param.mySubmitBtn}
  c:set var=mySessProp scope=session value=${param.myFormField} /
  c:set var=mySessProp2 scope=session
 value=${param.myFormField2} /
  !-- Keep going though all the form fields you want to save. --
 /c:if

 pYour request for ${SessProp} follows:/p
 .

 --David

 David Kerber wrote:

  

 David Smith wrote:

   

 So you want to effectively save the parameters from the original
 request to page 1 and then use them when you come back to page 1.  I
 can see two options:

 1. Sessionless -- each page propogates the original params as hidden
 fields until you return to page 1 where it makes use of them.
 2. With sessions -- the original params are stored in the session and
 page 1 uses them in the absence of form params -- ie when completing
 the process.
 

 I've been trying to do this with sessions, but can't figure out the
 details:. I can handle extracting the original params and storing them
 away no problem, but can't figure out how to build the request again
 and re-initiate it, to bring that page up again.  Can you give me an
 example or a link?  I've tried quite a bit of googling, but must not
 have hit upon the right combination of terms yet.

 Dave

   

 --David

 David Kerber wrote:

 

 Ok, I'll try:

 My app is started with a .jsp.  On it the user enters a location
 ID.  When they click the submit button, it sends the request to a
 servlet (call it page 1)  which brings up information from a
 database about that location, and gives them the option to make
 changes to the information for the location, stepping through 3 more
 pages, all from servlets.  After the last page is done, I want to
 return to the first servlet page (page 1) with the same request
 parameters as it was originally requested with, so that the site
 information is re-requested from the database, and they will then
 see the same site, but with the data changed to reflect what they
 just entered.

 All of this works right now, except that I haven't figured out how
 to return to servlet page 1 with the same request parameters it had
 the first time, *as if* it had been requested from the jsp, but
 without them needing to re-enter the location ID and clicking on the
 submit button again.  How can I do that?

 Thanks for any suggestions!
 Dave


 Hassan Schroeder wrote:

   

 On 12/21/06, David Kerber [EMAIL PROTECTED] wrote:

 

 Nobody has a suggestion about this?
   



 Sure. I suggest you rephrase what you're actually trying to
 accomplish,
 because the original made utterly no sense to me :-)

 FWIW,
 




 -
 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: Which class i have missed?

2006-12-22 Thread Wang Penghui
David Smith 写道:
 And how did you install tomcat (rpm package or .tar.gz dl from
 tomcat.apache.org)? Did you set permissions on all the folders and files
 so tomcat can read them?
 
 
 --David
 

Thanks very much for your quick response.

I have download the package from the offical website of tomcat -
http://tomcat.apache.org

And all the permissions are the default permissions.

644 root root

I have never changed it. But i enable the security manager during the
tomcat server startup.

Thanks again.

Wang Penghui

 Wang Penghui wrote:
 
 Hello, Everyone,

 After install tomcat 5.5.20 in RHEL4, i have tested the jsp-examples
 which distributed with the tomcat package.

 The uri i have used is http://domainname:8080/jsp-examples.

 But there is two example features report errors.

 1. jsp:attribute and jsp:body
 2. Custom tag example

 HTTP Status 500 -
 
 type Exception report
 message
 description The server encountered an internal error () that prevented
 it from fulfilling this request.
 exception
 javax.servlet.ServletException
 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
 org.apache.jasper.runtime.PageContextImpl.access$1100(PageContextImpl.java:65)
 org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:763)
  java.security.AccessController.doPrivileged(Native Method)
 org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:761)
 org.apache.jsp.jsp2.jspattribute.jspattribute_jsp._jspService(jspattribute_jsp.java:70)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:585)
 org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
  java.security.AccessController.doPrivileged(Native Method)
  javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
  org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
 org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

 root cause
 java.lang.NoClassDefFoundError
 org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:707)
 org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:697)
 org.apache.jsp.jsp2.jspattribute.jspattribute_jsp._jspService(jspattribute_jsp.java:51)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:585)
 org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
 java.security.AccessController.doPrivileged(Native Method)
 javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
 org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
 org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

 note The full stack trace of the root cause is available in the Apache
 Tomcat/5.5.20 logs.


 So i think i must missing some class in the tomcat installation. Could
 someone pick me up?

 Thanks very much

 Wang Penghui


 -
 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: Which class i have missed?

2006-12-22 Thread Wang Penghui
David Smith 写道:
 And how did you install tomcat (rpm package or .tar.gz dl from
 tomcat.apache.org)? Did you set permissions on all the folders and files
 so tomcat can read them?
 
 
 --David

Hello again,

I have disabled the security manager, then it works now. So i think it
should be some permission missing in the catalina.policy. I am trying to
 find it know, if you know that, please let me know.

Thanks

Wang.

 
 Wang Penghui wrote:
 
 Hello, Everyone,

 After install tomcat 5.5.20 in RHEL4, i have tested the jsp-examples
 which distributed with the tomcat package.

 The uri i have used is http://domainname:8080/jsp-examples.

 But there is two example features report errors.

 1. jsp:attribute and jsp:body
 2. Custom tag example

 HTTP Status 500 -
 
 type Exception report
 message
 description The server encountered an internal error () that prevented
 it from fulfilling this request.
 exception
 javax.servlet.ServletException
 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
 org.apache.jasper.runtime.PageContextImpl.access$1100(PageContextImpl.java:65)
 org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:763)
  java.security.AccessController.doPrivileged(Native Method)
 org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:761)
 org.apache.jsp.jsp2.jspattribute.jspattribute_jsp._jspService(jspattribute_jsp.java:70)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:585)
 org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
  java.security.AccessController.doPrivileged(Native Method)
  javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
  org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
 org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

 root cause
 java.lang.NoClassDefFoundError
 org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:707)
 org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:697)
 org.apache.jsp.jsp2.jspattribute.jspattribute_jsp._jspService(jspattribute_jsp.java:51)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:585)
 org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
 java.security.AccessController.doPrivileged(Native Method)
 javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
 org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
 org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

 note The full stack trace of the root cause is available in the Apache
 Tomcat/5.5.20 logs.


 So i think i must missing some class in the tomcat installation. Could
 someone pick me up?

 Thanks very much

 Wang Penghui


 -
 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: Form based authentaction but not for static resources

2006-12-22 Thread Peter Coppens

I understand that that is the way a typical servlet deployment would work
yes. On the other hand, it would not meet the url requirements that are
imposed on me.

Thanks,

Peter


Mikolaj Rydzewski-2 wrote:
 
 Peter Coppens wrote:
 security-constraint
   web-resource-collection
 web-resource-namemyapp/web-resource-name
   url-pattern/*/url-pattern
   
 Use pattern like *.jsp, *.do or /secure/*
 
 
 -- 
 Mikolaj Rydzewski [EMAIL PROTECTED]
 
 
  
 

-- 
View this message in context: 
http://www.nabble.com/Form-based-authentaction-but-not-for-static-resources-tf2870124.html#a8023769
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: Form based authentaction but not for static resources

2006-12-22 Thread Mikolaj Rydzewski

Peter Coppens wrote:

I understand that that is the way a typical servlet deployment would work
yes. On the other hand, it would not meet the url requirements that are
imposed on me.
  

So you can try http://securityfilter.sourceforge.net/

--
Mikolaj Rydzewski [EMAIL PROTECTED]



smime.p7s
Description: S/MIME Cryptographic Signature


urget solution with : tomcat-eclipse problem

2006-12-22 Thread Monika Monika

hi guys,
 I am working in eclipse environment with eclipse and tried to set up 
tomcat in debug mode using debug tool for one project, but it changed 
configuration of every project in eclipse. Now my problem is other 
projects were in virtual machine which has changed the configuration all 
together. now i want to remove debug settings. I removed the debug 
confguation mannually but how would be able to get my previous 
settings.  I searched for eclipse website also but didn't get anything 
helpful.

Thanks for any help

monika


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Multi processor issue

2006-12-22 Thread Christopher Schultz
Gael,

Marziou, Gael wrote:
 Can you suggest a fix? I'm not sure how this kind of thing 
 could be safely veto'd... for instance, it might actually be 
 appropriate for a RequestDispatcher to be re-used in some 
 context (say, repeating a request twice) or even to do so 
 with different threads, as long as the access is done 
 strictly serially.
 
 Do you mean submitting an enhancement request with some proposed code?

Well, I'm sure the the developers would appreciate that, but meant just
a suggestion of how it might be done -- just in words, not necessarily
any code.

Often, problems like this only affect a small number of people, and
fixing them would break other people's code -- there's always someone
who found a way to use it in an unexpected way.

-chris



signature.asc
Description: OpenPGP digital signature


SOLVED - Re: Desperate: Tomcat 5.5. j_security_check

2006-12-22 Thread Gregor Schneider

Hi guys,

first of all: Thanks to all of you for your help!

We got it (JDBC-REALM) working now, however, it was a long way.

The resolution in short words:

We installed a vanilla JDK 1.5 from SUN plus a vanilla Tomcat 5.5 from
Apache, same error occured, empty string in the query for j_username
in the MySQL-logs

I decided that it had either to be the jdbc-driver (Connector/J) or
the database since the logs showed me that j_username was read
properly from j_security_check.

Then I decided to dump MySQL 4.1.11 (we installed it from the
MySQL-distri) and we re-installed MySQL 5.0.30 and currently are using
connector/J 3.

Aand: Voilà! It's working now.

Therefore, if any of you guys is planning to run Tomcat 5.5 with
Debian Edge and you want to use the facility of j_security_check, keep
to Debian's scource-tree and install MySQL 5.0.30 via aptitude, it
will save you a lot of work.

Merry XMas to all of you!

Greg
--
what's puzzlin' you, is the nature of my game
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

-
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: Form based authentaction but not for static resources

2006-12-22 Thread Peter Coppens

Thanks, I will, Peter.


Mikolaj Rydzewski-2 wrote:
 
 Peter Coppens wrote:
 I understand that that is the way a typical servlet deployment would work
 yes. On the other hand, it would not meet the url requirements that are
 imposed on me.
   
 So you can try http://securityfilter.sourceforge.net/
 
 -- 
 Mikolaj Rydzewski [EMAIL PROTECTED]
 
 
  
 

-- 
View this message in context: 
http://www.nabble.com/Form-based-authentaction-but-not-for-static-resources-tf2870124.html#a8025548
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: Re-executing a servlet request

2006-12-22 Thread David Kerber

Got this going; thanks for the help!


David Smith wrote:


Yes.  I'm saying the original request won't be available.  One other
alternative I can think of is for the last page submit to add all the
saved params to the request for page 1.  Last page example form tag:
form action=page1.jsp?frmParam1=valuefrmParam2=value

--David

David Kerber wrote:

 


David Smith wrote:

   


You won't be able to re-compose the request object as if it was just
submitted.  The quickest, dirtiest way is to just stow the form params
in the session upfront and then use them from the session later.


 


Are you saying that I can't build a request and execute it directly,
and therefore will need to check for the stored parameters on the page
that I'm re-opening?


   


Example:

c:if test=${not empty param.mySubmitBtn}
c:set var=mySessProp scope=session value=${param.myFormField} /
c:set var=mySessProp2 scope=session
value=${param.myFormField2} /
!-- Keep going though all the form fields you want to save. --
/c:if

pYour request for ${SessProp} follows:/p
.

--David

David Kerber wrote:



 


David Smith wrote:

 

   


So you want to effectively save the parameters from the original
request to page 1 and then use them when you come back to page 1.  I
can see two options:

1. Sessionless -- each page propogates the original params as hidden
fields until you return to page 1 where it makes use of them.
2. With sessions -- the original params are stored in the session and
page 1 uses them in the absence of form params -- ie when completing
the process.
   
 


I've been trying to do this with sessions, but can't figure out the
details:. I can handle extracting the original params and storing them
away no problem, but can't figure out how to build the request again
and re-initiate it, to bring that page up again.  Can you give me an
example or a link?  I've tried quite a bit of googling, but must not
have hit upon the right combination of terms yet.

Dave

 

   


--David

David Kerber wrote:

   

 


Ok, I'll try:

My app is started with a .jsp.  On it the user enters a location
ID.  When they click the submit button, it sends the request to a
servlet (call it page 1)  which brings up information from a
database about that location, and gives them the option to make
changes to the information for the location, stepping through 3 more
pages, all from servlets.  After the last page is done, I want to
return to the first servlet page (page 1) with the same request
parameters as it was originally requested with, so that the site
information is re-requested from the database, and they will then
see the same site, but with the data changed to reflect what they
just entered.

All of this works right now, except that I haven't figured out how
to return to servlet page 1 with the same request parameters it had
the first time, *as if* it had been requested from the jsp, but
without them needing to re-enter the location ID and clicking on the
submit button again.  How can I do that?

Thanks for any suggestions!
Dave


Hassan Schroeder wrote:

 

   


On 12/21/06, David Kerber [EMAIL PROTECTED] wrote:

   

 


Nobody has a suggestion about this?
 
   



Sure. I suggest you rephrase what you're actually trying to
accomplish,
because the original made utterly no sense to me :-)

FWIW,
 





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



dedicated servlet connections

2006-12-22 Thread Alec Swan

Hi all,

sorry for reposting. I posted the original message before I completed
registration, so I am not sure if got through.

I have two servlets: Worker and Status. Worker servlet gets hit very
frequently and consumes all available Tomcat threads (configured via
maxThreads). Thus, whenever I try to access the Status thread I have to wait
a long time. Is there a way to either dedicate some threads to Status
servlet or set Status servlet priority higher than Worker servlet so that I
can access it faster? Note that both servlets need to work in the same
Tomcat instance.

Thanks.

Alec


Question about http connections

2006-12-22 Thread Vinicius Carvalho

Hello there! We have a Jboss 4.0.1 server, and we're experiencing a
strange connector behavior (might be our app as well). We check the
connections on the connector 8009 (we use a mod_jk behind jboss). And
we have some requests on Service status that have over 14.000 seconds.
We even killed the remote user browser (its an internal user from our
corporation) but the connection is still used, it takes a few minutes
to it to die. We have this behavior in many other requests in
different parts of the system, and many with over 100s of time. What
could be causing this? Any thoughts?

Best regards and great holidays

--
IBM Certified SOA Solution Designer
IBM Database Associate - DB2 UDB V8.1 Family
Sun Certified Enterprise Architect (Part I)

-
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: Question about http connections

2006-12-22 Thread Dima Retov
Is it connection between apache and tomcat?
May be it is in keepalive connection to reuse existent connections?

-- 
Best regards,
 Dimamailto:[EMAIL PROTECTED]

Friday, December 22, 2006, 7:29:54 PM, you wrote:

VC Hello there! We have a Jboss 4.0.1 server, and we're experiencing a
VC strange connector behavior (might be our app as well). We check the
VC connections on the connector 8009 (we use a mod_jk behind jboss). And
VC we have some requests on Service status that have over 14.000 seconds.
VC We even killed the remote user browser (its an internal user from our
VC corporation) but the connection is still used, it takes a few minutes
VC to it to die. We have this behavior in many other requests in
VC different parts of the system, and many with over 100s of time. What
VC could be causing this? Any thoughts?

VC Best regards and great holidays






-
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: dedicated servlet connections

2006-12-22 Thread Rainer Jung
You can configure two connectors with associated pools. If you need to
talk to both parts of the app under the same name and port, you can
front those two connectors (ports) with apache/mod_jk. With a sufficient
recent version of mod_jk you can configure several workers to forward to
different connectors on the same tomcat (you'll only need a recent
version, if you want to combine this with load balancing. Earlier
versions required the workers name to be equal to the jvmRoute of
tomcat, so you could only use one worker per tomcat target. Now we have
a route attribute).

JkMount /myapp/perf/* perf_worker
JkMount /myapp/status stat_worker

and in workers.properties:

worker.list=perf_worker
worker.perf_worker.port=8009
...

worker.list=stat_worker
worker.stat_worker.port=8010

and in server.xml use two Connectors with ports 8009 and 8010 with
different thread counts.

This will not use priorities though. Also: you could get the same thread
exhaustion problem on the apache layer.

Regards,

Rainer

Alec Swan schrieb:
 Hi all,
 
 sorry for reposting. I posted the original message before I completed
 registration, so I am not sure if got through.
 
 I have two servlets: Worker and Status. Worker servlet gets hit very
 frequently and consumes all available Tomcat threads (configured via
 maxThreads). Thus, whenever I try to access the Status thread I have to
 wait
 a long time. Is there a way to either dedicate some threads to Status
 servlet or set Status servlet priority higher than Worker servlet so that I
 can access it faster? Note that both servlets need to work in the same
 Tomcat instance.
 
 Thanks.
 
 Alec
 

-
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: dedicated servlet connections

2006-12-22 Thread Alec Swan

Rainer,

we are not using Apache web server. Instead, HTTP requests get sent directly
to the servlets in Tomcat. We do, however use the (hardware) load balancer.

Is there a way to just configure Tomcat to allow some servlets have higher
priorities than others or dedicate a pool of connections to them?

Thanks.

Alec

On 12/22/06, Rainer Jung [EMAIL PROTECTED] wrote:


You can configure two connectors with associated pools. If you need to
talk to both parts of the app under the same name and port, you can
front those two connectors (ports) with apache/mod_jk. With a sufficient
recent version of mod_jk you can configure several workers to forward to
different connectors on the same tomcat (you'll only need a recent
version, if you want to combine this with load balancing. Earlier
versions required the workers name to be equal to the jvmRoute of
tomcat, so you could only use one worker per tomcat target. Now we have
a route attribute).

JkMount /myapp/perf/* perf_worker
JkMount /myapp/status stat_worker

and in workers.properties:

worker.list=perf_worker
worker.perf_worker.port=8009
...

worker.list=stat_worker
worker.stat_worker.port=8010

and in server.xml use two Connectors with ports 8009 and 8010 with
different thread counts.

This will not use priorities though. Also: you could get the same thread
exhaustion problem on the apache layer.

Regards,

Rainer

Alec Swan schrieb:
 Hi all,

 sorry for reposting. I posted the original message before I completed
 registration, so I am not sure if got through.

 I have two servlets: Worker and Status. Worker servlet gets hit very
 frequently and consumes all available Tomcat threads (configured via
 maxThreads). Thus, whenever I try to access the Status thread I have to
 wait
 a long time. Is there a way to either dedicate some threads to Status
 servlet or set Status servlet priority higher than Worker servlet so
that I
 can access it faster? Note that both servlets need to work in the same
 Tomcat instance.

 Thanks.

 Alec


-
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: Helping setting appropriate prefix when using ServletContext.getResourceAsStream()

2006-12-22 Thread James Dekker

Dear Chuck Caldarale  Others,

Thank you for your response!

Chuck - Your e-mail was very informative... I did remove the
servlet-apis from my %CATALINA_HOME%/mywebapp/%WEB-INF/lib directory.
The only reason I had it there was because I use Eclipse for
development and its easier to configure the build path by clicking on
Add Jar rather than clicking on Add External Jar. But I took  your
advice and removed it and now use Add External Jar.

Here's my situation...

I changed my Ant build script to move the log4j.properties file into
my WEB-INF/classes dir. Also, my log4j-1.2.9.jar gets moved inside my
WEB-INF/lib dir. But for some odd reason, when I run Tomcat, it
doesn't seem to know where my log4j.properties file is! My
Log4jInitServlet seems to have the path wrong!

It looks inside:

C:\DevTools\tomcat\jakarta-tomcat-5.5.9\bin\WEB-INF\classes\log4j.properties

instead of:

C:\DevTools\tomcat\jakarta-tomcat-5.5.9\mywebapp\WEB-INF\classes\log4j.properties.

Furthermore, it throws a NullPointerException but at the same time,
right afterwards, it logs my XmlConfigInitServlet (I have it set
there!).

Here's what my console says:



Dec 22, 2006 9:45:05 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive mywebapp.war
propFile path is: WEB-INF\classes\log4j.properties
log4j.properties not found,
C:\DevTools\tomcat\jakarta-tomcat-5.5.9\bin\WEB-INF\classes\log4j.properties
2006-12-22 09:45:07,653 ERROR
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mywebapp]]
- StandardWrapper.Throwable
java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:365)
at java.util.Properties.load(Properties.java:293)
at 
com.acme.mywebapp.logging.Log4jInitServlet.init(Log4jInitServlet.java:27)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3857)
at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4118)
at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:788)
at 
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:677)
at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at 
org.apache.catalina.core.StandardService.start(StandardService.java:450)
at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
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:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
2006-12-22 09:45:07,669 ERROR
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mywebapp]]
- Servlet /mywebapp threw load() exception
java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:365)
at java.util.Properties.load(Properties.java:293)
at 
com.acme.mywebapp.logging.Log4jInitServlet.init(Log4jInitServlet.java:27)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3857)
at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4118)
at 

Re: Helping setting appropriate prefix when using ServletContext.getResourceAsStream()

2006-12-22 Thread Hassan Schroeder

On 12/22/06, James Dekker [EMAIL PROTECTED] wrote:


From the three lines below:
... %CATALINA_HOME%/mywebapp/%WEB-INF/lib



C:\DevTools\tomcat\jakarta-tomcat-5.5.9\bin\WEB-INF\classes\log4j.properties
C:\DevTools\tomcat\jakarta-tomcat-5.5.9\mywebapp\WEB-INF\classes\log4j.properties.


:: I'd bet your basic configuration is wrong. What are your Host appBase
and Context docBase, and where are they being set?

--
Hassan Schroeder  [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: Helping setting appropriate prefix when using ServletContext.getResourceAsStream()

2006-12-22 Thread James Dekker

Hassan:

Thank you for your repsonse...

Here's what I have in my TOMCAT_HOME/conf/server.xml file:



Server port=8005 shutdown=SHUTDOWN
 !-- Comment these entries out to disable JMX MBeans support used for the
  administration web application --
 Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
 Listener 
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener
/
 Listener 
className=org.apache.catalina.storeconfig.StoreConfigLifecycleListener/
 !-- Global JNDI resources --
 GlobalNamingResources
   !-- Test entry for demonstration purposes --
   Environment name=simpleValue type=java.lang.Integer value=30/
   !-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users --
   Resource name=UserDatabase auth=Container
 type=org.apache.catalina.UserDatabase
  description=User database that can be updated and saved
  factory=org.apache.catalina.users.MemoryUserDatabaseFactory
 pathname=conf/tomcat-users.xml /
 /GlobalNamingResources
 !-- Define the Tomcat Stand-Alone Service --
 Service name=Catalina
   !-- Define a non-SSL HTTP/1.1 Connector on port 8080 --
   Connector port=8080 maxHttpHeaderSize=8192
  maxThreads=150 minSpareThreads=25 maxSpareThreads=75
  enableLookups=false redirectPort=8443 acceptCount=100
  connectionTimeout=2 disableUploadTimeout=true /
   !-- Define an AJP 1.3 Connector on port 8009 --
   Connector port=8009
  enableLookups=false redirectPort=8443 protocol=AJP/1.3 /
   Engine name=Catalina defaultHost=localhost
 Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=UserDatabase/
 Host name=localhost appBase=webapps
  unpackWARs=true autoDeploy=true
  xmlValidation=false xmlNamespaceAware=false
 /Host
   /Engine
 /Service
/Server



In TOMCAT_HOME/conf/tomcat-users.xml file:



?xml version='1.0' encoding='utf-8'?
tomcat-users
 role rolename=tomcat/
 role rolename=role1/
 role rolename=manager/
 user username=tomcat password=tomcat roles=tomcat,manager/
 user username=both password=tomcat roles=tomcat,role1/
 user username=role1 password=tomcat roles=role1/
 user username=admin password=admin roles=manager/
/tomcat-users



I created 3 files so that I could undeploy my app while tomcat was running:

admin.properties:



# Properties for Tomcat Server Us
tomcat.server=localhost
tomcat.manager.url=http://${tomcat.server}:8080/manager
tomcat.username=admin
tomcat.password=admin



build.properties:



project.name=mywebapp
build.dir=./build

# Web app properties for the project
webapp.name=mywebapp

webapp.build.dir=${build.dir}/${webapp.name}

webapp.virtual.host=localhost

webapp.meta.dir=${webapp.build.dir}/META-INF



# Tomcat properties



tomcat.home=C:/DevTools/tomcat/jakarta-tomcat-5.5.9
tomcat.deployment.dir=${tomcat.home}/webapps

tomcatTask.properties:

# Tomcat Task Properties
deploy=org.apache.catalina.ant.DeployTask
install=org.apache.catalina.ant.InstallTask
list=org.apache.catalina.ant.ListTask
reload=org.apache.catalina.ant.ReloadTask
remove=org.apache.catalina.ant.RemoveTask
resources=org.apache.catalina.ant.ResourcesTask
roles=org.apache.catalina.ant.RolesTask
start=org.apache.catalina.ant.StartTask
stop=org.apache.catalina.ant.StopTask
undeploy=org.apache.catalina.ant.UndeployTask



Finally, my build.xml file:



?xml version=1.0?
project name=mywebapp default=deploy basedir=.

   property file=build.properties/
property file=admin.properties/

taskdef file=tomcatTasks.properties
classpath
pathelement 
path=${tomcat.home}/server/lib/catalina-ant.jar/
/classpath
/taskdef

target name=prepare
mkdir dir=${webapp.build.dir} /

Re: Helping setting appropriate prefix when using ServletContext.getResourceAsStream()

2006-12-22 Thread Hassan Schroeder

On 12/22/06, James Dekker [EMAIL PROTECTED] wrote:


  Host name=localhost appBase=webapps
   unpackWARs=true autoDeploy=true
   xmlValidation=false xmlNamespaceAware=false
  /Host



tomcat.home=C:/DevTools/tomcat/jakarta-tomcat-5.5.9
tomcat.deployment.dir=${tomcat.home}/webapps


Most of that was irrelevant :-) but the above doesn't mesh with your
earlier path:
C:\DevTools\tomcat\jakarta-tomcat-5.5.9\mywebapp\WEB-INF\classes\log4j.properties.
:: which doesn't include a 'webapps' directory.

Is that just a typo or are you setting Context atttributes (like docBase)
somewhere else?

--
Hassan Schroeder  [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]



System path being ignored when using Tomcat Windows service?

2006-12-22 Thread Jon Miller

Hi all,

I have a web application that uses Runtime.exec() to start a process. The 
process that I'm starting is in the system path. The application works fine 
if I'm running the Tomcat platform independent package. However, if I use 
the Tomcat Windows service, it appears that the process can't be created 
because it can't be found. It works if I specify the fully qualified path 
the the executable, but, I want to use only a relative path. I'm wondering 
if the fact that it appears to be ignoring the system path has to do with 
the fact that it's a Windows service, or, if it's an issue with Tomcat?


I'm running Tomcat 5.5.20 with Sun JDK 1.5.0_10 and Windows XP SP2. Also, I 
noticed that if I change the user account that the Tomcat service is 
supposed to run as using the system tray applet, it doesn't change the 
settings, it just keep reverting back to LocalSystem.


Has anyone else ran into either of these issues. As far as I can tell, the 
second issue looks like a bug.


Also, I tried setting java.library.path using the applet, but, that didn't 
seem to help.


Jon


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



How to load XML config file properly from WEB-INF?

2006-12-22 Thread James Dekker

Hi,

If you've been following my previous posts, you'll notice that I had a
problem of trying to load a properties file (stored under WEB-INF),
until I edited my build script and made it place the log4j.properties
file under WEB-INF/classes, and then used the following code to load
in the properties file:

public class Log4jInitServlet extends HttpServlet {
  public void init() throws ServletException  {
   Properties  props  = new Properties();
   try {
 
props.load(this.getClass().getClassLoader().getResourceAsStream(/log4j.properties));
} catch (IOException e) {
e.printStackTrace();
}
   }

Although, this works for loading property files into my webapp's
CLASSPATH, my new question (just for those who think that I am trying
to post the same question twice, which I am not), is this:

I also have a servlet which uses init params to load  parse XML
config files (which are located under: %TOMCAT_HOME%/mywebapp/WEB-INF/
)

My new question is:

How do I use the getResourceAsStream() method to load this particular
XML file which is not located under WEB-INF/classes? Its located under
just WEB-INF.

Also is there a way to convert this InputStream into a File?

Here's my original piece of code (which works when
undeployWars=true, I am trying to get it to work when
undeployWars=false):

   public class XmlConfigInitServlet extends HttpServlet {

public void init() throws ServletException {
// String prefix = getServletContext().getRealPath(/);
String file = getInitParameter(xml-config-file);
File xmlConfigFile = new File(prefix + file);
if (!xmlConfigFile.exists()) {
System.out.println(attributes-config.xml not found, 
+ xmlConfigFile.getAbsolutePath());
}

try {
// Configure Digester from XML ruleset
AttributeBeanXmlConfigHelper.parse(xmlConfigFile);

Logger.getLogger(this.getClass()).warn(Finished 
parsing the
config file.);
is.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
   }

What I thought I could do was something like this inside the try / catch:

InputStream is =
getServletContext().getResourceAsStream(WEB-INF/attributes-config.xml);

// Configure Digester from XML ruleset
AttributeBeanXmlConfigHelper.parse(xmlConfigFile);  

Now, the problem is... I think that there will be definitely be a
pathing issue for WEB-INF/attributes-config.xml when using
getResourceAsStream() (I am guessing because of my attempts with the
Log4jInitServlet postings). Also, how would one convert an InputStream
to a File?

e.g

How to convert is and xmlConfigFile?

Cheers,

JD

-
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: System path being ignored when using Tomcat Windows service?

2006-12-22 Thread Jon Miller
I think it must have been a permissions problem. I switched to using a 
different account and now it works. The systray applet doesn't work. I had 
to change it using the normal Services application that's built into 
Windows.


Jon

- Original Message - 
From: Jon Miller [EMAIL PROTECTED]

To: Tomcat User List tomcat-user@jakarta.apache.org
Sent: Friday, December 22, 2006 2:56 PM
Subject: System path being ignored when using Tomcat Windows service?



Hi all,

I have a web application that uses Runtime.exec() to start a process. The 
process that I'm starting is in the system path. The application works 
fine if I'm running the Tomcat platform independent package. However, if I 
use the Tomcat Windows service, it appears that the process can't be 
created because it can't be found. It works if I specify the fully 
qualified path the the executable, but, I want to use only a relative 
path. I'm wondering if the fact that it appears to be ignoring the system 
path has to do with the fact that it's a Windows service, or, if it's an 
issue with Tomcat?


I'm running Tomcat 5.5.20 with Sun JDK 1.5.0_10 and Windows XP SP2. Also, 
I noticed that if I change the user account that the Tomcat service is 
supposed to run as using the system tray applet, it doesn't change the 
settings, it just keep reverting back to LocalSystem.


Has anyone else ran into either of these issues. As far as I can tell, the 
second issue looks like a bug.


Also, I tried setting java.library.path using the applet, but, that didn't 
seem to help.


Jon


-
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]



some know what happend whit the documentation of connectors

2006-12-22 Thread alvaro tovar

i can't see de documentation of sun one server connector, what happend, when
will be back.
thanks


Re: How to load XML config file properly from WEB-INF?

2006-12-22 Thread Christopher Schultz
James,

James Dekker wrote:
 How do I use the getResourceAsStream() method to load this particular
 XML file which is not located under WEB-INF/classes? Its located under
 just WEB-INF.

You'll want to use the method ServletContext.getResourceAsStream(). From
the javadoc:


This method is different from java.lang.Class.getResourceAsStream, which
uses a class loader. This method allows servlet containers to make a
resource available to a servlet from any location, without using a class
loader.


The CWD should be your webapp's directory (in your case,
%TOMCAT_HOME/mywebapp%). You'll want to use the path /WEB-INF/my.xml.

 Also is there a way to convert this InputStream into a File?

No. If you want more than just the bytes from the file, you'll need to
use ServletContext.getResource(), which returns a URL.

 Here's my original piece of code (which works when
 undeployWars=true, I am trying to get it to work when
 undeployWars=false):
 
public class XmlConfigInitServlet extends HttpServlet {
   
public void init() throws ServletException {
// String prefix = getServletContext().getRealPath(/);
String file = getInitParameter(xml-config-file);
File xmlConfigFile = new File(prefix + file);
if (!xmlConfigFile.exists()) {
System.out.println(attributes-config.xml not found, 
+ xmlConfigFile.getAbsolutePath());
}

I'm sure that you don't have that one line commented-out, otherwise this
code does not compile. Assuming that prefix is defined as indicated
above, then this will certainly work when unpackWars (undeploy?) is set
to true, as you are building a filesystem path and loading a file as
usual.

When your file is still inside a WAR, you're not going to be able to
find it using a File object. You either have to get clever and try to
load the file out of the WAR file by actually opening the WAR file and
searching for the file (bad, and a waste of time to boot), or just by
using the built-in helper method like this:

public void init() throws ServletException {
ServletContext application
  = getServletConfix().getServletContext();
String filename = getInitParameter(xml-config-file);
URL xmlConfig = application.getResource(filename);

if (null == xmlConfig) {
System.out.println(attributes-config.xml not found, 
+ xmlConfigFile.getAbsolutePath());
}
else
{
InputStream in = xmlConfig.openStream();
// Hope a java.io.File argument is not necessary
AttributeBeanXmlConfigHelper.parse(in);
in.close();
}

 What I thought I could do was something like this inside the try / catch:
 
 InputStream is =
 getServletContext().getResourceAsStream(WEB-INF/attributes-config.xml);
 
 // Configure Digester from XML ruleset
 AttributeBeanXmlConfigHelper.parse(xmlConfigFile);   
 
 Now, the problem is... I think that there will be definitely be a
 pathing issue for WEB-INF/attributes-config.xml when using
 getResourceAsStream() (I am guessing because of my attempts with the
 Log4jInitServlet postings).

Did you actually try it? It's supposed to work this way.

 Also, how would one convert an InputStream to a File?

You can't: a java.io.File is a filesystem notion, and an InputStream is
just a source of bytes. If you had an InputStream that came from an HTTP
connection, what would it's java.io.File object look like?

The most portable way to do it would be to read the bytes from your
source file in the WAR and write them to a temp file in the TEMP
directory or something like that.

Why doesn't your class allow configuration through something other than
a java.io.File object? Can you change that?

-chris




signature.asc
Description: OpenPGP digital signature