Re: enabling/disabling a servlet filter conditionally

2008-08-03 Thread André Warnier

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

André Warnier wrote:
| Can one dynamically disable a servlet filter under some conditions, from
| within another preceding filter ?
|
| In other words, suppose I have a servlet configured approximately like
| this :

[snip]

| And suppose that I control the code of filter A but have no access to
| the code of filter B, and filter B has no parameter allowing to make it
| conditional.

Do you have the ability to alter the configuration? I have another idea...


Yes, I have.  And I'm interested, though I have to tell you, my 
knowledge in these matters is limited.




Take Filter B completely out of the configuration for the webapp and
install Filter D in its place.

Filter D is a newly-written filter you write that does nothing but
dispatch to a private instance of Filter B after checking the
appropriate conditional that you set up (and probably note in the
request attributes).

If you want, you can fake the FilterChain object so that doFilter does
nothing and then do the dispatch back to the FilterChain after
FilterB.doFilter returns, or you can just let FilterB.doFilter call back
into the filter chain itself. I think that should work.

This strategy allows you to accomplish your goal with a minimum of effort.


That last bit is what I'm intested in. :-)

To talk in concrete terms, this here is filter B :
http://jcifs.samba.org/src/docs/ntlmhttpauth.html

So, it's not that I have no access to the code, it is that I don't want 
to mess with the code, as I'm not smart enough to do that.


After filter B, I have my own filter C, which must remain in place.

The reason of it all is :
The JCIFS filter enforces Windows Domain NTLM authentication on the 
callers, and then sets the Tomcat user-id accordingly for the request.
That's fine if the callers all are prepared to do NTLM authentication, 
but in this case I have a situation where some callers can, some others 
can't. (See for example : 
http://jcifs.samba.org/src/docs/ntlmhttpauth.html#transparent)
However, JCIFS does not give a choice.  If it is in the filter chain, it 
forces NTLM authentication on the browser, and a browser that can't gets 
stuck in an endless loop of browser login popups.


It would be easiest if I could ask the JCIFS developers to add to JCIFS 
a test on some request attribute, and maybe just let the request through 
if this attribute is set.  But I feel a bit shy about asking them that, 
and I don't know if this would open some enormous security hole or so.


So instead, I want to check, when the request comes in, if it has an 
NTLM Authorization: header.

If it has, I want to let JCIFS do it's stuff.
If it hasn't, I want to bypass JCIFS, and set some flag.
My filter C runs after JCIFS. Its role is (right now) to pick up the 
Tomcat user-id (as set by JCIFS), and add it to the request as a HTTP 
header with the user-id, because that is what, finally, the application 
behind the servlet (which I do not control either) expects.


Thus what my (new) filter A should do is check the request, and 
depending on some condition either run (or let run) the JCIFS 
filter, or else set a request attribute, which will allow filter C later 
to decide to either get the authenticated user-id from Tomcat (as set by 
JCIFS), or set it by default to anonymous (if JCIFS did not run).


The only servlet filter I have written so far is filter C.  In order to 
do that, I had to wrap the request by subclassing 
HttpServletRequestWrapper, and pass a modified request to the servlet.
That I know how to do, and that is about the state of my knowledge on 
Java servlets and servlet filters.


So, to get back to the problem at hand, where do I start ?
Or, considering my limited knowledge, do you think this is beyond what I 
can reasonably undertake ?


One concern I have with the scheme you outline above, is that JCIFS 
expects a lot of configuration parameters, normally in the web.xml.  If 
I make it into a private instance, how do I set up things so that it 
still finds these parameters ?


And thank you very much for the interest.

André


-
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: Would like to monitor memory use offline

2008-08-03 Thread Mark Thomas

Richard S. Huntrods wrote:
SO - my question - is there a relatively easy way to create something 
(say a servlet) to watch the stack *just like I can do manually using 
the manager application* but email me when the stack approaches the 
memory limits?


Richard,

Tomcat is open source so if you want to copy something Tomcat is doing all 
you need to do is look at the Tomcat source and copy it. Granted it can be 
a bit impenetrable in places but I don't think this is one of them.


1. You know from the manager page what URL you are interested in.
2. The web.xml for the manager app will tell you which servlet is serving 
that URL.
3. The Tomcat 6 source is in a single tree under 
http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/ so finding the 
class is easy.
4. A quick look at the doGet() method in that class points you towards 
StatusTransformer.writeVMState()

5. And there you have your answer - a simple API call.
http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#freeMemory()

For the e-mail side, take a look at the JavaMail example in the JNDI docs. 
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html


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: Tomcat 6 fail to detect a matching certificate and stuck in an infinite loop

2008-08-03 Thread Mark Thomas

Assaf Vizner wrote:
 


Hi

I have a .keystore file which doesn't matches the SSL definitions in the
server.xml.

 tomcat 4 handled it well - it was unable to connect to it but the logs
showed a friendly messages and the server continue working fine.

However in tomcat 6 when I configured the connectors in the server.xml
with default settings or as org.apache.coyote.http11.Http11Protocol 


And I started the service the tomcat get in an infinite loop which holds
the CPU in 90% and keep writing to catalina log the following error:

 


03/08/2008 11:09:37 org.apache.tomcat.util.net.JIoEndpoint$Acceptor run

SEVERE: Socket accept failed

java.net.SocketException: SSL handshake errorjavax.net.ssl.SSLException:
No available certificate or key corresponds to the SSL cipher suites
which are enabled.

at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.acceptSocket(JSSESocke
tFactory.java:150)

at
org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:310
)

at java.lang.Thread.run(Thread.java:619)

03/08/2008 11:09:37 org.apache.tomcat.util.net.JIoEndpoint$Acceptor run

 


When I configure the connectors to work with
org.apache.coyote.http11.Http11NioProtocol the problem seems to
disappear

Any ideas?


That looks like a bug. Add it to Bugzilla so it doesn't get lost and 
someone will take a look.


It is probably a simple fix so you could probably do this yourself. Just 
ask if you need help building TC6 from source or figuring out where the 
root cause is.


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: Creating a new Service

2008-08-03 Thread André Warnier

Hi and Welcome to the list.
I can't answer your questions below, but since you are new to the list, 
allow me to make a couple of predictions :


The first thing you are going to be asked is under which OS you are 
running this, and from where you downloaded and installed Tomcat 5.5. 
So you might as well add that information right away.


The second thing likely to happen, is that someone will tell you to get 
rid of that Tomcat, and re-install one from the original Tomcat 
distribution.  That sounds hard, but it is to some extent 
understandable, since each distribution seems to put stuff in different 
places, and that makes it harder for people here to provide useful 
answers (and particularly for your type of configuration question).


Now, don't get discouraged and hang on there.  Usually, after this 
initial stage, the answers are good and people here know their stuff and 
are genuinely helpful.


And also, because you say that you have already been playing around with 
the configuration and are getting all kinds of errors as a result, you 
might anyway want to de-install your now messed-up tomcat-webapps and 
tomcat packages, re-install a clean tomcat package (without the 
webapps), and start from there.


André
;-)

Robert Drescher wrote:

Hello everyone in this list!

This is my first post in the users-help, after successfully installing
Tomcat5.5

The default applications are running (in the /usr/share/tomcat5.5-webapps
folder), but for testing my application, I'd like to move mine to a
different location in the filesystem.
Am I right in my assumption that for this, I will need to create a new
service in the server.xml, apart from Catalina?

My structure would look like this:

/usr/share/myapp/  -- my applications root, the equivalent to
/usr/share/tomcat5.5-webapps
/usr/share/myapp/webapp   -- my applications webapp, the equivalent to
/usr/share/tomcat5.5-webapps/ROOT

in the end, i'd like requests going to http://localhost:1234 being mapped to
/usr/share/myapp/webapp, the same as requests going to
http://localhost:8180being now mapped to
/usr/share/tomcat5.5-webapps/ROOT

Which configurations do I have to change? I've ben messing around with the
server.xml and the configurations of my webapp for some time, with the
result of getting return code 400
Also, as soon as this is working, can I just remove the definition of
catalina from the server.xml to deactivate all the standard applications?

I'd be very happy to recieve some advice on this and maybe even example
configuration files *wink*

Robert




-
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: Would like to monitor memory use offline

2008-08-03 Thread Ben Stringer
On Sat, 2008-08-02 at 19:18 -0700, Richard S. Huntrods wrote:
 
 SO - my question - is there a relatively easy way to create something 
 (say a servlet) to watch the stack *just like I can do manually using 
 the manager application* but email me when the stack approaches the 
 memory limits?

Hi Richard,

I'd suggest running the tomcat JVM with verbose garbage collection
enabled eg. [1], then monitoring the log produced with a shell script.
This should show you when you are nearing your out of memory limit.

To track down the memory leak, try something like Lambda Probe [2] to
give you an overview of resource consumption and monitor it over time.

Cheers, Ben

[1]
-XX:+PrintGCTimeStamps
-Xloggc:/var/log/java/gc.log
-verbosegc
-XX:+PrintGCDetails

[2] http://www.lambdaprobe.org/d/index.htm




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



Tomcat 6 fail to detect a matching certificate and stuck in an infinite loop

2008-08-03 Thread Assaf Vizner
 

Hi

I have a .keystore file which doesn't matches the SSL definitions in the
server.xml.

 tomcat 4 handled it well - it was unable to connect to it but the logs
showed a friendly messages and the server continue working fine.

However in tomcat 6 when I configured the connectors in the server.xml
with default settings or as org.apache.coyote.http11.Http11Protocol 

And I started the service the tomcat get in an infinite loop which holds
the CPU in 90% and keep writing to catalina log the following error:

 

03/08/2008 11:09:37 org.apache.tomcat.util.net.JIoEndpoint$Acceptor run

SEVERE: Socket accept failed

java.net.SocketException: SSL handshake errorjavax.net.ssl.SSLException:
No available certificate or key corresponds to the SSL cipher suites
which are enabled.

at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.acceptSocket(JSSESocke
tFactory.java:150)

at
org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:310
)

at java.lang.Thread.run(Thread.java:619)

03/08/2008 11:09:37 org.apache.tomcat.util.net.JIoEndpoint$Acceptor run

 

When I configure the connectors to work with
org.apache.coyote.http11.Http11NioProtocol the problem seems to
disappear

 

Any ideas?

 

Thanks

 

Assaf Vizner
NextNine.LTD
4 Ha-Nechoshet
Tel-Aviv 69710 Israel
E-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Tel: +972(3)7673012
Mobile: +972(528)466746
Fax: +972(3)6497810

 



Creating a new Service

2008-08-03 Thread Robert Drescher
Hello everyone in this list!

This is my first post in the users-help, after successfully installing
Tomcat5.5

The default applications are running (in the /usr/share/tomcat5.5-webapps
folder), but for testing my application, I'd like to move mine to a
different location in the filesystem.
Am I right in my assumption that for this, I will need to create a new
service in the server.xml, apart from Catalina?

My structure would look like this:

/usr/share/myapp/  -- my applications root, the equivalent to
/usr/share/tomcat5.5-webapps
/usr/share/myapp/webapp   -- my applications webapp, the equivalent to
/usr/share/tomcat5.5-webapps/ROOT

in the end, i'd like requests going to http://localhost:1234 being mapped to
/usr/share/myapp/webapp, the same as requests going to
http://localhost:8180being now mapped to
/usr/share/tomcat5.5-webapps/ROOT

Which configurations do I have to change? I've ben messing around with the
server.xml and the configurations of my webapp for some time, with the
result of getting return code 400
Also, as soon as this is working, can I just remove the definition of
catalina from the server.xml to deactivate all the standard applications?

I'd be very happy to recieve some advice on this and maybe even example
configuration files *wink*

Robert


RE: Creating a new Service

2008-08-03 Thread Martin Gainty

hello Robert-

first looking at your present folder layout

Not under tomcats control.. /usr/share/myapp/
Not under tomcats control.. /usr/share/myapp/webapp   

I would suggest reading how to configure your tomcat engine at /conf/server.xml
http://tomcat.apache.org/tomcat-5.5-doc/virtual-hosting-howto.html
Host name=localhost appBase=webapps
   unpackWARs=true autoDeploy=true
   xmlValidation=true xmlNamespaceAware=true

wgere the structure for your ROOT folder would look like
$CATALINA_HOME/appBase/ROOT

and the root.war would deploy to
$CATALINA_HOME/appBase/ROOT.war

the mapping would be 
path - The context path (including the leading slash)
of the web application you are dealing with.  To select the ROOT web
application, specify /.  

I agree with Andre that a fresh install would solve most of these 
misconfiguration errors you are now seeing
HTH
Martin 
__ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 


 Date: Sun, 3 Aug 2008 12:53:15 +0200
 From: [EMAIL PROTECTED]
 To: users@tomcat.apache.org
 Subject: Re: Creating a new Service
 
 Hi and Welcome to the list.
 I can't answer your questions below, but since you are new to the list, 
 allow me to make a couple of predictions :
 
 The first thing you are going to be asked is under which OS you are 
 running this, and from where you downloaded and installed Tomcat 5.5. 
 So you might as well add that information right away.
 
 The second thing likely to happen, is that someone will tell you to get 
 rid of that Tomcat, and re-install one from the original Tomcat 
 distribution.  That sounds hard, but it is to some extent 
 understandable, since each distribution seems to put stuff in different 
 places, and that makes it harder for people here to provide useful 
 answers (and particularly for your type of configuration question).
 
 Now, don't get discouraged and hang on there.  Usually, after this 
 initial stage, the answers are good and people here know their stuff and 
 are genuinely helpful.
 
 And also, because you say that you have already been playing around with 
 the configuration and are getting all kinds of errors as a result, you 
 might anyway want to de-install your now messed-up tomcat-webapps and 
 tomcat packages, re-install a clean tomcat package (without the 
 webapps), and start from there.
 
 André
 ;-)
 
 Robert Drescher wrote:
  Hello everyone in this list!
  
  This is my first post in the users-help, after successfully installing
  Tomcat5.5
  
  The default applications are running (in the /usr/share/tomcat5.5-webapps
  folder), but for testing my application, I'd like to move mine to a
  different location in the filesystem.
  Am I right in my assumption that for this, I will need to create a new
  service in the server.xml, apart from Catalina?
  
  My structure would look like this:
  
  /usr/share/myapp/  -- my applications root, the equivalent to
  /usr/share/tomcat5.5-webapps
  /usr/share/myapp/webapp   -- my applications webapp, the equivalent to
  /usr/share/tomcat5.5-webapps/ROOT
  
  in the end, i'd like requests going to http://localhost:1234 being mapped to
  /usr/share/myapp/webapp, the same as requests going to
  http://localhost:8180being now mapped to
  /usr/share/tomcat5.5-webapps/ROOT
  
  Which configurations do I have to change? I've ben messing around with the
  server.xml and the configurations of my webapp for some time, with the
  result of getting return code 400
  Also, as soon as this is working, can I just remove the definition of
  catalina from the server.xml to deactivate all the standard applications?
  
  I'd be very happy to recieve some advice on this and maybe even example
  configuration files *wink*
  
  Robert
  
 
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

_
Reveal your inner athlete and share it with friends on Windows Live.
http://revealyourinnerathlete.windowslive.com?locale=en-usocid=TXT_TAGLM_WLYIA_whichathlete_us

configure tomcat

2008-08-03 Thread Nadun Herath
I am a newbie to tomcat. I installed it ubuntu

added the following line to bashrc file

export 
CLASSPATH=/usr/local/tomcat/common/lib/jsp-api.jar:/usr/local/tomcat/common/lib/servlet-api.jar


When I run startup.sh it runs ok. Giving this message

Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:   /usr/lib/jvm/java-6-sun

But when I type localhost/8080 it says can't connect. What is the problem.
Please help. I thank you in advance.


Re: configure tomcat

2008-08-03 Thread Alessandro Ferrucci
Make sure none of the ports specified in conf/server.xml are being used.
You can check this by running

netstat -na | grep port

if nothing comes up then the port is free.

-- 
Signed,
Alessandro Ferrucci


On Sun, Aug 3, 2008 at 10:07 AM, Nadun Herath [EMAIL PROTECTED] wrote:

 I am a newbie to tomcat. I installed it ubuntu

 added the following line to bashrc file

 export
 CLASSPATH=/usr/local/tomcat/common/lib/jsp-api.jar:/usr/local/tomcat/common/lib/servlet-api.jar


 When I run startup.sh it runs ok. Giving this message

 Using CATALINA_BASE:   /usr/local/tomcat
 Using CATALINA_HOME:   /usr/local/tomcat
 Using CATALINA_TMPDIR: /usr/local/tomcat/temp
 Using JRE_HOME:   /usr/lib/jvm/java-6-sun

 But when I type localhost/8080 it says can't connect. What is the problem.
 Please help. I thank you in advance.



Re: configure tomcat

2008-08-03 Thread Nadun Herath
Thanks a lot Alessandro
When I type that command.
this appeared

tcp6   0  0 :::8080 :::*

It seems tomcat working well isn't it.? What is wrong.
Thanks again.

On Sun, Aug 3, 2008 at 7:43 PM, Alessandro Ferrucci 
[EMAIL PROTECTED] wrote:

 Make sure none of the ports specified in conf/server.xml are being used.
 You can check this by running

 netstat -na | grep port

 if nothing comes up then the port is free.

 --
 Signed,
 Alessandro Ferrucci


 On Sun, Aug 3, 2008 at 10:07 AM, Nadun Herath [EMAIL PROTECTED]
 wrote:

  I am a newbie to tomcat. I installed it ubuntu
 
  added the following line to bashrc file
 
  export
 
 CLASSPATH=/usr/local/tomcat/common/lib/jsp-api.jar:/usr/local/tomcat/common/lib/servlet-api.jar
 
 
  When I run startup.sh it runs ok. Giving this message
 
  Using CATALINA_BASE:   /usr/local/tomcat
  Using CATALINA_HOME:   /usr/local/tomcat
  Using CATALINA_TMPDIR: /usr/local/tomcat/temp
  Using JRE_HOME:   /usr/lib/jvm/java-6-sun
 
  But when I type localhost/8080 it says can't connect. What is the
 problem.
  Please help. I thank you in advance.
 



Re: Creating a new Service

2008-08-03 Thread Johnny Kewl


- Original Message - 
From: Robert Drescher [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Sunday, August 03, 2008 12:27 PM
Subject: Creating a new Service



Hello everyone in this list!

This is my first post in the users-help, after successfully installing
Tomcat5.5

The default applications are running (in the /usr/share/tomcat5.5-webapps
folder), but for testing my application, I'd like to move mine to a
different location in the filesystem.
Am I right in my assumption that for this, I will need to create a new
service in the server.xml, apart from Catalina?

My structure would look like this:

/usr/share/myapp/  -- my applications root, the equivalent to
/usr/share/tomcat5.5-webapps
/usr/share/myapp/webapp   -- my applications webapp, the equivalent to
/usr/share/tomcat5.5-webapps/ROOT

in the end, i'd like requests going to http://localhost:1234 being mapped 
to

/usr/share/myapp/webapp, the same as requests going to
http://localhost:8180being now mapped to
/usr/share/tomcat5.5-webapps/ROOT

Which configurations do I have to change? I've ben messing around with the
server.xml and the configurations of my webapp for some time, with the
result of getting return code 400
Also, as soon as this is working, can I just remove the definition of
catalina from the server.xml to deactivate all the standard applications?

I'd be very happy to recieve some advice on this and maybe even example
configuration files *wink*

Robert


Hi Robert... you getting good advice in the other posts... and your question 
actually lands in the middle of many ways to approach this...
It hints at virtual hosting, it can be done with a docbase in a context... 
it can be done by messing with Catalina Home and Catalina Base in the 
scripts... its a no mans land kinda question ;)


Heres a suggestion...
TC installs easily from a ZIP... its drop and play...

So rather go for a strategy of

   /usr/share/MyProduction/TomcatXXX
   /usr/share/MyTest/TomcatXXX1
   /usr/share/MyTest/TomcatXXX2

Because this way your test stuff is away from your production stuff... if 
you nuke TC with a bad app... no problem
And as TC changes... new versions... you are going to want to play with all 
the new stuff..


The only thing it that TC's must operate on diff ports... you set this in 
server.XML... ie


   Connector port=8080
   Server port=8005 shutdown=SHUTDOWN

Each TC must not be the same... but after that setting. you'll be 
whizing along...


http://localhost:8080/manager/html

will let you UNDEPLOY applications that you dont want

if your production server is set at

   Connector port=80
   Server port=8006 shutdown=SHUTDOWN

http://localhost/manager/html

will do the same thing

So every port is a diff test system... otherwise an application in one is 
absolutely identical to another...


The only reason to start messing with Catalina BASE and Catalina Home in the 
scripts with the idea of having many WEBAPP locations and one bin (I feel) 
is when you have serious disk space problems... but TC is very small and its 
not worth the pain...


Then to get to your last question if you have to have a webapp operate 
outside of the default Tomcat/webapps... you can tell just that web app to 
operate outside using something called the context file... and setting the 
DocBase


I think this setup will get you going and its easy later you can mess 
with docbase and virtual hosting and all the rest...
TC is very flexible... so I think try keep it simple... drop and play idea, 
which works on any OS and your customer will also understand it...
You dont want to get to the stage where you have so much script all over the 
machine, that you too afraid to install another TC...


TC is going to be the best thing you ever did its worth the learning 
curve.


Have fun...

---
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---


-
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: configure tomcat

2008-08-03 Thread Ravi Sharma
i guess u need to write localhost*:*8080 and not localhost*/*8080(See
the   :   and /  , and if its typo then may be some other problem)

Ravi.
On Sun, Aug 3, 2008 at 4:21 PM, Nadun Herath [EMAIL PROTECTED] wrote:

 Thanks a lot Alessandro
 When I type that command.
 this appeared

 tcp6   0  0 :::8080 :::*

 It seems tomcat working well isn't it.? What is wrong.
 Thanks again.

 On Sun, Aug 3, 2008 at 7:43 PM, Alessandro Ferrucci 
 [EMAIL PROTECTED] wrote:

  Make sure none of the ports specified in conf/server.xml are being used.
  You can check this by running
 
  netstat -na | grep port
 
  if nothing comes up then the port is free.
 
  --
  Signed,
  Alessandro Ferrucci
 
 
  On Sun, Aug 3, 2008 at 10:07 AM, Nadun Herath [EMAIL PROTECTED]
  wrote:
 
   I am a newbie to tomcat. I installed it ubuntu
  
   added the following line to bashrc file
  
   export
  
 
 CLASSPATH=/usr/local/tomcat/common/lib/jsp-api.jar:/usr/local/tomcat/common/lib/servlet-api.jar
  
  
   When I run startup.sh it runs ok. Giving this message
  
   Using CATALINA_BASE:   /usr/local/tomcat
   Using CATALINA_HOME:   /usr/local/tomcat
   Using CATALINA_TMPDIR: /usr/local/tomcat/temp
   Using JRE_HOME:   /usr/lib/jvm/java-6-sun
  
   But when I type localhost/8080 it says can't connect. What is the
  problem.
   Please help. I thank you in advance.
  
 



Re: Problem with Displaying Result of a MySQL Join in Tomcat

2008-08-03 Thread Len Popp
There might be a simpler solution than migrating to a completely
different OS. :-)

What exactly do you mean by don't get retrieved? Does it throw an
exception? Is there an error message in Tomcat's log?

When you execute the query in MySQL, do you get exactly the same
results as on the old system? In particular, are the column names what
you expect?
-- 
Len



On Sat, Aug 2, 2008 at 20:02, Glyn Thomas [EMAIL PROTECTED] wrote:
 I am in the process of converting a Tomcat front end for a MySQL database
 from

 Windows XP to Windows Vista.



 The XP version used MySQL Version 5.0.22, Tomcat 5.5.20, JRE 1.5.0 release

 12 with Tomcat JDK 4 Compatibility Pack, and J/Connector 5.0.6.



 The Vista version is using MySQL Version 5.0.51a, Tomcat 5.5.26, JRE

 1.6.0_05, and J/Connector 5.1.6.



 I am unable to display any parts of a result set that are retrieved from

 JOINed tables in the Vista version - this works fine in the XP version.  I

 already tried converting the queries to use JOIN syntax instead of WHERE

 syntax, without improvement.



 For example, this query works correctly in the MySQL command line:



 SELECT

 i.ImageID,i.DateDay,i.DateMonth,i.DateYear,i.Location1,i.Location2,i.Scanned

 YN,i.MediaID,c.Description as 'Country', s.SubjectID, s.SubjectTypeID,

 i.CountryID,i.PhotographerID, i.VolumeNumber FROM image_tbl i JOIN

 lu_country_tbl c ON (i.countryid=c.countryid) JOIN xrf_image_subject_tbl si

 ON (si.Imageid=i.imageid) JOIN subject_tbl s ON (si.Subjectid=s.subjectid)

 WHERE (i.imageid=1234);



 In JSP, I retrieve the results of this query into an rsImages variable, and

 then iterate through the rows using:



 c:forEach var=row items=${rsImage.rows}



 Rows that retrieve directly from the image_tbl work correctly e.g.

 ${row.ImageID} will display the image ID.



 However, elements from the joined tables, such as ${row.Country} and

 ${row.SubjectID} don't get retrieved.



 Any ideas?



 Thanks,

 Glyn Thomas







-
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: example about deploy application from windows eclipse to linux Tomcat

2008-08-03 Thread Edoardo Panfili

Sam Wun ha scritto:

Hi,

Can anyone link me an example about deploy application from windows
eclipse to linux Tomcat?

Thanks

The target operating system is not so important, I use eclipse on mac 
and deploy applications on linux. Simply copy the content of WebContent 
folder in a folder under webapp in tomcat (on linux) (call that folder 
app) after that I copy the content of build folder (from eclipse) in 
Tomncat (linux) in folder app/WEB-INF/classes


Take a look at ant to buil war files, maybe that this is a more polite 
approach.


Edoardo

-
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: Problem with Displaying Result of a MySQL Join in Tomcat

2008-08-03 Thread Glyn Thomas
Len,
Thanks for your comments and interest.

I hadn't thought to check the Tomcat log because the majority of the query 
appeared to execute, but there is an error being put into the log, see below.  
Note, this is with a slight variation on the query that I added in my earlier 
post, but has the same symptoms.

Aug 3, 2008 1:10:57 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at 
com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
at 
com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
at 
com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2428)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at 
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at 
com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1885)
at 
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at 
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doEndTag(QueryTagSupport.java:215)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:371)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)

I ran the query in  MySQL Command Line Client on both XP and Vista and they 
return identical results.

Thanks
Glyn

-Original Message-
From: Len Popp [mailto:[EMAIL PROTECTED] 
Sent: Sunday, August 03, 2008 11:31 AM
To: Tomcat Users List
Subject: Re: Problem with Displaying Result of a MySQL Join in Tomcat

There might be a simpler solution than migrating to a completely
different OS. :-)

What exactly do you mean by don't get retrieved? Does it throw an
exception? Is there an error message in Tomcat's log?

When you execute the query in MySQL, do you get exactly the same
results as on the old system? In particular, are the column names what
you expect?
-- 
Len



On Sat, Aug 2, 2008 at 20:02, Glyn Thomas [EMAIL PROTECTED] wrote:
 I am in the process of converting a Tomcat front end for a MySQL database
 from

 Windows XP to Windows Vista.



 The XP version used MySQL Version 5.0.22, Tomcat 5.5.20, JRE 1.5.0 release

 12 with Tomcat JDK 4 Compatibility Pack, and J/Connector 5.0.6.



 The Vista version is using MySQL Version 5.0.51a, Tomcat 5.5.26, JRE

 1.6.0_05, and J/Connector 5.1.6.



 I am unable to display any parts of a result set that are retrieved from

 JOINed tables in the Vista version - this works fine in the XP version.  I

 already tried converting the 

Re: configure tomcat

2008-08-03 Thread Alessandro Ferrucci
Well if something is listening on port 8080 when tomcat is not running, then
that is the reason (port 8080 is already used), check tomcat logs under
logs/catalina.out to see if there are any port conflict errors, or any other
exceptions thrown at startup.


-- 
Signed,
Alessandro Ferrucci

On Sun, Aug 3, 2008 at 10:21 AM, Nadun Herath [EMAIL PROTECTED] wrote:

 Thanks a lot Alessandro
 When I type that command.
 this appeared

 tcp6   0  0 :::8080 :::*

 It seems tomcat working well isn't it.? What is wrong.
 Thanks again.

 On Sun, Aug 3, 2008 at 7:43 PM, Alessandro Ferrucci 
 [EMAIL PROTECTED] wrote:

  Make sure none of the ports specified in conf/server.xml are being used.
  You can check this by running
 
  netstat -na | grep port
 
  if nothing comes up then the port is free.
 
  --
  Signed,
  Alessandro Ferrucci
 
 
  On Sun, Aug 3, 2008 at 10:07 AM, Nadun Herath [EMAIL PROTECTED]
  wrote:
 
   I am a newbie to tomcat. I installed it ubuntu
  
   added the following line to bashrc file
  
   export
  
 
 CLASSPATH=/usr/local/tomcat/common/lib/jsp-api.jar:/usr/local/tomcat/common/lib/servlet-api.jar
  
  
   When I run startup.sh it runs ok. Giving this message
  
   Using CATALINA_BASE:   /usr/local/tomcat
   Using CATALINA_HOME:   /usr/local/tomcat
   Using CATALINA_TMPDIR: /usr/local/tomcat/temp
   Using JRE_HOME:   /usr/lib/jvm/java-6-sun
  
   But when I type localhost/8080 it says can't connect. What is the
  problem.
   Please help. I thank you in advance.
  
 



HEAD request to a Servlet

2008-08-03 Thread samk
See Thread at: http://www.techienuggets.com/Detail?tx=46841 Posted on behalf of 
a User

A request like:

HEAD /SomeServlet?id=10471 HTTP/1.1 500 returns a 500 error. The log has the 
following:

javax.servlet.ServletException: Original SevletResponse or wrapped original 
ServletResponse not passed to RequestDispatcher in violation of SRV.8.2 and 
SRV.14.2.5.1
at 
org.apache.catalina.core.ApplicationDispatcher.checkSameObjects(ApplicationDispatcher.java:1018)
at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:329)
at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at showme.servlet.Detail.processRequest(Detail.java:153)
at showme.servlet.Detail.doGet(Detail.java:163)
at javax.servlet.http.HttpServlet.doHead(HttpServlet.java:271)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at 
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at 
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at 
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
at 
org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381)
at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

Any solution to this annoying problem?

Thanks



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



Re: HEAD request to a Servlet

2008-08-03 Thread samk
See Thread at: http://www.techienuggets.com/Detail?tx=46841 Posted on behalf of 
a User

That's exactly it. Thanks for pointing me in the right direction! Now I have to 
figure out which version of JBoss will be built around that version of Tomcat.



In Response To: 

[EMAIL PROTECTED] wrote:
 A request like:
 
 HEAD /SomeServlet?id=10471 HTTP/1.1 500 returns a 500 error. The log has the 
 following:
 
 javax.servlet.ServletException: Original SevletResponse or wrapped original 
 ServletResponse not passed to RequestDispatcher in violation of SRV.8.2 and 
 SRV.14.2.5.1
 
 Any solution to this annoying problem?

Looks like https://issues.apache.org/bugzilla/show_bug.cgi?id=44562

An upgrade to to 6.0.18 should fix it.

Mark



-
To start a new topic, e-mail: [EMAIL PROTECTED]
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: Session lost when switching from https to http after upgrade to Tomcat 6

2008-08-03 Thread DIGLLOYD INC
I've been having the same issues others have been asking about.  This  
discussion has been useful, but...


=== What is a viable workaround for switching to http from https once  
the user is authenticated?  And is that idea unreasonable (see use  
case below).


My main concern is that sending large amounts of static content over  
https (large JPEGs in particular) will cause an undue load on the  
server, as opposed to 'http'.


Here is my use case:

1.  The user's password should be protected over https when logging  
in.  Ditto for the user's home page.


2.  Once logged in, a large amount of static content (html, large  
JPEGs, etc) is available to that user.  None of it is of a sensitive  
nature.


3. While it's true that the sessionid could be hijacked, an attacker  
would need the user's actual password to do anything malicious; there  
isn't any sensitive user data, just access to content.  So having  
sessionid travel over plain http would be fine.


Lloyd Chambers
http://diglloyd.com

[Mac OS X 10.5.2 Intel, Tomcat 6.0.16]




On Jun 7, 2008, at 3:40 AM, Mark Thomas wrote:



The application may be trivial, but not the user's password.
If the functionality is important enough to protect with a password  
over SSL then the session ID, which for most applications will give  
access to that functionality, should usually be protected in the  
same way. There will be some exceptions to this. Protected the  
session by other means is one possibility.



-
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: configure tomcat

2008-08-03 Thread Gabe Wong

Hi Nadun,

Did you install a Tomcat version from tomcat.apache.org or is it from 
Ubuntu's repository?

If the latter you will find much more success with the former.
Also nothing good usually results from adding CLASSPATH with Tomcat


Nadun Herath wrote:

Thanks a lot Alessandro
When I type that command.
this appeared

tcp6   0  0 :::8080 :::*

It seems tomcat working well isn't it.? What is wrong.
Thanks again.

On Sun, Aug 3, 2008 at 7:43 PM, Alessandro Ferrucci 
[EMAIL PROTECTED] wrote:

  

Make sure none of the ports specified in conf/server.xml are being used.
You can check this by running

netstat -na | grep port

if nothing comes up then the port is free.

--
Signed,
Alessandro Ferrucci


On Sun, Aug 3, 2008 at 10:07 AM, Nadun Herath [EMAIL PROTECTED]
wrote:



I am a newbie to tomcat. I installed it ubuntu

added the following line to bashrc file

export

  

CLASSPATH=/usr/local/tomcat/common/lib/jsp-api.jar:/usr/local/tomcat/common/lib/servlet-api.jar


When I run startup.sh it runs ok. Giving this message

Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:   /usr/lib/jvm/java-6-sun

But when I type localhost/8080 it says can't connect. What is the
  

problem.


Please help. I thank you in advance.

  


  



--
Regards

Gabe Wong
NGASI AppServer Manager
JAVA AUTOMATION and SaaS Enablement for Cloud Computing
http://www.ngasi.com
NEW! FREE Developer account for Hosted version on Amazon EC2


-
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: Problem with Displaying Result of a MySQL Join in Tomcat

2008-08-03 Thread Len Popp
That error looks like a communication problem between Tomcat  MySQL,
but I don't know why it would only happen when accessing certain
columns. Perhaps someone who knows more about JDBC  MySQL can explain
what it means.
-- 
Len



On Sun, Aug 3, 2008 at 13:21, Glyn Thomas [EMAIL PROTECTED] wrote:
 Len,
 Thanks for your comments and interest.

 I hadn't thought to check the Tomcat log because the majority of the query 
 appeared to execute, but there is an error being put into the log, see below. 
  Note, this is with a slight variation on the query that I added in my 
 earlier post, but has the same symptoms.

 Aug 3, 2008 1:10:57 PM org.apache.catalina.core.StandardWrapperValve invoke
 SEVERE: Servlet.service() for servlet jsp threw exception
 java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at 
 com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
at 
 com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
at 
 com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2428)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at 
 com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at 
 com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1885)
at 
 org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at 
 org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doEndTag(QueryTagSupport.java:215)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:371)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at 
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
at 
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at 
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at 
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at 
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at 
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at 
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at 
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at 
 org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at 
 org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at 
 org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at 
 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)

 I ran the query in  MySQL Command Line Client on both XP and Vista and they 
 return identical results.

 Thanks
 Glyn

 -Original Message-
 From: Len Popp [mailto:[EMAIL PROTECTED]
 Sent: Sunday, August 03, 2008 11:31 AM
 To: Tomcat Users List
 Subject: Re: Problem with Displaying Result of a MySQL Join in Tomcat

 There might be a simpler solution than migrating to a completely
 different OS. :-)

 What exactly do you mean by don't get retrieved? Does it throw an
 exception? Is there an error message in Tomcat's log?

 When you execute the query in MySQL, do you get exactly the same
 results as on the old system? In particular, are the column names what
 you expect?
 --
 Len



 On Sat, Aug 2, 2008 at 20:02, Glyn Thomas [EMAIL PROTECTED] wrote:
 I am in the process of converting a Tomcat front end for a MySQL database
 from

 Windows XP to Windows Vista.



 The XP version used MySQL Version 5.0.22, Tomcat 5.5.20, JRE 1.5.0 release

 12 with 

Re: enabling/disabling a servlet filter conditionally

2008-08-03 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

André Warnier wrote:
| To talk in concrete terms, this here is filter B :
| http://jcifs.samba.org/src/docs/ntlmhttpauth.html

The details of Filter B are entirely irrelevant.

| After filter B, I have my own filter C, which must remain in place.

No problem.

| So instead, I want to check, when the request comes in, if it has an
| NTLM Authorization: header.
| If it has, I want to let JCIFS do it's stuff.
| If it hasn't, I want to bypass JCIFS, and set some flag.

So your Filter D looks something like this:

public static final String SKIPPED = SkippedJCIFS;
private static final String NTLM_HEADER = [whatever];

private final JCIFSFilter _jcifs;

public void init(FilterConfig config)
{
~  _jcifs = new JCIFSFilter(); // or whatever
~  _jcifs.init(config);
}

public void destroy()
{
~  _jcifs.destroy();
}

public void doFilter(ServletRequest request,
~ ServletResponse response,
~ FilterChain chain
{
~  if(request instanceof HttpServletRequest)
~  {
~if(null != ((HttpServletRequest)request).getHeader(NTLM_AUTH))
~{
~  // Manually invoke the filter
~  _jcifs.doFilter(request, response, chain);
~}
~else
~{
~  // Skip the JCIFS filter
~  request.setAttribute(SKIPPED, Boolean.TRUE);
~  chain.doFilter(request, response);
~}
~  }
~  else
~  {
~chain.doFilter(request, response);
~  }
}

| My filter C runs after JCIFS. Its role is (right now) to pick up the
| Tomcat user-id (as set by JCIFS), and add it to the request as a HTTP
| header with the user-id, because that is what, finally, the application
| behind the servlet (which I do not control either) expects.

Hmm... this could be problematic, as I think request headers are
read-only. Unless you want to wrap the request and artificially insert
headers. Yuck.

| Thus what my (new) filter A should do is check the request, and
| depending on some condition either run (or let run) the JCIFS
| filter, or else set a request attribute, which will allow filter C later
| to decide to either get the authenticated user-id from Tomcat (as set by
| JCIFS), or set it by default to anonymous (if JCIFS did not run).

Using the above code, FilterC need only check for the SKIPPED key in the
request attributes.

| One concern I have with the scheme you outline above, is that JCIFS
| expects a lot of configuration parameters, normally in the web.xml.  If
| I make it into a private instance, how do I set up things so that it
| still finds these parameters ?

I'll leave that as an exercise for the reader ;) Here's a hint: I did
something in the init() method that will help you a lot.

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

iEYEARECAAYFAkiWfvYACgkQ9CaO5/Lv0PB7dgCfQM0xRxi4y2l8TPXqpgMa1zr2
fYwAni1UhZU+IoeJ5UM5ElzYgo+/DJ4E
=cSnI
-END PGP SIGNATURE-

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



Re: Session lost when switching from https to http after upgrade to Tomcat 6

2008-08-03 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Lloyd,

DIGLLOYD INC wrote:
| What is a viable workaround for switching to http from https once
| the user is authenticated?

Simple: make sure that the user has a session before you switch into
HTTPS mode.

- -chris

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

iEYEARECAAYFAkiWgFEACgkQ9CaO5/Lv0PCKXwCfdxyllD2dSk/yyGVl4nfoV5Yp
2wMAoIYP9G645LdAYkeF/hKXfK+zUsqa
=oT7H
-END PGP SIGNATURE-

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



Re: example about deploy application from windows eclipse to linux Tomcat

2008-08-03 Thread Sameer Acharya
I have not used Eclipse so cant say about the same,  Netbeans can build a war 
file (so Iam assuming Eclipse can do the same too) for a web project.

You can just copy the war file into webapps folder of Tomcat if directory 
sharing is done else ftp it to that folder, depends on how your machines and 
network is configured.

-Sameer


--- On Sun, 8/3/08, Edoardo Panfili [EMAIL PROTECTED] wrote:

 From: Edoardo Panfili [EMAIL PROTECTED]
 Subject: Re: example about deploy application from windows eclipse to linux 
 Tomcat
 To: Tomcat Users List users@tomcat.apache.org, [EMAIL PROTECTED]
 Date: Sunday, August 3, 2008, 9:12 PM
 Sam Wun ha scritto:
  Hi,
  
  Can anyone link me an example about deploy application
 from windows
  eclipse to linux Tomcat?
  
  Thanks
  
 The target operating system is not so important, I use
 eclipse on mac 
 and deploy applications on linux. Simply copy the content
 of WebContent 
 folder in a folder under webapp in tomcat (on linux) (call
 that folder 
 app) after that I copy the content of build folder (from
 eclipse) in 
 Tomncat (linux) in folder app/WEB-INF/classes
 
 Take a look at ant to buil war files, maybe that this is a
 more polite 
 approach.
 
 Edoardo
 
 -
 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: Would like to monitor memory use offline

2008-08-03 Thread Sameer Acharya
You can write a simple JSP which will run a freeMemory/totalMemory call in your 
JVM and possibly send a mail/log when the limits are reached.

You could set a refresh interval and have this page refresh say every 5 minutes 
in your browser.

Alternatively you can tweak with the manager app code.

If you are an administrator ten from a long term monitoring aspect you may want 
to explore the usage of Lambdaprobe.

http://www.lambdaprobe.org

-Sameer



--- On Sun, 8/3/08, Richard S. Huntrods [EMAIL PROTECTED] wrote:

 From: Richard S. Huntrods [EMAIL PROTECTED]
 Subject: Would like to monitor memory use offline
 To: users@tomcat.apache.org
 Date: Sunday, August 3, 2008, 7:48 AM
 I've been running Tomcat for many versions now, mostly
 without incident. 
 However with the latest set of upgrades rather
 forced upon me all at 
 once (instead of managed more properly), my application
 appears to have 
 a severe memory leak.
 
 System Info: OS is Solaris 10-u5 (2008); java 1.6.0_06-b02;
 
 apache-tomcat-6.0.16; mysql 5.0.51a-solaris10-x86_64. I
 have fast 
 servers and plenty of memory (8 gigs). I'm running 1
 gig stack and 
 getting at least 2 GC/stack exceptions per day (sometimes
 more). Yes - 
 it's a user/use triggered leak but I can't trace it
 further yet.
 
 Of course what is odd is that there was NO memory leak
 using older 
 versions of this stuff (Solaris 10 (2006), java 1.5.x,
 tomcat 5.5.12, 
 mysql 5.0.16). I'm sure the memory leak was there, but
 it was well 
 masked. On the older system I was running 512 meg
 stack and it never 
 gave GC or stack errors.
 
 So, while I am actively trying to fix the memory leak, I
 still have to 
 maintain these production servers at operatonal status
 (politics - don't 
 ask). However, it's difficult as the memory leak is
 causing repeated GC 
 and out of stack exceptions.
 
 What I've noticed recently is that when using the
 manager application, I 
 can watch the memory utilization grow and more memory get
 allocated (via 
 refreshing the page), right up until the stack is used up
 and the main 
 application crashes. However, if I'm watching it grow,
 and then log on 
 to the server and reset tomcat (stop and then start
 tomcat), the memory 
 use is back at the start. Thanks to session persistence, no
 users are 
 harmed during this exercise.
 
 So for the moment, while I try and debug the application, I
 can keep 
 things running by having a cron job periodically reset
 tomcat for me. 
 But this is really crude. Until I fix the memory leak,
 I'd like 
 something a little bit more elegant.
 
 SO - my question - is there a relatively easy way to create
 something 
 (say a servlet) to watch the stack *just like I can do
 manually using 
 the manager application* but email me when the stack
 approaches the 
 memory limits?
 
 Thanks,
 
 -Richard
 
 
 
 -
 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: Problem with Displaying Result of a MySQL Join in Tomcat

2008-08-03 Thread Sameer Acharya
Error seems to originate from the MySQL JDBC driver, weird if you say it was 
working earlier.

Can you write a simple Java class to use the same driver to execute the same 
query and run it with same JDK version under which your Tomcat is running, see 
if its working or still throwing the error.

Might be your JDBC driver is older.
-Sameer


--- On Mon, 8/4/08, Len Popp [EMAIL PROTECTED] wrote:

 From: Len Popp [EMAIL PROTECTED]
 Subject: Re: Problem with Displaying Result of a MySQL Join in Tomcat
 To: Tomcat Users List users@tomcat.apache.org
 Date: Monday, August 4, 2008, 7:39 AM
 That error looks like a communication problem between Tomcat
  MySQL,
 but I don't know why it would only happen when
 accessing certain
 columns. Perhaps someone who knows more about JDBC 
 MySQL can explain
 what it means.
 -- 
 Len
 
 
 
 On Sun, Aug 3, 2008 at 13:21, Glyn Thomas
 [EMAIL PROTECTED] wrote:
  Len,
  Thanks for your comments and interest.
 
  I hadn't thought to check the Tomcat log because
 the majority of the query appeared to execute, but there is
 an error being put into the log, see below.  Note, this is
 with a slight variation on the query that I added in my
 earlier post, but has the same symptoms.
 
  Aug 3, 2008 1:10:57 PM
 org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Servlet.service() for servlet jsp threw
 exception
  java.net.SocketException: Software caused connection
 abort: recv failed
 at
 java.net.SocketInputStream.socketRead0(Native Method)
 at java.net.SocketInputStream.read(Unknown
 Source)
 at
 com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
 at
 com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
 at
 com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
 at
 com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2428)
 at
 com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
 at
 com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
 at
 com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
 at
 com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
 at
 com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
 at
 com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
 at
 com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
 at
 com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1885)
 at
 org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
 at
 org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doEndTag(QueryTagSupport.java:215)
 at
 org.apache.jsp.index_jsp._jspService(index_jsp.java:371)
 at
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
 at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
 at
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
 at
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
 at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
 at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
 at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 at
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
 at
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
 at
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
 at
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
 at
 org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
 at
 org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
 at
 org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
 at
 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
 at java.lang.Thread.run(Unknown Source)
 
  I ran the query in  MySQL Command Line Client on both
 XP and Vista and they return identical results.
 
  Thanks
  Glyn
 
  -Original Message-
  From: Len Popp [mailto:[EMAIL PROTECTED]
  Sent: Sunday, August 03, 2008 11:31 AM
  To: Tomcat Users List
  Subject: Re: Problem with Displaying Result of a MySQL
 Join in