Re: Tomcat 5.5 and RMI

2008-10-27 Thread Johnny Kewl


- Original Message - 
From: Sven A [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Sunday, October 26, 2008 2:40 PM
Subject: Tomcat 5.5 and RMI




Hi,

I'm looking at options in running our standalone RMI application within a
servlet container since we're planning to build support for http. I'm
currently testing our app on Tomcat 5.5 and my question is if Tomcat by
default actually dispatch incoming RMI calls to different threads. Looking
at the server stats in Tomcat manager it doesn't seem to be the case in
terms of active number of threads etc.

My second question is if there are servlet containers out there that has
support for RMI connectivity and can dispatch incoming requests.

Thanks
S


Been there, done that ;)
Look at the link below...

eg I drop library (jar) into (harbor) servlet repository...

remote apps call it like this... in this case the class is called Factory, 
could be anything...


i_Factory = 
(I_Factory)vessel.loadRemoteClassInst(I_Factory.class,net.uitestapp.Factory);//load 
a class instance ON the harbor


i_Factory.DoSomeThing(Hello World); // etc etc local call against remote 
class


The calls are HTTP based...  no firewall problems...
Because HTTP every call is on its own thread...

If you want to share the class on multiple http threads... do the above with 
this call... loadRemoteSingleton


... combining remote apps with servlets and web services etc is all possible 
and easy.


And if you want to launch Swing apps or just the UI side of swing apps from 
tomcat and then make that talk to classes in tomcat, also very easy.

Its like Flex on steroids ;)

In the mailing lists we blabbing on about the financial crisis, ignore 
that Harbor hasnt fixed that yet ;)


Enjoy...

---
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
---
If you cant pay in gold... get lost...
http://coolharbor.100free.com/debt/usadebt.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: Tomcat 5.5 and RMI

2008-10-27 Thread Johnny Kewl


- Original Message - 
From: Johnny Kewl [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, October 27, 2008 4:02 PM
Subject: Re: Tomcat 5.5 and RMI




- Original Message - 
From: Sven A [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Sunday, October 26, 2008 2:40 PM
Subject: Tomcat 5.5 and RMI




Hi,

I'm looking at options in running our standalone RMI application within a
servlet container since we're planning to build support for http. I'm
currently testing our app on Tomcat 5.5 and my question is if Tomcat by
default actually dispatch incoming RMI calls to different threads. 
Looking

at the server stats in Tomcat manager it doesn't seem to be the case in
terms of active number of threads etc.

My second question is if there are servlet containers out there that has
support for RMI connectivity and can dispatch incoming requests.

Thanks
S


Been there, done that ;)
Look at the link below...

eg I drop library (jar) into (harbor) servlet repository...

remote apps call it like this... in this case the class is called Factory, 
could be anything...


i_Factory = 
(I_Factory)vessel.loadRemoteClassInst(I_Factory.class,net.uitestapp.Factory);//load 
a class instance ON the harbor


i_Factory.DoSomeThing(Hello World); // etc etc local call against remote 
class


The calls are HTTP based...  no firewall problems...
Because HTTP every call is on its own thread...


I'm told I should clarify this a little...
It works just like http requests work... Tomcat grabs a thread from the 
pool, this thread is used for the call, if the remote app makes many calls, 
the connection is held on a keep a live, so thread assignement is quick 
between calls... protocol is binary not soap so very quick.

If data packets are large, chunking and all that good stuff just happens...

I can remember the details off hand but that thread marshalling was 
extremely complex, I spent a good few weeks getting it right, else your 
class loaders are screwed and dont see each other properly which is what I 
think you asking...


So there you have it... to give you an idea of what you into... it took 3 of 
us 2 years to perfect ;)


But its free... you lucky ;)

---
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
---
If you cant pay in gold... get lost...
http://coolharbor.100free.com/debt/usadebt.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: Obfuscating a Servlet

2008-10-25 Thread Johnny Kewl


- Original Message - 
From: Jeng Yu [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Friday, October 24, 2008 12:28 PM
Subject: Obfuscating a Servlet



Hi All,

I just wanted to know if I can first obfuscate my
selvlet
with ProGuard before I deploy it in Tomcat
environment.

Will doing this really protect my servlet and make it
really difficult for someone to reverse engineer or
decompile it, as people seem to say?

Thank you.


Hi  Jeng,

Yes it does, it can be reverse engineered and you can try it yourself, its 
still there but where something was StoreNames is now just a.
If they determined enough they will reverse engineer it, but on a large 
project its not easy to understand at all.
Put it this way, on large projects, I can reverse engineer it and make it 
run, but even though I wrote the code, I cant follow it anymore ;)


I do it on very large projects but for a different reason, it optimizes the 
code, and makes it smaller, sometimes the size savings are very good, half 
the size, good.


Its an art, you have to play... include all the TC libs, in the LIB section 
as well as the JRE, not the main section, this tells proguard not to mess 
with the interfaces.
Run it and see what breaks, if it does it means you may have to keep 
additional functions, and you must test really really well.
This is because proguard can guess wrong, because of things like late 
binding, introspection etc, proguard is damn good but there are somethings 
it just cant guess.


So the answer is yes, it works, but its not just a util that you run without 
thinking... by the time you are done, you are really going to understand 
your code, and will probably change the structure a few times, so that it 
optimizes well.


Obfuscating makes it difficult to follow but more important is that it 
teaches you about the code, for example it may throw out a whole library or 
part of one, that you thought you needed but didnt... you will spend hours 
on it, but on large jobs its worth it...


Obfuscating is not a replacement for security, like hiding a passwords in 
the code, thats a different technology.
Obfuscating is more about optimizing download sizes, than stopping hackers, 
thats why we use it.


Have Fun

---
HARBOR : http://www.kewlstuff.co.za/index.htm
---
If you cant pay in gold... get lost...
http://coolharbor.100free.com/debt/usadebt.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: Obfuscating a Servlet

2008-10-25 Thread Johnny Kewl

Hi  Jeng,

Yes it does, it can be reverse engineered and you can try it yourself, its 
still there but where something was StoreNames is now just a.
If they determined enough they will reverse engineer it, but on a large 
project its not easy to understand at all.
Put it this way, on large projects, I can reverse engineer it and make it 
run, but even though I wrote the code, I cant follow it anymore ;)


I do it on very large projects but for a different reason, it optimizes 
the code, and makes it smaller, sometimes the size savings are very good, 
half the size, good.


Its an art, you have to play... include all the TC libs, in the LIB 
section as well as the JRE, not the main section, this tells proguard not 
to mess with the interfaces.
Run it and see what breaks, if it does it means you may have to keep 
additional functions, and you must test really really well.
This is because proguard can guess wrong, because of things like late 
binding, introspection etc, proguard is damn good but there are somethings 
it just cant guess.


So the answer is yes, it works, but its not just a util that you run 
without thinking... by the time you are done, you are really going to 
understand your code, and will probably change the structure a few times, 
so that it optimizes well.


Obfuscating makes it difficult to follow but more important is that it 
teaches you about the code, for example it may throw out a whole library 
or part of one, that you thought you needed but didnt... you will spend 
hours on it, but on large jobs its worth it...


Obfuscating is not a replacement for security, like hiding a passwords in 
the code, thats a different technology.
Obfuscating is more about optimizing download sizes, than stopping 
hackers, thats why we use it.


Have Fun


Another tip, make you project into a LIB, and bring that into a skeleton 
webapp... so the webapp basically becomes a web.xml file and static data 
plus your lib... its a nice way to do it.

Then when you obfuse... you just working on normal Jars... its easier.

---
HARBOR : http://www.kewlstuff.co.za/index.htm
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---
If you cant pay in gold... get lost...
http://coolharbor.100free.com/debt/usadebt.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: How to serve two docBases under the same context path

2008-10-24 Thread Johnny Kewl


- Original Message - 
From: nlif [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Thursday, October 23, 2008 4:56 PM
Subject: How to serve two docBases under the same context path




Hi all,

I am using Tomcat 6, and I have the following problem:

I am trying to separate the static content from the dynamic content of my
application. In production, I intend to use Apache to serve the static
content, and Tomcat to process requests to the application (mainly JSP's).
This can be accomplished by writing a deployment script that will copy
everything to its repsective place.

My problem, however, is with the development environment:

The static-content (css,js,images,html) is in one SVN project, and the
dynamic (JSP,WEB-INF,classes) is in another. Thus, on my local workspace,
they are on separate paths (e.g. c:\workspace\static and
c:\workspace\webapp). Now, I need some way to have Tomcat serve them as a
single context.

I thought I'd create two context elements in my server.xml file, but 
they

will need to have the same PATH, like this:

Context docBase=workspace\static path=/myapp/
Context docBase=workspace\webapp path=/myapp/

Unfortunately, it is illegal to have two CONTEXT elements with the same 
PATH

value.


nlif, if your framework allows for this, this is what we do...
Think of URLs like this

a href=%=request.getContextPath()%/pathTo/myThing.htmlView My 
Thing/a


and then it becomes fairly easy to do something like

a href=%=aBean.adjustURL(request,pathTo/myThing.html)%View My 
Thing/a


I normally use a parameter init in a servlet to set the base contexts I 
want.
Its not unlike the filter idea mentioned which is what I think you may have 
to do if you cant do the above.


The thing is that now we just design the web app and let TC serve the static 
stuff in *one* webapp.
But changing a param in web.xml lets us move the static resources to 
anywhere, later.


So adjustURL is basically saying
If external context is null then use request.getContextPath
else if html do this thing etc.
else if jpg do that thing etc.

I use a bean via an attribute which is easy to do outside of frameworks, you 
may find a static (thread safe) adjustURL  is easier, and decide to wrap the 
idea up in EL or a special tag handler.


I dont use tags and EL but it may be a cool thing to try...

with a static class it would prbably look like
a href=%=packag.name.adjustURL(request,pathTo/myThing.html)%View My 
Thing/a


with EL something like
a href=${my:adjustURL(request,pathTo/myThing.html)}View My Thing/a

with tags (big guess here) something like
MY:a href =/pathTo/myThing.htmlView My Thing/MY:a
which could be a very cool thing if I knew how to do it ;)

Hope that idea helps... TC has got all this cool powerful stuff, maybe worth 
giving it a try ;)


---
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
---
If you cant pay in gold... get lost...
http://coolharbor.100free.com/debt/usadebt.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: tomcat 6 and subdirectories

2008-10-16 Thread Johnny Kewl


- Original Message - 
From: Angelov, Rossen [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, October 15, 2008 8:29 PM
Subject: tomcat 6 and subdirectories



Hi,

I recently started using Tomcat 6 but can't configure it to map
subdirectories to same servlet within the default context. I didn't have
problems with the same setup in Tomcat 5.

Here is an example.

http://mysite/test.html - maps to the application servlet and works as
expected
http://mysite/directory/test.html - doesn't maps to the application
servlet and fails to display correctly

The second link works only after I create an additional context, but
it's not an acceptable solution because there are many directories in
application base.

Context path=directory docBase= /

In web.xml I have the following servlet mapping:

servlet-mapping
  servlet-nameappServlet/servlet-name
  url-pattern*.html/url-pattern
/servlet-mapping

I tried different url patters to match subdirectories, but neither one
worked:
url-pattern/*/url-pattern
url-pattern/directory/*/url-pattern
url-patterndirectory/*/url-pattern


Ross Try
   servlet-mapping
   servlet-nameappServlet/servlet-name
   url-pattern*.htm/url-pattern
   /servlet-mapping
   servlet-mapping
   servlet-nameappServlet/servlet-name
   url-pattern/directory/*/url-pattern
   /servlet-mapping

ie just map it more than once
I havnt noticed a change in behaviour between TC's... using the multi 
mapping idea above, maybe some other subtle thing happening as well...


---
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
---
If you cant pay in gold... get lost...
http://coolharbor.100free.com/debt/usadebt.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: Appeal to Tomcat developers

2008-10-16 Thread Johnny Kewl


- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Thursday, October 16, 2008 9:23 AM
Subject: Appeal to Tomcat developers



Dear Tomcat developers,

this is a humble appeal.
I know I have in the past been over the top on this subject, and for 
that I apologise.


The appeal is about Tomcat logging.

I will venture a few risky bets :
1) for every Tomcat used in a development context, there are 100 used in a 
production environment

2) for every Tomcat developer, there are 1000 Tomcat users
3) for at least 900 out of these 1000 Tomcat users, the current way to 
configure/manage Tomcat logging is too difficult to understand


I think you just anti tomcat... you got a bad attitude ;)

You always ask so nicely, how can they refuse you ;)

Andre I feel the same way... Tomcat is magic, but I think the logging sucks.
You on linux, wait till you on windows and the file wont even opne because 
TC is using it.
And files that carry date stamps... makes it difficult to find stuff and 
tell another program to use it, it doesnt even know the name.


The thing that has alway amazed me... we use JMX, we have this complex 
logging engine, but tomcat is a big powerful web server... is it only me, 
but how come that cant be presented as a web page you just address 
/myserver/manager/logs

Or /myserver/manager/JMXStuff

I also think its a missed opportunity... its like you built a ferrari, but 
still use a wheel barrow to go get stuff from the shop... if you know what I 
mean.


... theres probably a good reason for it but yes
+1

---
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
---
If you cant pay in gold... get lost...
http://coolharbor.100free.com/debt/usadebt.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: Appeal to Tomcat developers

2008-10-16 Thread Johnny Kewl


- Original Message - 
From: Johnny Kewl [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Thursday, October 16, 2008 10:01 AM
Subject: Re: Appeal to Tomcat developers




- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Thursday, October 16, 2008 9:23 AM
Subject: Appeal to Tomcat developers



Dear Tomcat developers,

this is a humble appeal.
I know I have in the past been over the top on this subject, and for 
that I apologise.


The appeal is about Tomcat logging.

I will venture a few risky bets :
1) for every Tomcat used in a development context, there are 100 used in 
a production environment

2) for every Tomcat developer, there are 1000 Tomcat users
3) for at least 900 out of these 1000 Tomcat users, the current way to 
configure/manage Tomcat logging is too difficult to understand


BTW Andre, its not just a TC thing, its the whole Java logging thing, its 
unduely complex, so I actually think TC inhereted Java's logging history.
If you know how to make a little singleton, its really is not difficult 
adding a little logging to your servlets, with a tiny little 30 line class.

That also displays as a HTML page... thats what we do...

---
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
---
If you cant pay in gold... get lost...
http://coolharbor.100free.com/debt/usadebt.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: Socket error

2008-10-15 Thread Johnny Kewl


- Original Message - 
From: Rathiika [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Wednesday, October 15, 2008 10:37 AM
Subject: Re: Socket error




Thanks Johny !!! for prompt response.

I have checked my code, i am sure there is no problem with xml parsers.

I am able to solve the FileNotFoundException, but sockettimeoutexception 
is

still coming.

I tried to change the timestamp in my appl, but no use.

regards,

Rathiika

---
Rathiika, I dont know, cant get my mind around what it is u actually 
doing seems like a web service and in there you doing a call to another 
server...
You were also getting null pointer exceptions all over the place... at every 
parser...
That socket error seems to be saying the thing you calling is never 
answering... and it happens many times, maybe diff web services?


Maybe the thing to do is watch the other side, the thing you calling into... 
maybe getting stuck somewhere.

Sorry, its not jumping out and grabbing me ;)

---
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
---
If you cant pay in gold... get lost...
http://coolharbor.100free.com/debt/usadebt.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: Installing another jdk while tomcat is running

2008-10-15 Thread Johnny Kewl


- Original Message - 
From: nashrul [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Wednesday, October 15, 2008 6:03 AM
Subject: Installing another jdk while tomcat is running




I have jdk 1.4 and 1.5 installed and tomcat 5.0 running. I downloaded jdk 
1.6
and I want to install this jdk while the tomcat is running (for some 
reasons

I couldn't shut down the tomcat). Is this OK if I do this ? Does jdk
installation not interfere with the running tomcat ??
Thanks...


Should not be a problem, just dont replace the old JRE, put the new one in 
another folder.
Then... next time you start up tomcat you tell it to use the new JDK... or 
not.


Its actually a good way to work... have a JRE or JDK in a non standard 
folder, that is dedicated to your server... esp if you also developing on 
the machine.
You can have as many JDK/JREs as you want, and if you developing, you should 
keep all the old ones anyway... so you can test software against diff 
engines.


The only problem is if you in stall multiple versions of the same JRE 
version... on windows anyway same version JRE's interfere with each other, 
but diff versions are ok.


By the way... if you already using the TC in production... get another one 
of those as well... dont develop against your production TC.


---
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
---
If you cant pay in gold... get lost...
http://coolharbor.100free.com/debt/usadebt.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: Socket error

2008-10-14 Thread Johnny Kewl


- Original Message - 
From: Rathiika [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Tuesday, October 14, 2008 8:41 AM
Subject: Socket error




I am getting this error.

   at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
   at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
   at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
   at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
   at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
   at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
   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:151)
   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(Thread.java:595)
2008-10-14 11:54:52 (StandardWrapperValve.java:253) ERROR
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost]
.[/EE-GUI].[action]] Servlet.service() for servlet action threw exception
java.lang.NullPointerException
   at
org.kaizen.eagleeye.gui.startup.EEServiceAxiomXmlProcessor.parseResponseXml(Unknown
Source)
   at org.kaizen.eagleeye.gui.user.login.LoginAction.execute(Unknown
Source)
   at
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
   at
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
   at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
   at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
   at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
   at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
   at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
   at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
   at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
   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:151)
   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(Thread.java:595)
2008-10-14 11:54:57 (RESTSender.java:279) ERROR
[org.apache.axis2.transport.http.RESTSender] Error in processing POST re
quest
java.net.SocketTimeoutException: Read timed out
   at 

[OT] Down Turn

2008-10-14 Thread Johnny Kewl
The NB and TC mailing list volumes have dropped off alot, but I just wanted 
to say that before you think its a product thing, it is not.
I'm a member of many other mailing lists and some of those have all but 
stopped, the fact the NB and TC are moving at all is testament to the 
products.


So stay calm, dont panic, its not your products.
Only Viagra spam, the Wall street complaints line, and Alcoholics Anonymous 
are more active ;)


If you want to see the reason why our fun with technology is experiencing a 
down turn, look at this.


http://coolharbor.100free.com/debt/usadebt.htm

I vote for a geeks having fun bail out package
 on a more serious note, that link is frightening.

Just thought geeks may wonder why we all in damn slow motion at the 
moment...
I think we should make some special software for bankers, a high voltage 
cell phone, it shocks the %$* out of them when they cocking up ;)


---
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
---
If you cant pay in gold... get lost...


-
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 : encounter java.net.SocketTimeoutException: Read timed out occasionally

2008-10-13 Thread Johnny Kewl


- Original Message - 
From: James Wang [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, October 13, 2008 7:11 AM
Subject: Re: question : encounter java.net.SocketTimeoutException: Read 
timed out occasionally




Hi Mark,

In order to find out if the problem of Request.getParameter(parm) return
null (missing post
body part) is related to http keep-alive,  We've tried to reduce
the KeepaliveTimeout setting in
Apache httpd server from 15 seconds to 5 seconds,  the strange thing
happened, We found
the null parameter count was raised from 400/per-day (in average) to 900
times/per-day.
The next step we are going to disable the keep-alive and see what will
happen, will let you
know the result for reference.

If disabling keeplive could resolve this problem, the mysterious part then
is why the
the browser get stuck on uploading the post body part always.


James, what is actually doing the post?... Ajax?
Look I dont know, but it smells like a data size problem...
Something like a header size is saying... you going to get 500 bytes and 
only 499 come in... so now the browser is waiting for the stupid server to 
reply, and the server thinks the stupid browser is just slow... eventually 
TCP sockets say... good bye, you guys are just too slow.
So socket time out, I think, is not the real issue... some header size is 
wrong... maybe something subtle like its multibyte and the header size is 
calculating bytes.
If you click twice and then the 1st param comes in... it sounds very much 
like a header size calc is out...

I dont know... but thats what I'd be looking for...

---
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
---
If you cant pay in gold... get lost...




-
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 : encounter java.net.SocketTimeoutException: Read timed out occasionally

2008-10-13 Thread Johnny Kewl


- Original Message - 
From: James Wang [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, October 13, 2008 11:35 AM
Subject: Re: question : encounter java.net.SocketTimeoutException: Read 
timed out occasionally




Hi Johnny,

Yes, We are using ajax to make the post requests, and the header do 
include

content-length information that was calculated by ajax automatically, but
the
strange thing is sometime it get stuck at the begin of uploading http 
body(0

byte
was transfered always in this case) until AJP connector timeout, actually 
we

have revised a little bit on tomcat source code, below is our finding we
made
the change on org.apache.catalina.connector.Request.java for your 
reference

:

protected void parseParameters() {

   :  :   :  :
   :  :   :  :

   if (actualLen == len) {
   parameters.processParameters(formData, 0, len);
   }
   else { // added by me
   context.getLogger().error(formData Len error len : +
len +   actualLen : + actualLen);
   }
   } catch (Throwable t) {
   context.getLogger().warn
   (sm.getString(coyoteRequest.parseParameters), t);
   }
   }

   }

Following was the Tomcat log, actualLen always return 0,
the first line showing the content-length is 32 but the returned
actual length is 0.

SEVERE: formData Len error len :32  actualLen :0
SEVERE: formData Len error len :379  actualLen :0
SEVERE: formData Len error len :32  actualLen :0
SEVERE: formData Len error len :41  actualLen :0
SEVERE: formData Len error len :60  actualLen :0
SEVERE: formData Len error len :74  actualLen :0
SEVERE: formData Len error len :145  actualLen :0
SEVERE: formData Len error len :60  actualLen :0

Thanks  Best Regards.
James Wang
On Mon, Oct 13, 2008 at 4:34 PM, Johnny Kewl [EMAIL PROTECTED] wrote:


James... dont know... couple of thing you can do... get wire shark and 
actually watch whats on the wire... if the header is coming in and no body 
is sent, it aint tomcat...
My Ajax is stale... if you doing it yourself, then its very like a 
javascript issue cant remember details but its not unusual in the Ajax 
stuff to see...

... if(IE) do it all different...
... I think you working on the wrong side... its that Ajax, is my guess

My guess is that it works with Firefox perfectly... but not on IE and you 
dont have a debugger for that... welcome to Javascript ;) on diff browsers 
its a nightmare ;)

Good luck, or maybe post the Ajax snippet and see if the guys can spot it...

---
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
---
If you cant pay in gold... get lost...



-
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 : encounter java.net.SocketTimeoutException: Read timed out occasionally

2008-10-13 Thread Johnny Kewl


- Original Message - 
From: Johnny Kewl [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, October 13, 2008 10:34 AM
Subject: Re: question : encounter java.net.SocketTimeoutException: Read 
timed out occasionally





- Original Message - 
From: James Wang [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, October 13, 2008 7:11 AM
Subject: Re: question : encounter java.net.SocketTimeoutException: Read 
timed out occasionally




Hi Mark,

In order to find out if the problem of Request.getParameter(parm) 
return

null (missing post
body part) is related to http keep-alive,  We've tried to reduce
the KeepaliveTimeout setting in
Apache httpd server from 15 seconds to 5 seconds,  the strange thing
happened, We found
the null parameter count was raised from 400/per-day (in average) to 900
times/per-day.
The next step we are going to disable the keep-alive and see what will
happen, will let you
know the result for reference.

If disabling keeplive could resolve this problem, the mysterious part 
then

is why the
the browser get stuck on uploading the post body part always.


James, what is actually doing the post?... Ajax?
Look I dont know, but it smells like a data size problem...
Something like a header size is saying... you going to get 500 bytes and 
only 499 come in... so now the browser is waiting for the stupid server to 
reply, and the server thinks the stupid browser is just slow... eventually 
TCP sockets say... good bye, you guys are just too slow.
So socket time out, I think, is not the real issue... some header size is 
wrong... maybe something subtle like its multibyte and the header size is 
calculating bytes.
If you click twice and then the 1st param comes in... it sounds very much 
like a header size calc is out...

I dont know... but thats what I'd be looking for...


Another thing you can try... if its Ajax, is set it to http1.0
It will work... but there will be some data missing...
Then you'll know for sure its a data size issue...

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
---
If you cant pay in gold... get lost... 



-
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 to tomcat redirect.

2008-10-10 Thread Johnny Kewl


- Original Message - 
From: Rohan7 [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Friday, October 10, 2008 8:02 AM
Subject: tomcat to tomcat redirect.




Hi All,
 I'm using tomcat 5.5 . I'm using public IP- 
http://1.2.3.4:8084/Project/.

Now the similar instance is running on the
internal IP. http ://192.168.100.102:8080/Project/.

My question is - Can I redirect from http://1.2.3.4:8084/Project/  to http
://192.168.100.102:8080/Project/ ?

Please help me for the same.

Thnaks
Rohan7


Hi Rohan,

Not sure if you asking how to set TC if so look at the connector in 
server.xml...
Or if you want to do an actual redirect in your app... 
response.sendRedirect(newUrl);


---
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
---
If you cant pay in gold... get lost... 



-
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: Communicating between webapps

2008-10-09 Thread Johnny Kewl


- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Thursday, October 09, 2008 9:59 AM
Subject: Re: Communicating between webapps



Hi.
This is not my thread, so if anyone thinks I'm pushing the envelope a 
bit, tell me and I'll start another one.

I am interested in this same issue, but in a broader sense :
how to share some data, in general, between collaborating webapps within 
the same container.


My case goes somewhat like this :  an application consisting of several 
webapps needs access to some common data (read/write).
Each webapp can modify this data, and the changes should be immediately 
visible to the other webapps.

The data is originally loaded and parsed from a disk file, expensively.
I would like to avoid each individual webapp to have to reload and reparse 
this data each time it needs to access it.
In other words, a kind of global in-memory DB is what I'm looking for, 
where individual webapps can create/modify/read/delete records with 
known keys, in shared mode.


I believe that this would also cover the requirements of the OP, although 
it's probably more than he needs.


I realise that this can be done via e.g. an external DB.
It could also probably be done, most portably, by creating an entirely 
separate application accessed via HTTP calls e.g. (à la Amazon DB ?).
But it looks as if within the same container, it would be much more 
efficient if kept in local memory, and avoiding overhead like TCP/IP or 
JDBC or RMI.


Not being an expert in any of the underlying matters, I would just like to 
know from the eperts here, but preferably without too many difficult words 
like classloader and dispatchers, if this is in theory 
possible/allowed, if it could be done in such a way as to be portable to a 
different container etc..


There is an Application Server like this... its mine... ha ha... but is not 
open soure... awe gee...
Has to be classified as new because we little guys... no onsite Java 
campus here ;)


We use it to do exactly this kind of thing... I'm proud of it, and it has 
become our core internal tool of choice... but only use it in experimental 
stuff.


Its a webapp... so you drop it into any Tomcat...
Its not bean based, it runs applications...

In your case this is what we would do...

Make the Java Lib... test it in your webapp as normal...

When you ready drop it nto the Harbor webapp...
Then in any Tomcat that wants to use it...

   vessel = new Vessel(URL OF HARBOR TOMCAT);
   i_MailEngine = 
(I_MailEngine)vessel.loadRemoteSingleton(I_MailEngine.class,kewlstuff.harbor.mailer.MailEngine,APP_ID);



... use that class eg

   i_MailEngine.Send(message); // etc

Like RMI and all the rest its doing serialization and typically one has to 
know how to use an interface with a class... but thats it.


If we did this

   Class uiApp = vessel.getRemoteClass(kewlstuff.mailer.test.ui.UI);

Then that class runs on the users machine... so even our Swing apps now live 
in Tomcat...


Its like RMI but my baby runs full applications for example in one app 
we have, we load up a client side, that actually uses a complete H2 dB... on 
the client (not installed on the client) and we leave the Postgres side on 
the server... all still works as one app ;)


Andre all these tools are on the EJB spectrum... thats where you actually 
going...

RMI is remote procedure calls
EJB is RMI with Beans
PAS (my baby) is remote applications.

The PAS is http based thus no Registry stuff needed... it addresses in the 
same way the internet does... so there are differences, but underneath its 
all much of the same core technologies... sockets are talking, data is 
serializing, classes are moving over the wire... yada yada


RMI and My Baby are binary based... and that why they kick a web services 
butt (SOAP is wrapped in XML) its got to translate images to text and and 
and...
But Soap will work between .Net and Java... in theory anyway... the PAS is 
Java only...


These tools work across the world... doesnt have to be in the same TC... if 
it is, then all this stuff reduces to a little old Class (or the lesser 
bean) in little old Java.


You have to study the stuff out there... and you need to try them... I 
remember rushing out years ago, and getting all excited about SOAP (web 
services)... damn that is slow... the answer is always... it depends...


I'm very much for the KISS principle... if you dont need it, dont use it... 
nothing is more powerful that POJO (plain old Java).
Thing is KISS does not mean novice... you'll find only the guys that have 
been around for a while can really KISS ;)


Have fun... study em all...

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

Re: Communicating between webapps

2008-10-09 Thread Johnny Kewl


- Original Message - 
From: Leon Rosenberg [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Thursday, October 09, 2008 9:54 PM
Subject: Re: Communicating between webapps



On Thu, Oct 9, 2008 at 7:16 PM, Johnny Kewl [EMAIL PROTECTED] wrote:


I'm very much for the KISS principle... if you dont need it, dont use 
it...

nothing is more powerful that POJO (plain old Java).
Thing is KISS does not mean novice... you'll find only the guys that have
been around for a while can really KISS ;)



just a side note Johnny,
you need a container for something that can be done without, how is that 
KIS(S)?


I'm just saying that I think a lot of time people lock themselves into 
complex technology, additional containers, whatever, and if they had just 
thought about it, done it slightly differently, they would have done it all 
in a little old webapp...
Not into driving a CV and sending poor admin people to the funny farm... 
kind of thing.
Simple as possible is best... if you dont have to use an additional 
container, dont, whether that be mine or yours... I think


---
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
---
If you cant pay in gold... get lost... 



-
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: Communicating between webapps

2008-10-08 Thread Johnny Kewl


- Original Message - 
From: Darryl Pentz [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, October 08, 2008 10:02 PM
Subject: Re: Communicating between webapps



Bill,

You would think so but it isn't that easy. Which is good to some degree, 
because that would seem like a scary security vulnerability. Nevertheless, 
besides that, Tomcats classloader hierarchy also prevents this mechanism.


It would be useful if there was some form of publish-subscribe message bus 
that one could, well, publish or subscribe to. I realize that JMS falls 
into this category, but JMS is overkill to what I'm referring to.


I recall using a message bus type of approach in a Swing application many 
moons ago. Forget the name of the library now. Had 'bus' in its name, 
perhaps somebody here knows.


Anyway, from the responses one can tell this isn't an easy peasy no 
brainer. *shrug*


- Original Message 
From: Bill Davidson [EMAIL PROTECTED]

Since you're running in the same JVM, I'm not sure why you
can't set up some sort of observer-subject scheme (kind of
like ActionListener if you're familiar with that) so that the apps
can just access each other's object directly.  You can set up a
singleton object to register the observers between webapps.
Just be sure to synchronize properly.


What Bill is suggesting is not that difficult... but then its probably 
because we thinking outside of your framework...


Have you looked at this sort of stuff...

   ServletContext ctx = 
getServletContext().getContext(/someOtherContext);

   RequestDispatcher rd = ctx.getNamedDispatcher(servlet-name);
   rd.forward(request, response);

Cookies dont go with it... but you can play with attributes

   ServletContext myContext = getServletContext();
   String url = /someWebAppPrefix;
   ServletContext otherContext = myContext.getContext(url);
   Object someData = otherContext.getAttribute(someKey);

This is just stuff I grabbed... not flowing code that I've tried... but in 
kinda sounds like you want to forward across webapps??


Req into A... do some stuff set some data tell some servlet in 
webapp B to process it and return the response... ?


... maybe...

If you really get writers block... or it starts getting really ugly... 
normally means the architecture is screwed somewhere...

Do they have to be separate webapps... etc?

... good luck...

---
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
---
If you cant pay in gold... get lost... 



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

2008-10-07 Thread Johnny Kewl


- Original Message - 
From: Rusty Wright [EMAIL PROTECTED]
To: Markus Lord [EMAIL PROTECTED]; Tomcat Users List 
users@tomcat.apache.org

Sent: Tuesday, October 07, 2008 11:31 PM
Subject: Re: tomcat ROOT


Hi Markus, did you ever figure this out?  I was looking in the archives of 
the tomcat mailing list and saw your query but it didn't seem to me that 
anyone answered it fully, at least not for me.


I figured out that I could remove/rename the webapps/ROOT directory and 
deploy my war file as ROOT.war and then it would replace tomcat's web page 
at http://www.myhost.edu/ but I also have apache in front of tomcat and I 
don't understand how to set up the jkmount in my httpd.conf file to map 
apache's root to tomcat's root.


Yes renaming a webapp to ROOT with a empty context path, makes it run as the 
root...


Then...

JkMount /  worker1

Should make apache send it to your tomcat root

---
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: Too many open files

2008-10-07 Thread Johnny Kewl


- Original Message - 
From: Mohit Anchlia [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, October 07, 2008 11:44 PM
Subject: Too many open files



Tomcat throws too many open files and when I do lsof I get bunch of:

java14130 root  935u  IPv4 30842592   TCP
localhost:41971-localhost:http (CLOSE_WAIT)
java14130 root  937u  IPv4 30841213   TCP
efeitws3.ptctax.intuit.com:41161-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  938u  IPv4 30841214   TCP
localhost:41162-localhost:http (CLOSE_WAIT)
java14130 root  939u  IPv4 30841220   TCP
localhost:41165-localhost:http (CLOSE_WAIT)
java14130 root  940u  IPv4 30842516   TCP
localhost:41927-localhost:http (CLOSE_WAIT)
java14130 root  941u  IPv4 30841226   TCP
localhost:41168-localhost:http (CLOSE_WAIT)
java14130 root  943u  IPv4 30841899   TCP
efeitws3.ptctax.intuit.com:41566-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  944u  IPv4 30841694   TCP
efeitws3.ptctax.intuit.com:41453-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  945u  IPv4 30841695   TCP
localhost:41454-localhost:http (CLOSE_WAIT)
java14130 root  946u  IPv4 30841900   TCP
localhost:41567-localhost:http (CLOSE_WAIT)
java14130 root  948u  IPv4 30842415   TCP
efeitws3.ptctax.intuit.com:41864-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  949u  IPv4 30842416   TCP
localhost:41865-localhost:http (CLOSE_WAIT)
java14130 root  950u  IPv4 30842419   TCP
localhost:41867-localhost:http (CLOSE_WAIT)
java14130 root  952u  IPv4 30850596   TCP
localhost:42484-localhost:http (CLOSE_WAIT)
java14130 root  953u  IPv4 30842760   TCP
localhost:42058-localhost:http (CLOSE_WAIT)
java14130 root  954u  IPv4 30842596   TCP
localhost:41974-localhost:http (CLOSE_WAIT)
java14130 root  956u  IPv4 30842093   TCP
localhost:41676-localhost:http (CLOSE_WAIT)
java14130 root  957u  IPv4 30842195   TCP
efeitws3.ptctax.intuit.com:41737-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  958u  IPv4 30841730   TCP
localhost:41467-localhost:http (CLOSE_WAIT)
java14130 root  959u  IPv4 30841737   TCP
localhost:41472-localhost:http (CLOSE_WAIT)
java14130 root  960u  IPv4 30842196   TCP
localhost:41738-localhost:http (CLOSE_WAIT)
java14130 root  961u  IPv4 30842528   TCP
localhost:41933-localhost:http (CLOSE_WAIT)
java14130 root  962u  IPv4 30842363   TCP
localhost:41836-localhost:http (CLOSE_WAIT)
java14130 root  964u  IPv4 30842365   TCP
efeitws3.ptctax.intuit.com:41837-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  965u  IPv4 30842366   TCP
localhost:41838-localhost:http (CLOSE_WAIT)
java14130 root  966u  IPv4 30842367   TCP
localhost:41839-localhost:http (CLOSE_WAIT)
java14130 root  967u  IPv4 30842371   TCP
localhost:41841-localhost:http (CLOSE_WAIT)
java14130 root  968u  IPv4 30842465   TCP
localhost:41895-localhost:http (CLOSE_WAIT)
java14130 root  969u  IPv4 30848501   TCP
localhost:42415-localhost:http (CLOSE_WAIT)
java14130 root  970u  IPv4 30842533   TCP
localhost:41936-localhost:http (CLOSE_WAIT)
java14130 root  971u  IPv4 30842468   TCP
localhost:41898-localhost:http (CLOSE_WAIT)
java14130 root  972u  IPv4 30842534   TCP
localhost:41937-localhost:http (CLOSE_WAIT)
java14130 root  973u  IPv4 30842765   TCP
localhost:42062-localhost:http (CLOSE_WAIT)
java14130 root  974u  IPv4 30842472   TCP
localhost:41901-localhost:http (CLOSE_WAIT)
java14130 root  975u  IPv4 30842122   TCP
localhost:41694-localhost:http (CLOSE_WAIT)
java14130 root  976u  IPv4 30842123   TCP
localhost:41695-localhost:http (CLOSE_WAIT)
java14130 root  977u  IPv4 30843217   TCP
localhost:42188-localhost:http (CLOSE_WAIT)
java14130 root  978u  IPv4 30842125   TCP
localhost:41696-localhost:http (CLOSE_WAIT)
java14130 root  979u  IPv4 30842126   TCP
efeitws3.ptctax.intuit.com:41697-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  981u  IPv4 30842128   TCP
efeitws3.ptctax.intuit.com:41698-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  982u  IPv4 30842129   TCP
localhost:41699-localhost:http (CLOSE_WAIT)
java14130 root  983u  IPv4 30888558   TCP
localhost:43218-localhost:http (CLOSE_WAIT)
java14130 root  984u  IPv4 30842617   TCP
localhost:41986-localhost:http (CLOSE_WAIT)
java14130 root  985u  IPv4 30842618   TCP
efeitws3.ptctax.intuit.com:41987-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  986u  IPv4 30844067 

Re: Too many open files

2008-10-07 Thread Johnny Kewl


- Original Message - 
From: Johnny Kewl [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, October 08, 2008 1:56 AM
Subject: Re: Too many open files




- Original Message - 
From: Mohit Anchlia [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, October 07, 2008 11:44 PM
Subject: Too many open files



Tomcat throws too many open files and when I do lsof I get bunch of:

java14130 root  935u  IPv4 30842592   TCP
localhost:41971-localhost:http (CLOSE_WAIT)
java14130 root  937u  IPv4 30841213   TCP
efeitws3.ptctax.intuit.com:41161-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  938u  IPv4 30841214   TCP
localhost:41162-localhost:http (CLOSE_WAIT)
java14130 root  939u  IPv4 30841220   TCP
localhost:41165-localhost:http (CLOSE_WAIT)
java14130 root  940u  IPv4 30842516   TCP
localhost:41927-localhost:http (CLOSE_WAIT)
java14130 root  941u  IPv4 30841226   TCP
localhost:41168-localhost:http (CLOSE_WAIT)
java14130 root  943u  IPv4 30841899   TCP
efeitws3.ptctax.intuit.com:41566-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  944u  IPv4 30841694   TCP
efeitws3.ptctax.intuit.com:41453-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  945u  IPv4 30841695   TCP
localhost:41454-localhost:http (CLOSE_WAIT)
java14130 root  946u  IPv4 30841900   TCP
localhost:41567-localhost:http (CLOSE_WAIT)
java14130 root  948u  IPv4 30842415   TCP
efeitws3.ptctax.intuit.com:41864-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  949u  IPv4 30842416   TCP
localhost:41865-localhost:http (CLOSE_WAIT)
java14130 root  950u  IPv4 30842419   TCP
localhost:41867-localhost:http (CLOSE_WAIT)
java14130 root  952u  IPv4 30850596   TCP
localhost:42484-localhost:http (CLOSE_WAIT)
java14130 root  953u  IPv4 30842760   TCP
localhost:42058-localhost:http (CLOSE_WAIT)
java14130 root  954u  IPv4 30842596   TCP
localhost:41974-localhost:http (CLOSE_WAIT)
java14130 root  956u  IPv4 30842093   TCP
localhost:41676-localhost:http (CLOSE_WAIT)
java14130 root  957u  IPv4 30842195   TCP
efeitws3.ptctax.intuit.com:41737-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  958u  IPv4 30841730   TCP
localhost:41467-localhost:http (CLOSE_WAIT)
java14130 root  959u  IPv4 30841737   TCP
localhost:41472-localhost:http (CLOSE_WAIT)
java14130 root  960u  IPv4 30842196   TCP
localhost:41738-localhost:http (CLOSE_WAIT)
java14130 root  961u  IPv4 30842528   TCP
localhost:41933-localhost:http (CLOSE_WAIT)
java14130 root  962u  IPv4 30842363   TCP
localhost:41836-localhost:http (CLOSE_WAIT)
java14130 root  964u  IPv4 30842365   TCP
efeitws3.ptctax.intuit.com:41837-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  965u  IPv4 30842366   TCP
localhost:41838-localhost:http (CLOSE_WAIT)
java14130 root  966u  IPv4 30842367   TCP
localhost:41839-localhost:http (CLOSE_WAIT)
java14130 root  967u  IPv4 30842371   TCP
localhost:41841-localhost:http (CLOSE_WAIT)
java14130 root  968u  IPv4 30842465   TCP
localhost:41895-localhost:http (CLOSE_WAIT)
java14130 root  969u  IPv4 30848501   TCP
localhost:42415-localhost:http (CLOSE_WAIT)
java14130 root  970u  IPv4 30842533   TCP
localhost:41936-localhost:http (CLOSE_WAIT)
java14130 root  971u  IPv4 30842468   TCP
localhost:41898-localhost:http (CLOSE_WAIT)
java14130 root  972u  IPv4 30842534   TCP
localhost:41937-localhost:http (CLOSE_WAIT)
java14130 root  973u  IPv4 30842765   TCP
localhost:42062-localhost:http (CLOSE_WAIT)
java14130 root  974u  IPv4 30842472   TCP
localhost:41901-localhost:http (CLOSE_WAIT)
java14130 root  975u  IPv4 30842122   TCP
localhost:41694-localhost:http (CLOSE_WAIT)
java14130 root  976u  IPv4 30842123   TCP
localhost:41695-localhost:http (CLOSE_WAIT)
java14130 root  977u  IPv4 30843217   TCP
localhost:42188-localhost:http (CLOSE_WAIT)
java14130 root  978u  IPv4 30842125   TCP
localhost:41696-localhost:http (CLOSE_WAIT)
java14130 root  979u  IPv4 30842126   TCP
efeitws3.ptctax.intuit.com:41697-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  981u  IPv4 30842128   TCP
efeitws3.ptctax.intuit.com:41698-10.10.81.94:webcache (CLOSE_WAIT)
java14130 root  982u  IPv4 30842129   TCP
localhost:41699-localhost:http (CLOSE_WAIT)
java14130 root  983u  IPv4 30888558   TCP
localhost:43218-localhost:http (CLOSE_WAIT)
java14130 root  984u  IPv4 30842617   TCP
localhost:41986

Re: video/x-flv mime-mapping does not for Tomcat 5.5

2008-10-07 Thread Johnny Kewl


- Original Message - 
From: Dave [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, October 07, 2008 11:03 PM
Subject: video/x-flv mime-mapping does not for Tomcat 5.5


we are using JBoss4.0.5. For flash video, we added

mime-mapping
extensionflv/extension
mime-typevideo/x-flv/mime-type
/mime-mapping

in tomcat conf/web.xml.

Restarted jboss. When uploading a foo.flv, uploadeFile.getContentType 
returns application/octet-stream, not video/x-flv. Could you please help 
me?


--

Hi Dave...

Dave not many clients  (I think can do FLV)... so your browser probabaly 
doesnt know what it is, so the server cant sent it... my guess...
I think flash files are actually WMV files and inside those files is the FLV 
format...
I know on windows we had to jump thru hoops to make FLV's work... just on 
their own...


I think you have to convert them to WMV's

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
---
If you cant pay in gold... get lost...








-
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: video/x-flv mime-mapping does not for Tomcat 5.5

2008-10-07 Thread Johnny Kewl


- Original Message - 
From: Johnny Kewl [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org; [EMAIL PROTECTED]
Sent: Wednesday, October 08, 2008 2:25 AM
Subject: Re: video/x-flv mime-mapping does not for Tomcat 5.5




- Original Message - 
From: Dave [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, October 07, 2008 11:03 PM
Subject: video/x-flv mime-mapping does not for Tomcat 5.5


we are using JBoss4.0.5. For flash video, we added

mime-mapping
extensionflv/extension
mime-typevideo/x-flv/mime-type
/mime-mapping

in tomcat conf/web.xml.

Restarted jboss. When uploading a foo.flv, uploadeFile.getContentType 
returns application/octet-stream, not video/x-flv. Could you please 
help me?


--

Hi Dave...

Dave not many clients  (I think can do FLV)... so your browser probabaly 
doesnt know what it is, so the server cant sent it... my guess...
I think flash files are actually WMV files and inside those files is the 
FLV format...
I know on windows we had to jump thru hoops to make FLV's work... just on 
their own...


I think you have to convert them to WMV's

Have fun...


SORRY NOT WMV. SWF
its late... waiting for presidential debate ;)

---
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
---
If you cant pay in gold... get lost... 



-
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: Too many open files

2008-10-07 Thread Johnny Kewl


- Original Message - 
From: Mohit Anchlia [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, October 08, 2008 2:11 AM
Subject: Re: Too many open files



I can see you can't wait to hear the debate. Anyhow, I am using
HttpClient from apache commons and I do have .getReleaseConnection().


The brain surgeons are arriving... 


... dont know if thats the cause but its possible
Set the instance to null...
HttpClient = null;

when you done with it... they may do the trick...

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
---
If you cant pay in gold... get lost...



-
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: Using tomcat to hold many open connections.

2008-10-06 Thread Johnny Kewl


- Original Message - 
From: uprooter [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Monday, October 06, 2008 6:48 PM
Subject: Re: Using tomcat to hold many open connections.




Thanks johnny.
Will TC can survive 20k polling clients ?


How much pipe do you have?
How real time do you want it?
Are you images displayed on google earth, or just 1 byte that represent on 
or off?


This is the design you have to do, this is the engineering you have to do... 
that will tell you how much pipe you need, TC is very likely not the 
restiriction, and if it was, you would use more than one.


Clients only poll for a specific item, if they open, if the user is on that 
view, and that in itself is no the issue normally... its a small question...
 have you got data for me? ... a few bytes... but then if you deliver 
google earth... thats the issue and there are other technologies here like 
ETAGS as work... ie if data has not changed... nothing is sent.


Thats the way it is... you are never going to be able to push to a client on 
a dail up for example... its the only way.


Server watches the machines close to perfect real time the web gets that 
as fast as the web allows... just think about your browser displaying 
video... theres a pragmatic limits, and thats what makes one solution well 
engineered and another a blindly applied technology, thats a disaster... you 
can make it good or you can make a terrible solution


Can you calculate the byte traffic?... that will tell you which way to go ;)
You got to engineer it... and becareful of all the IT spam out there, make 
sure you understand it...


Good Luck...

---
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: Using tomcat to hold many open connections.

2008-10-06 Thread Johnny Kewl


- Original Message - 
From: Kees Jan Koster [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, October 06, 2008 9:22 PM
Subject: Re: Using tomcat to hold many open connections.



Dear Uprooter,

I'm looking for a server that has to hold many (web services) remote 
clients

for controlling them.
I want to do things like sending power off command to a bunch of 
machines

remotely.


Building a botnet? :-)


The clients are usually windows machines behind firewalls  NAT or web
proxies that only allow HTTP (this is why I thought of webservices)

The regular request-response fashion that servlet follows  is not 
suitable

here since the initiator of the operation is the server.
What can I do in order to solve this and still use web services?


If you have the resources, you can just block in the servlet on your 
server. It's pretty expensive since Tomcat uses a thread per request I 
believe. Java threads are expensive (256kB each?), so that adds up 
quickly. You could spend some time tuning your thread stacks, though. 
Depending on your actual number of clients, you should be able to get 
this to work with a few GB of RAM.


But then, 20K client polling once an hour might be cheaper. You may  want 
to find a way to stagger the requests though.


--
Kees Jan


Yes Kees exactly... this is why I say engineer it... these guys find a 
hammer, and then everything look like a nail... ha ha
Without more details we cant engineer it... but I do think, web services are 
not the right tool, at most an addendum, not the core... and that there are 
two distinct processes at work, web side and machine side... they interface 
but cant be combined... to do this right, you got to be a good general 
coder...


---
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: adding servlet definition to context on the fly :Tomcat 5.5

2008-10-05 Thread Johnny Kewl


- Original Message - 
From: [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Sunday, October 05, 2008 7:12 AM
Subject: Re: adding servlet definition to context on the fly :Tomcat 5.5



Hi Johnny,

Th code i used is basically the one you have in your last email...
I have an app running in privileged mode, and it has to add a servlet
definition on the fly to another app...so in my app i call a method and
pass the description of the other application as well as the servlet
definition i want to add:

public void addServlet(WebAppConfiguration webApp, DeploymentDescriptor
descriptor) {
   org.apache.catalina.Server server = ServerFactory.getServer();
   String contextRoot = webApp.getContextRoot();
   Service[] services = server.findServices();
   Context context = null;
   String initParamName = descriptor.getInitParamName();
   String initParamValue = descriptor.getInitParamValue();
   String servletName = descriptor.getServletName();
   String servletClass = descriptor.getServletClass();

   for (int i = 0; i  services.length; i++) {
 Engine engine = (Engine) services[i].getContainer();
 Host host = (Host) engine.findChild(engine.getDefaultHost());
 context = (Context) host.findChild(contextRoot);
 if (context != null){
   break;
 }
   }
   if (context == null)
 return;
   StandardWrapper
   w = (StandardWrapper)context.createWrapper();
 w.setName(servletName);
 w.setServletName(servletName);

 w.setServletClass(servletClass);
 w.addInitParameter(initParamName, initParamValue);
 context.addChild(w);
 context.addServletMapping(descriptor.getUrlPattern(), servletName);
 }



ok now see what you up to... will give it a little try... stand back... 
doing a kidney transplant.. ha ha

---
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: adding servlet definition to context on the fly :Tomcat 5.5

2008-10-05 Thread Johnny Kewl


- Original Message - 
From: [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Sunday, October 05, 2008 7:12 AM
Subject: Re: adding servlet definition to context on the fly :Tomcat 5.5



Hi Johnny,

Th code i used is basically the one you have in your last email...
I have an app running in privileged mode, and it has to add a servlet
definition on the fly to another app...so in my app i call a method and
pass the description of the other application as well as the servlet
definition i want to add:


Ram... just want to understand the plain functionality...

You have one web app running... WebApp MAIN

Then you are able to drop another web app in WebApp EXTRA
You have some kind of invoker in MAIN, that you Add EXTRA servlets to.

So Main in the end is running EXTRA servlets that are dropped in late... 
neat idea.


Its not unlike the invoker servlet idea, but you working cross context and 
still have cool things available like init params...
Problem is that it heart surgery... which means normal debugging is an 
issue, thus the problem, its hard to see.


If this is the scheme?
I'm just wondering if maybe its something silly... like in the old TC you 
have crossContext=true setup, and thats not setup now...
I know Chuck always says... no more in servlet config, now must be in 
webapps... so just wondering if its forgotten or changed.

I'm thinking the classloaders will have to share if I get the overall idea.

???

---
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: adding servlet definition to context on the fly :Tomcat 5.5

2008-10-05 Thread Johnny Kewl


- Original Message - 
From: [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Sunday, October 05, 2008 7:12 AM
Subject: Re: adding servlet definition to context on the fly :Tomcat 5.5



Hi Johnny,

Th code i used is basically the one you have in your last email...
I have an app running in privileged mode, and it has to add a servlet
definition on the fly to another app...so in my app i call a method and
pass the description of the other application as well as the servlet
definition i want to add:


Ram... listen I got it going, but not on TC 5... it works on TC 6.
Got to tell you I cant see how this ever worked on TC 4 or 5... the reason 
is the class loader structure doesnt lend itself to it.
Webapps cant see the Container... so I'm wondering how you structured it 
without changing TC completely?

Possibly this code came out of an embedded app

Anyway... the tip is, if you want to make your life relatively easy... move 
to TC 6 its has a flat classloader structure, so you only got to jump thru a 
few hoops...
The code looks OK... but I'd suggest you add much more debugging points... 
so you can watch what its doing...


And then my first gut feel stands... I would much rather go for a 
specialized invoker type servlet with my own custom classloader... 
possibly too much work but a much better solution...


... if anyone knows how one can structure this sort of code in TC 4 or 5 
I'd luv to hear it.


But its an excellent idea... this idea of Servlet Injection or Servlet 
Late Binding... if there is anything out there that does this, I'd be keen 
to hear it.
Otherwise its something we going to add to the our PAS drop a servlet in 
one TC, it runs in others idea...

... thanks nice idea

Good Luck!


public void addServlet(WebAppConfiguration webApp, DeploymentDescriptor
descriptor) {
   org.apache.catalina.Server server = ServerFactory.getServer();
   String contextRoot = webApp.getContextRoot();
   Service[] services = server.findServices();
   Context context = null;
   String initParamName = descriptor.getInitParamName();
   String initParamValue = descriptor.getInitParamValue();
   String servletName = descriptor.getServletName();
   String servletClass = descriptor.getServletClass();

   for (int i = 0; i  services.length; i++) {
 Engine engine = (Engine) services[i].getContainer();
 Host host = (Host) engine.findChild(engine.getDefaultHost());
 context = (Context) host.findChild(contextRoot);
 if (context != null){
   break;
 }
   }
   if (context == null)
 return;
   StandardWrapper
   w = (StandardWrapper)context.createWrapper();
 w.setName(servletName);
 w.setServletName(servletName);

 w.setServletClass(servletClass);
 w.addInitParameter(initParamName, initParamValue);
 context.addChild(w);
 context.addServletMapping(descriptor.getUrlPattern(), servletName);
 }


---
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: adding servlet definition to context on the fly :Tomcat 5.5

2008-10-04 Thread Johnny Kewl


- Original Message - 
From: [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Saturday, October 04, 2008 5:34 PM
Subject: adding servlet definition to context on the fly :Tomcat 5.5



Hi,
I had written some code to dynamically add a servlet to a context in a
deployed applicaiton in Tomcat 4.1. This code basically uses the catalina
loader to obtain the server-engine-host-and context, and invokes the
addChild method after configuring a StandardWwrapper to represent the
servlet I am adding. This all works fine in Tomcat4.1 and I am able to
access the servlet through the right url immediately, without having to
restart Tomcat.


I'd luv to see that code... the stuff you playing with is in Tomcat core... 
must have been difficult to debug... perhaps its an embedded app?


But I think this answers your question...

   public void addChild(Container child) {

   throw new IllegalStateException
   (sm.getString(standardWrapper.notChild));

   }

   is what addChild now looks like in 6... if they did allow it, now they 
dont (;


Dont think you can blame TC... whoever made that app was doing open heart 
surgery ;)


I've never tried this, but its really interesting... I think I would start 
by having a good look at...


   HttpServlet source code... its an abstract class with a little 
introspection...


but I (think... maybe) that the way to go is to make a servlet... that does 
what HttpServlet servlet does... and then load your sevlet classes into your 
servlet... and call them...


I (think... maybe) maybe that it will come down to doing your own servlet 
mapping... and detection of new classes added... possibly your own uri to a 
manager function...


ie I think you can make a servlet intelligent enough to do this... without 
climbing into the engine and doing a liver transplant... and then because 
you now inside the official API... this will never happen again.


In the end it will be something like 
http://domain/contect/addons/ANY_ADD_ON_SERVLETS


... I'd give that a bash... dont think its a good idea trying the current 
method even if you do find an open vein ;)


Good Luck...

---
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: adding servlet definition to context on the fly :Tomcat 5.5

2008-10-04 Thread Johnny Kewl


- Original Message - 
From: Martin Gainty [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Saturday, October 04, 2008 11:39 PM
Subject: RE: adding servlet definition to context on the fly :Tomcat 5.5



doctor john

to followup with the addChild method and if an exception is thrown and you 
determine your container doesnt support child containers..what then?


your diagnosis doctor..

Martin
---
I dont know the history... too young to remember TC 4 ;)
He probably lost his call when filters or something like that was 
introduced... but heres the coders explanation, perhaps it makes sense to 
you...

I just looked at what he was calling before... and its gone ;)
addChild is still functional in container... but in wrapper its an 
exception... some history here somewhere... risk one takes if they work 
outside the intended API... unless that is in the servlet spec... doubt 
it...


/**
* A bWrapper/b is a Container that represents an individual servlet
* definition from the deployment descriptor of the web application.  It
* provides a convenient mechanism to use Interceptors that see every single
* request to the servlet represented by this definition.
* p
* Implementations of Wrapper are responsible for managing the servlet life
* cycle for their underlying servlet class, including calling init() and
* destroy() at appropriate times, as well as respecting the existence of
* the SingleThreadModel declaration on the servlet class itself.
* p
* The parent Container attached to a Wrapper will generally be an
* implementation of Context, representing the servlet context (and
* therefore the web application) within which this servlet executes.
* p
* Child Containers are not allowed on Wrapper implementations, so the
* codeaddChild()/code method should throw an
* codeIllegalArgumentException/code.
*
* @author Craig R. McClanahan
* @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 
oct. 2006) $

*/

.



From: [EMAIL PROTECTED]
To: users@tomcat.apache.org
Subject: Re: adding servlet definition to context on the fly :Tomcat 5.5
Date: Sat, 4 Oct 2008 21:20:39 +0200


- Original Message - 
From: [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Saturday, October 04, 2008 5:34 PM
Subject: adding servlet definition to context on the fly :Tomcat 5.5


 Hi,
 I had written some code to dynamically add a servlet to a context in a
 deployed applicaiton in Tomcat 4.1. This code basically uses the 
 catalina

 loader to obtain the server-engine-host-and context, and invokes the
 addChild method after configuring a StandardWwrapper to represent the
 servlet I am adding. This all works fine in Tomcat4.1 and I am able to
 access the servlet through the right url immediately, without having to
 restart Tomcat.

I'd luv to see that code... the stuff you playing with is in Tomcat 
core...

must have been difficult to debug... perhaps its an embedded app?

But I think this answers your question...

public void addChild(Container child) {

throw new IllegalStateException
(sm.getString(standardWrapper.notChild));

}

is what addChild now looks like in 6... if they did allow it, now they
dont (;

Dont think you can blame TC... whoever made that app was doing open heart
surgery ;)

I've never tried this, but its really interesting... I think I would start
by having a good look at...

HttpServlet source code... its an abstract class with a little
introspection...

but I (think... maybe) that the way to go is to make a servlet... that 
does
what HttpServlet servlet does... and then load your sevlet classes into 
your

servlet... and call them...

I (think... maybe) maybe that it will come down to doing your own servlet
mapping... and detection of new classes added... possibly your own uri to 
a

manager function...

ie I think you can make a servlet intelligent enough to do this... without
climbing into the engine and doing a liver transplant... and then because
you now inside the official API... this will never happen again.

In the end it will be something like
http://domain/contect/addons/ANY_ADD_ON_SERVLETS

... I'd give that a bash... dont think its a good idea trying the current
method even if you do find an open vein ;)

Good Luck...

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



_
Get more out 

Re: adding servlet definition to context on the fly :Tomcat 5.5

2008-10-04 Thread Johnny Kewl


- Original Message - 
From: Johnny Kewl [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Sunday, October 05, 2008 5:40 AM
Subject: Re: adding servlet definition to context on the fly :Tomcat 5.5




- Original Message - 
From: Martin Gainty [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Saturday, October 04, 2008 11:39 PM
Subject: RE: adding servlet definition to context on the fly :Tomcat 5.5



doctor john

to followup with the addChild method and if an exception is thrown and you 
determine your container doesnt support child containers..what then?


your diagnosis doctor..

Martin
---
I dont know the history... too young to remember TC 4 ;)
He probably lost his call when filters or something like that was 
introduced... but heres the coders explanation, perhaps it makes sense to 
you...

I just looked at what he was calling before... and its gone ;)
addChild is still functional in container... but in wrapper its an 
exception... some history here somewhere... risk one takes if they work 
outside the intended API... unless that is in the servlet spec... doubt 
it...


/**
* A bWrapper/b is a Container that represents an individual servlet
* definition from the deployment descriptor of the web application.  It
* provides a convenient mechanism to use Interceptors that see every 
single

* request to the servlet represented by this definition.
* p
* Implementations of Wrapper are responsible for managing the servlet life
* cycle for their underlying servlet class, including calling init() and
* destroy() at appropriate times, as well as respecting the existence of
* the SingleThreadModel declaration on the servlet class itself.
* p
* The parent Container attached to a Wrapper will generally be an
* implementation of Context, representing the servlet context (and
* therefore the web application) within which this servlet executes.
* p
* Child Containers are not allowed on Wrapper implementations, so the
* codeaddChild()/code method should throw an
* codeIllegalArgumentException/code.
*
* @author Craig R. McClanahan
* @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 
oct. 2006) $

*/

.


A little more homework... would actuall be much easier if we saw the code... 
but the only thing that I can find in TC that is doing more or less what he 
may be doing is in the invoker servlet...


looks like this
   wrapper = context.createWrapper();
   wrapper.setName(name);
   wrapper.setLoadOnStartup(1);
   wrapper.setServletClass(servletClass);
   context.addChild(wrapper);
   context.addServletMapping(pattern, name);

So if is calling  addChild on StandardWrapper... he has no chance..
If his calls look something like the above... then its possible that invoker 
servlet is active on TC 4 and its not on TC 5...

Possibly he has to turn on invoker servlet?

In either case... its open heart surgery that I dont even see in embedded 
TC


Ram if you dont come right... post your code can we can see for sure what 
you doing... we as curious as hell ;)


---
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: Support

2008-10-03 Thread Johnny Kewl


- Original Message - 
From: Martin Gainty [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, October 03, 2008 2:37 PM
Subject: RE: Support



java jar bootstrap.jar works fine for me..

is there ANY possible workaround to this daemon bug?

Thanks,
Martin Gainty
__
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: Fri, 3 Oct 2008 09:10:00 +0100
From: [EMAIL PROTECTED]
To: users@tomcat.apache.org
Subject: Re: Support

Caldarale, Charles R wrote:
 The msvcr71.dll file (not msvci70.dll, whatever that is) is required to 
 run the Tomcat service launcher, but not needed when Tomcat is run via 
 scripts.


 The reason it didn't show up on JRE/JDK 5 is because installation of 
 that JVM version slams a copy of the DLL into C:\windows\system32, 
 regardless of what impact that might have on the system.  JRE/JDK 6 
 installation follows the rules published by Microsoft, and keeps the DLL 
 in the JVM's bin directory.


 Tomcat should be distributing the DLL (or otherwise insuring its 
 availability) during installation or setup of the Windows service; 
 however, no one's been able to convince the committers of that yet.


In summary:
- the JVM requires the dll - this is a JVM bug (Sun do not agree)
- the best place to hack around this is when the jvm.dll is loaded (ie the
daemon project)
- a nice summary and all the pointers needed to fix this are here
http://www.duckware.com/tech/java6msvcr71.html
- There is a daemon issue for this
https://issues.apache.org/jira/browse/DAEMON-110
- Someone with C skills (not me - mine are terrible) needs to write a 
patch.


Anyone takers?

Mark


I think the only way is to open up procrun in VC and recompile it with the 
static version of the msvcr71.dll which is msvcr71.lib... then nothing else 
changes.

procrun will be slightly larger...

The Duckware guy is really pissed off... but as I see it Sun has been fixing 
the issue and is no longer able to because of MS's new dll hell policies.
So its MS's fault... but in fairness MS has always warned people... save 
space make it small and leave the libs external, and you may have pain ;)


Its 340k... nowadays no biggy...

Just needs a recompile and it should take the procrun guy all of 10 seconds 
to do ;)
Any other way fixes the TC issue... but the problem then remains... procrun 
is broken.


... I think

In the means time... if you use Java 6, the service will break, but luckily 
the msvcr71.dll you need is in the Java bin.
The real problem is that its going to catch developers, because unless they 
told about it, they probably running Adobe, or something else, that like the 
JDK 5 was doing is fixing the system... but at the client the TC Service 
breaks... more embarassing than anything else.


---
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: Support

2008-10-03 Thread Johnny Kewl


- Original Message - 
From: Caldarale, Charles R [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, October 03, 2008 3:42 AM
Subject: RE: Support



From: Johnny Kewl [mailto:[EMAIL PROTECTED]
Subject: Re: Support

Normally I always recomment lagging a JRE version as well...
avoid bleeding edge...


JRE/JDK 6 has been around for almost two years now, so I don't think the 
1.6.0_07 download is at all risky.  On the other hand, the 1.6.0_10 release 
really is bleeding edge.  Sun's current versioning scheme does border on the 
incomprehensible...


- Chuck

Time flies... damn.
You right its not really a TC server issue, the thing thats at the back of 
my mind is that companies are lazy... and I havnt checked lately, but 
hopefully Apple has sent out some scouts an discovered theres a new JDK ;)
In theory JDK 6 targeting 5 should be a safe bet, and on TC it is... but 
Swing and stuff like that, build it targeting 6, and if then try move it 
back to JRE 5... it hurts ;)


TC is almost immune, its a tough product... but what we find its that in the 
IDE we have both JDK 5 and JDK 6 loaded... again not really a TC issue.
Sun really seem to be on a mission... for 10 years they were sleeping, but 
now they moving at dizzy speed, your customers may not be.


---
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: Tomcat Servlet Bouncy Castle Problem

2008-10-02 Thread Johnny Kewl


- Original Message - 
From: Jeng Yu [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Thursday, October 02, 2008 10:19 AM
Subject: Tomcat Servlet  Bouncy Castle Problem



Hello Friends!

I have a debugging problem here that I hope the gurus
here can help me figure out.

I'm trying to do RSA public key encryption in a
servlet that I'm developing inside Netbeans 6.1. I'm
using the Bouncy Castle (BC) crypto package. When I
build the servlet, there are no errors. Then I run it,
and Netbeans invokes the Tomcat 6.0.16 container in it
and  waits for a client to conect. But when I connect
to the servlet from a client, it crashes when it
executes this line in my code:

private RSAPrivateCrtKeyParameters RSAprivKey = null;

with this message in the Tomcat log output:

SEVERE: Allocate exception for servlet Fortune
java.lang.NoClassDefFoundError:
Lorg/bouncycastle/crypto/params/RSAPrivateCrtKeyParameters;
Interestngly, the same RSA public encryption code with
Bouncy Castle library works flawlessly when I develop
it in Netbeans IDE and run it as a java application
(not servlet). In servlet environment, it fails. Yes,
I added cldc_classes.zip class library file from
Bouncy Castle to compile the code.

Oh, and the client reports the following error when
trying to connect to the servlet:

The server encountered and internal error that
   prevented it from fulfilling this request.
ServletException: Error instantiating servlet
   class fortune.Fortune.

What am I not doing right? Has anyone else seen
something similar and what's the
getaround/workaround?

Thanks,

Jeng Yu


Jeng we use BC in servlets and have no problems, but its a long time since I 
was into it...

I think you need to get into their mailing lists or what ever they have

I cant remember using the cldc_classes.zip  isnt that for JavaME only? 
... because it doesnt have BIGINT or something... make sure you not screwing 
Java now.
If your BC is in the class path, take it out of there and try get it going 
in your test apps...
If in doubt... use the source code for BC... so A you can remove the huge 
amount of stuff you wont need... and B if I remember correctly we spent a 
lot of time making it independent of JCE which seems to change every java 
version...


Only place those libs must be is in your web app...

Anyway its not TC... bouncy castle is one complex piece of code with a 
million options and forks


... make sure its not in the classpath...

Good luck

---
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: Support

2008-10-02 Thread Johnny Kewl


- Original Message - 
From: Angelica Ardila [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Friday, October 03, 2008 12:20 AM
Subject: Support


Good afternoon, my question is this:

That version of JDK should I use for the Tomcat 6?

Thank you very much.

Angélica Ardila

---

We using TC5/6 with JDK1.5 all the way to JDK 6 beta (10)... no problems.

If you starting out

http://java.sun.com/javase/downloads/index.jsp

2nd item from the top (JDK 6 Update 7)... and the documentation... (Java SE 
6 Documentation)


If you need a dev IDE... its better to go here... 
http://download.netbeans.org/netbeans/6.1/final/

and get the one you want... than use the JDK option with NETBEANS
Because NB is getting huge...
What I do is dowload the PHP version... and then install the TC plugins from 
NB... its quicker than the whole GlassFish thing...


If you not developing and the JRE (SE) 5 or 6 is on the machine already... 
TC is all you need...

You have to have the JDK for the IDE however...

If you on windows, install the JDK to a non standard folder... else it gets 
updated auto... and you dont want that in a dev environment...


... enjoy TC is cool ;)

---
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: Support

2008-10-02 Thread Johnny Kewl


- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, October 03, 2008 12:29 AM
Subject: Re: Support



Angelica Ardila wrote:

 Good afternoon, my question is this:

That version of JDK should I use for the Tomcat 6?

Thank you very much.

Angélica Ardila


Whichever one you like, dear. ;-)


Oh Andre... I think we have a Casanova here ;)... you devil you


Seriously now :
JDK 6 would probably be best, and JDK 5 should work also.
But if it is only to run Tomcat, the JRE 6 should be enough also.


Normally I always recomment lagging a JRE version as well... avoid bleeding 
edge... but these Profiling tools that came in at JDK 6 rc 6 are so good, 
you just have to have it ;)


You devil
---
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: Dynamically adding a resource to a context

2008-10-01 Thread Johnny Kewl


- Original Message - 
From: Pid [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, October 01, 2008 11:50 AM
Subject: Re: Dynamically adding a resource to a context




http://today.java.net/pub/a/today/2005/11/17/app-managed-datasources-with-commons-dbcp.html


Thanks PID... nice article... would like to have seen some code on JNDI for 
dropping a pool and making another one...

... wonder if anyone has tried this stuff on TC?

A QU...
With JNDI if you have a dB with a lot of access control... like say
   Mr X can access table 1,2,3,4 but not 5,6,7 etc

Do you set up a connection pool for each role? ... using JNDI?
Or does the servlet typically do access control and the dB pool is 
effectively admin access?


Wondering how you handle this stuff using JNDI... actually wondering how 
many veteran coders use JNDI for dB access?
Allowing users to change passwords and that sort of stuff seems near 
impossible with JNDI... just wondering?


---
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: Dynamically adding a resource to a context

2008-10-01 Thread Johnny Kewl


- Original Message - 
From: Pid [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, October 01, 2008 10:41 PM
Subject: Re: Dynamically adding a resource to a context



Johnny Kewl wrote:


- Original Message - From: Pid [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, October 01, 2008 11:50 AM
Subject: Re: Dynamically adding a resource to a context




http://today.java.net/pub/a/today/2005/11/17/app-managed-datasources-with-commons-dbcp.html



At the risk of veering wildly off topic...


Thanks PID... nice article... would like to have seen some code on JNDI
for dropping a pool and making another one...


I don't understand what you mean, you want to remove a configured pool 
replace it with a new one?


... wonder if anyone has tried this stuff on TC?


JNDI (in one sense) is just a convenient store for useful objects - like
DB connection pools.  Many app Contexts can share access to one pool
this way.

So, really, there's no with JNDI is XXX true, as once you've retrieved
the DataSource you have access to a javax.sql.Connection object as normal.


A QU...
With JNDI if you have a dB with a lot of access control... like say
   Mr X can access table 1,2,3,4 but not 5,6,7 etc

Do you set up a connection pool for each role? ... using JNDI?


A DB connection pool needs credentials configured in the DB, so
whichever roles that user has are assigned to the pool.
Ergo, one pool per DB user.


Or does the servlet typically do access control and the dB pool is
effectively admin access?


Access control for what? The DB or web app?  Don't confuse DB
credentials with application credentials.


Wondering how you handle this stuff using JNDI... actually wondering how
many veteran coders use JNDI for dB access?


Again, JNDI is just a convenient place to store a connection pool.
Q: Is a connection pool faster than creating a new connection each time
you need one?
A: Yes, usually way faster, so most 'veterans' will probably use one in
a web application.


Allowing users to change passwords and that sort of stuff seems near
impossible with JNDI... just wondering?


Sounds like you're confusing DB credentials with app credentials.
The Connection retrieved from the pool stored in JNDI is usable just
like any other Connection object.

I don't create a new DB user account for every user on my system, but I
do store their web app credentials in the DB.

The *DB* user account that I have configured in the DataSourceRealm
(which has a small connection pool) has read only access to the tables
needed to get the user, do auth  get roles.

Other DB connection pools have write access and permit updates to data
in tables, e.g. updating user passwords, via a servlet which retrieves
the pool from JNDI.


Ok thanks 4 explaining how you do it

---
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: Tomcat migration from T5 to T5.5 mail

2008-09-30 Thread Johnny Kewl


- Original Message - 
From: AlexM3 [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Tuesday, September 30, 2008 12:53 PM
Subject: Tomcat migration from T5 to T5.5 mail




Hello,

I'm migrating a Tomcat Cluster, when I thought everything was working 
fine,

session cluster, balancing,etc, I noticed that the mails were not send by
the java aplication.

I installed the library mail.jar and activation.jar and configured the
web.xml and the context.xml as the Official Tomcat notes say. The 
aplication
has not changed and can't change, and it works perfect in the old 
installed

Tomcat 5. The error that I get when the application tries to send the mail
is:

javax.mail.NoSuchProviderException: smtp
   at javax.mail.Session.getService(Session.java:760)
   at javax.mail.Session.getTransport(Session.java:685)
   at javax.mail.Session.getTransport(Session.java:628)
   ... # More errors lije that


I have read in some forums that the problem could be that Tomcat is 
loading

that libraries 2 times. I have checked everything and the only folder they
are is $CATALINA_HOME/common/lib and they're not in any other place like
$CATALINA_HOME/shared/lib or $CATALINA_HOME/webapps/myapplication/*

Anyone has any idea why I have this error?

Thank you very much


Hi Alex, dont know but I think you should go get the new activation and mail 
jars and try them... just a hunch that if all else is the same, the libs are 
now old...
Those Provider classes are properties inside mail.jar... maybe they have 
changed... dont know, but worth a try...


Just for Info
I dont use the JNDI and have no problems on any JRE or any Tomcat... so if 
you get really desperado


I dump the Mail and Act jars into the web app... and getting a session looks 
like this...


   try{
   java.util.Properties properties = System.getProperties();
   properties.put(mail.smtp.host, smtpHost);
   session = Session.getInstance(properties,null);
   } catch(Exception e) {
  //Oops
   }

It seems not to care if Sun changes its mind...

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: Tomcat outputs php to stderr

2008-09-30 Thread Johnny Kewl


- Original Message - 
From: Serge Fonville [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, September 30, 2008 1:08 PM
Subject: Re: Tomcat outputs php to stderr



Thank you so far, I will definitely look into Quercus.

Still, I would like to understand why output is sent to stderr and if it 
can

be solved (I recall running PHP and tomcat in the past) without problems


You probably in the wrong mailing list... should be asking the guys that 
made this third party stuff...
But I had a little look look and I cant event find the PECL servlet in the 
current PHP stuff...


This custom servlet, is calling JNI, thats talking to PHP... and it seems 
PHP has no interest, Tomcat guys are into servlets, so I'd say its broken... 
unless you backup to an earlier era...


My guess, the JNI is failing... the stream is getting dumped to standard 
err...


I found this page, where some guy has tried to fix it on his lonesome...
http://chen-lahav-software-thoughts.blogspot.com/

Good luck... looks like no one cares (;

---
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: Tomcat outputs php to stderr

2008-09-30 Thread Johnny Kewl


- Original Message - 
From: Johnny Kewl [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, September 30, 2008 6:56 PM
Subject: Re: Tomcat outputs php to stderr




- Original Message - 
From: Serge Fonville [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, September 30, 2008 1:08 PM
Subject: Re: Tomcat outputs php to stderr



Thank you so far, I will definitely look into Quercus.


You know... I hope TC is watching whats happening here... there is zero 
support for PHP in tomcat and its understandable because sticking in behind 
a Java layer just doesnt make sense to me... but it seems that it did work 
onece upon a time...


This is what I'm thinking and I dont think it would be very difficult fo 
guru's like Mladen Turk to do...


Tomcat has the option of running on APR (Apache Run Time)... how difficult 
would it be to add as an option... the Apache PHP engine as a layer on that.
So Tomcat and PHP are seperate... its just a convenience thing... got a few 
PHP pages no problem... use Tomcats APR-PHP


Why not... else Resin is onto a good thing ;)

Serge is right if he's now a little pissed off... even if thats not TC 
fault... I think


---
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: Dynamically adding a resource to a context

2008-09-30 Thread Johnny Kewl


- Original Message - 
From: Scott Dunbar [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Tuesday, September 30, 2008 10:22 PM
Subject: Dynamically adding a resource to a context



Hi all,
I'm honestly not positive that what I want to do is a good idea but the 
basic concept is that I want to dynamically add a Resource (a JNDI JDBC 
DataSource) to a Context.  The idea is that I will be dynamically creating 
databases for new users and want to have a database connection pool for 
each user.


I've been able to simply hand modify 
${catalina.home}/conf/Catalina/localhost/contextname.xml and seen that I 
can now access the new DataSource.  What I'm looking for is a programmatic 
way to do the same thing, short of parsing and rewriting the XML myself. 
I've dug though the MBean classes and am honestly a bit confused.


Is there something that I'm missing?  This is Tomcat 6.0.18 under Linux 
and/or Windows.


Thanks for any help.


Scott, dont think so, I think the pools are created either as Tomcat starts 
or as the servlets starts...

I suppose you could write your own JNDI dB pool class as decribed here...
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html

By definition, if you giving each user their own dB... a single connection, 
its going to be some kind of user pool, not a connection pool...
Unusual I must say... possibly a user table in a dB is a better way to go... 
but its your app.


... this is what you need to know...

The INIT function in a servlet runs once when it starts... and its quite 
easy and possible to use a dB pool without using JNDI...
ie many people use their own, or a third party dB pool and usually then dont 
use JNDI because it becomes a self contained war... especially in cases 
where there is an embedded dB...


In your case you would set up your user pool in INIT... use normal JDBC... 
and use it in the servlet.
Then run it against the logged in user or alternatively store 
connections as session cookies will then also need a listener...


It really depends on how hot your JDBC is ;) these pools are pretty smart 
things... and make suer you understand that a servlet is multi threaded...


Good Luck...

---
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: Tomcat JVM not releasing deleted files (lsof show delete inodes taking up disk space)

2008-09-29 Thread Johnny Kewl


- Original Message - 
From: Chad Kellerman [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Monday, September 29, 2008 4:39 PM
Subject: Tomcat JVM not releasing deleted files (lsof show delete inodes 
taking up disk space)




Tomcat Users,

Just wondering if anyone else has run into this problem.

First let's get the specifics out of the way:

Tomcat: 5.5.25
Java:  Sun JDK 1.5.0_13
Linux RHEL 5

The Tomcat server is situated on it's own file system, with the 
applications

on another.  I got a page this weekend, saying that the disk space was at
95% on the application file system.  Yet when I did a 'du' on the
directories, it only showed about 4% used.  But when I did a lsof I saw 
the

rest of the used files in a (deleted) state.  I tried a 'sync' to see if
that would write the changes to disk, but the files were still listed as
deleted and the disk space (df) was still at 95%.  I had to resort to
restarting the tomcat server.  Everything freed up and the disk usage was
back to normal.  To get a better understanding... the application indexes
uploaded files, the indexing process creates the temporary files then
removes them.

I am wondering if anyone has seen this before (on Tomcat, I've seen this
with databases where the only this to do is restart the server, but never
with Tomcat) and what they have done to help alleviate the issue.


Thanks,
-- sunckell


Chad, not sure my linux is really stale now, but I think you have answered 
it... the code is not releasing the file.
Something like you up load the file, start the index in a thread, it deletes 
the file, but the thread is still holding a ref to the original file 
handle... the app is holding the file open somewhere.
If you have a windows dev box around, get someone to run it from there... XP 
gets really upset if that happens and you'll probably find it.


You disk usage is skew because linux is reporting that space available... 
but it cant let the file go, because something in the code is hanging on.


... I think... hope its your code ;)

---
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: XP/Vista/Office 2007/IE Compatibility Question

2008-09-29 Thread Johnny Kewl


- Original Message - 
From: [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Monday, September 29, 2008 4:33 PM
Subject: XP/Vista/Office 2007/IE Compatibility Question


Good afternoon. My company, Centocor, is in the process of upgrading its 
operating System from Windows 2000 to XP/Vista and its Office 2000 to 
Office 2007. They have installed on, I'm not sure how many, some computers 
Apache Tomcat, version 5.5. Please answer the following questions at your 
earliest convenience:




1) Is the software compatible with XP? If not, what is the compatible 
version and what are the costs involved in upgrading?


2) Is the software compatible with Vista? If not, what is the compatible 
version and what are the costs involved in upgrading?


3) If the software is not independent of Office 2007, is it compatible 
with it? If not, what is the compatible version and what are the costs 
involved in upgrading?


4) If the software is not independent of IE, what versions of it are 
compatible?


Isabel

You not going to have any problems with the above... except that Vista is 
alergic to a hell of a lot of good stuff... if you can, try stay on XP... 
nothing to do with Tomcat... Vista sucks...


http://www.iexbeta.com/wiki/index.php/Windows_Vista_RC_1_Software_Compatibility_List

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: Tomcat outputs php to stderr

2008-09-29 Thread Johnny Kewl


- Original Message - 
From: Serge Fonville [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Monday, September 29, 2008 6:00 PM
Subject: Tomcat outputs php to stderr



Hi,
I am developing a ticket system which should use servlets to connect to 
the

various resources.
Currently I am a php developer and busy to learn JSP/TLD/Servlets
I installed Tomcat 6.0.18 with PHP 5.2.6 on Windows Vista Business (the
production server will be running either Gentoo or CentOS).

Installation went fine, no errors. just one thing I couldn't resolve.
All output generated by php goes directly to the stderr log file instead 
of

the browser (JSP and servlets work fine)

I used
http://blog.taragana.com/index.php/archive/running-php-5x-on-windows-using-tomcat-4x-or-5x/
and http://wiki.apache.org/tomcat/UsingPhp to configure the two.

I started reading about listeners, log4j and servlet mappings.
This seemed over the top to me, so I decided to just ask the  question 
here.


Any help is greatly appreciated



Dont do it this way... run PHP on Apache httpd... its the PHP container... 
and do your servlet stuff in TC... its a good servlet container.
Then put Apache httpd in front of TC... read up on the JK connector... and 
then to the browser its *one system*

Thats how they do it ;)

If you insist on wanting the Java PHP layer... Resin is probably the best... 
they not calling into a PHP engine, they rewrote it in Java... whether they 
up to date with all modules is the question?


Anyway... just trying to show you that you dont have to change a thing... 
join em ;)


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: image download

2008-09-27 Thread Johnny Kewl


- Original Message - 
From: Dave [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Saturday, September 27, 2008 3:38 AM
Subject: Re: image download


InputStream is = new FileInputStream(/apphome/pictures/image.jpg);
OutputStream os = response.getOutputStream();

byte[] buffer = new byte[256*1024]; //256k
while (true) {
int n = is.read(buffer);
if (n  0)
break;
os.write(buffer, 0, n);
}

is.close();
os.close();


--- On Fri, 9/26/08, Dave [EMAIL PROTECTED] wrote:

From: Dave [EMAIL PROTECTED]
Subject: image download
To: Tomcat Users List users@tomcat.apache.org
Date: Friday, September 26, 2008, 6:33 PM

For img src=http://domain.com/servlet/pictures/image.jpg/

in servlet get method,

InputStream is = new FileInputStream(/apphome/pictures/image.jpg);
OutputStream os = response.getOutputStream();

byte[] buffer = new byte[256*1024]; //256k
while (true) {
int n = is.read(buffer);
if (n  0)
return;
os.write(buffer, 0, n);
}

is.close();
os.close();


Is this the right way? Sometimes only the half image is shown on web page. 
Is

there a more efficient and robust way? How about for audio/video files?

I want to take at how Tomcat does it. Could anyone tell me which class?
thanks
Dave

**

Dave its that buffer n thats wrong
Also you not going to get much by making it 256 k blocks... you just have to 
match typical web tx size... 4096 is enuf


Use this

public void outputImage(File thumbfile, String type,
   HttpServletResponse response) throws IOException {
   response.setContentType(image/+type);
   OutputStream os = response.getOutputStream();
   FileInputStream fin = new FileInputStream(thumbfile);

   byte[] buf = new byte[4096];
   int count = 0;
   while(true) {
   int n = fin.read(buf);
   if(n == -1) {
   break;
   }
   count = count + n;
   os.write(buf,0,n);
   }
   os.flush();
   os.close();
   fin.close();
}

-
The DefaultServlet.java is the place this happens but it looks nothing like 
it because they doing caching and lots of other stuff...

Just get that setContentType right and it could be video... anything
Its not a bad idea adding setContentSize as well...

enjoy...

---
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: tomcat won't download large files -- out of memory error

2008-09-26 Thread Johnny Kewl


- Original Message - 
From: DIGLLOYD INC [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, September 26, 2008 7:01 AM
Subject: tomcat won't download large files -- out of memory error


I have some large zip files I want to make available for download.   When I 
try to download a 70MB file, tomcat is trying to cache these  huge files 
(it seems).  The result is that downloading them always  fails.  I *want* 
caching for most everything eg jpegs, html, etc and  I've set tomcat to use 
up to 1.5GB of memory.


Is there a way to limit the size of the file that will be cached? It's 
regrettable that failure to cache a file can't gracefully degrade into 
just not caching it.



Sep 25, 2008 9:50:17 PM org.apache.catalina.connector.CoyoteAdapter 
service
SEVERE: An exception or error occurred in the container during the 
request processing

java.lang.OutOfMemoryError: Java heap space
at  org .apache 
.naming.resources.ProxyDirContext.cacheLoad(ProxyDirContext.java:1571)
at  org .apache 
.naming.resources.ProxyDirContext.cacheLookup(ProxyDirContext.java:1449)
at  org 
.apache.naming.resources.ProxyDirContext.lookup(ProxyDirContext.java: 283)
at  org 
.apache.tomcat.util.http.mapper.Mapper.internalMapWrapper(Mapper.java: 
782)

at org.apache.tomcat.util.http.mapper.Mapper.internalMap(Mapper.java: 626)
at org.apache.tomcat.util.http.mapper.Mapper.map(Mapper.java:516)
at  org .apache 
.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java: 
444)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 
284)
at  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 
844)
at org.apache.coyote.http11.Http11Protocol 
$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: 
447)

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


Lloyd Chambers
http://diglloyd.com

[Mac OS X 10.5.2 Intel, Tomcat 6.0.16]



Lloyd... dont know, its definitely running out of mem, but I'm not sure its 
because of a 70 meg file...
The default static cache size is 10 megs, so its doubtful that TC is caching 
that file...


We run video content on the Lan and some of that stuff is 700 megs on 
standard settings... out of the box settings.

We are still running TC 5.5.25 in production...

I dont know the MAC, but its possible that its just not setting enough 
memory...
I guess the MAC has its own TC and its own JRE... so I have no idea how you 
monitor stuff, or what the defaults are.
If it does have the later Sun JRE VisualVM tool... thats a nice way to watch 
what your TC is doing.


Is it been served by tomcats default servlet or from a custom servlet... if 
the later the coder may infact be sticking it all on the heap, very likely 
it will break then.

The default servlet in TC is smarter than that...

I dont think a 70 meg file should pose any problems served as a static 
file...
I would try another TC version just to make sure... and I would ask 
[EMAIL PROTECTED] as well if you dont come right here.


I think you may be seeing a symptom of another problem... ie something else 
is consumed all the memory, and the file down load is the straw that broke 
the camels back. Maybe another test case is in order where you make a little 
webapp with nothing else but the static file in it... if that works, then 
something else in that webapp ate your memory...


Good Luck...

---
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: Tomcat manager 'list' command - why does it return html markup

2008-09-26 Thread Johnny Kewl


- Original Message - 
From: sk1ds [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Friday, September 26, 2008 4:31 AM
Subject: Tomcat manager 'list' command - why does it return html markup




Hi all

probably a silly question from a newbie but...

According to the doco
http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Introduction 
HERE


I says I should be able to use the Manager web application using

A minimal version using HTTP requests only which is suitable for use by
scripts setup by system administrators. Commands are given as part of the
request URI, and responses are in the form of simple text that can be 
easily

parsed and processed.

However, when using wget or curl from a command line shell under redhat it
returns it with HTML markup.

Any ideas what I am doing wrong ?

Many thanks

-

Nothing... it is HTML, but the context is text so easy to copy in a 
browser I think is what they saying

Heres the headers that are actually passed around
First the login... then the text content

http://localhost:8080/manager/list

GET /manager/list HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) 
Gecko/20080702 Firefox/2.0.0.16
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.x 401 Unauthorized
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 02:00:00 CAT
WWW-Authenticate: Basic realm=Tomcat Manager Application
Content-Type: text/html;charset=utf-8
Content-Length: 954
Date: Fri, 26 Sep 2008 10:01:00 GMT
--
http://localhost:8080/manager/list

GET /manager/list HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) 
Gecko/20080702 Firefox/2.0.0.16
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Authorization: Basic 

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 02:00:00 CAT

**SEE its TEXT***
Content-Type: text/plain;charset=utf-8
Transfer-Encoding: chunked
Date: Fri, 26 Sep 2008 10:01:11 GMT


-
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: How to have multiple domains/contexts with Tomcat ? they all go to same context ..

2008-09-26 Thread Johnny Kewl


- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, September 26, 2008 12:10 PM
Subject: Re: How to have multiple domains/contexts with Tomcat ? they all go 
to same context ..




Can you tell us on what kind of host system you are running this ?
It would help guessing where the files are.

Thanks.

P.S.

I am not the expert, but it should indeed be relatively simple, so I'll 
try. In a nutshell :


- start again from the original server.xml file.
- in it, locate the Host name=localhost ./Host section, copy it, 
and re-insert it after the original section.

- then replace the name=localhost attribute by name=www.mrpink.com
- then redo the same one more time, this time with www.mrblue.com

The above takes care of letting Tomcat known that there are 3 Virtual 
Hosts :

- www.mrpink.com
- www.mrblue.com
- and localhost, which will also be (remain) the Host by default, if the 
name given in the request does not match either of the other ones (for 
example, if someone calls up http://xxx.xxx.xxx.xxx:8180 (with the IP 
address of your server). (I suggest to keep that one as it is, to access 
the documentation etc..)


Now what is left is to tell Tomcat where, for each of the virtual hosts, 
he finds the corresponding documents and webapps.
I would recommend to create 2 additional directories, at the same level as 
your current webapps, say webapps-pink and webapps-blue.
Then move the respective documents/applications in these directories, 
checking ownership and permissions etc.. They must at least be readable by 
the user-id running Tomcat.


Now go back to your individual Hosts sections, and change 
appBase=webapps by  appBase=webapps-pink and appBase=webapps-blue


Now restart Tomcat.

You should now be able to access blue by calling up 
http://www.mrblue.com/mrblue;.


To make this trailing /mrblue go away, you should make this webapp into 
the ROOT webapp for that virtual server, but for that I'll let an expert 
give you the instructions.


Have I got it right ?


Any better... and we'll have to pay you a consulting fee ;)

---
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: Accessing server directory from applet

2008-09-26 Thread Johnny Kewl


- Original Message - 
From: Bai Shen [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, September 26, 2008 10:30 PM
Subject: Accessing server directory from applet



I have an applet that I'm hosting on Tomcat.  When I try to access the file
system, I end up on the users file system, not the servers.  Is there a 
way

to connect to the servers file system?

Bai Shen


Bai I'm actually surprized you didnt get a security exception... as Mark 
said applets run in the browser... client side.
The last time I looked at Applets (long long time ago), they dont need any 
special security if you talk to the delivery server...
Remember that... if you want to talk to any other server... you into 
security issues.
Things like the script coming from one machine and the applet from another, 
will also catch you...


I think they horrible things... if this is a new project, have a look at 
GWT... or think about a normal web page... if you can.

Will save you some pain

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



Tomcat Master for PHP Hosting?

2008-09-25 Thread Johnny Kewl

Does anyone know if there is anything like this already...

What I need (want to do) is turn TC into a Virtual PHP hosting system...

This is the idea... one can layout a html/PHP site in tomcat...
Then point that at distributed servers out there, and use the remote links 
in JSP, servlets etc.


And it just happens... ie those Virtual Sites are deployed to remote httpd 
servers and it all just works.


Then there could be intelligent processing, like a form submitted to a 
remote PHP site is processed by tomcat... there will be bridges but I havnt 
got that all thought thru yet...


Then the idea is that from the company you run TC... its the brain... but it 
now can take advantage of all the cheap hosting PHP sites out there...


A kind of load sharing system... that can make use of dumbed down hosting 
sites...

And one develops on tomcat as if it was all right there on your machine...

The thing I'm after is making a kinda TC MASTER...

I dont know what others find, but locally if I talk to hosting services and 
mention Tomcat... I get a Oh, that will cost more... like its rocket 
science or something...


So I want to put tomcats brain into PHP without giving the brilliant admin 
dude a cranial embolism.


I think intelligence can actually be made very light... and the plebs can do 
the heavy lifting...
So in the end... the home site is the brain... running a whole worker 
population out there.


... Anyway thats the idea... does anyone know if there is anything like this 
already?

... TC as a PHP god... sort of thing.

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: Stripping down the JSP engine from Tomcat

2008-09-25 Thread Johnny Kewl


- Original Message - 
From: [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Thursday, September 25, 2008 6:39 PM
Subject: Stripping down the JSP engine from Tomcat


Hi,

Is there anyways we can strip down the JSP engine from the Tomcat?

I have to develop an application which would process a request using
servlets, but I don't need the JSP engine as there is a requirement for
the Servlet engine to be as light weight as possible and also have a
small memory footprint.
I have tried removing the jasper jars but that fails tomcat from
starting, has anyone tried their hands on this, would greatly appreciate
your guidance.

Regards,
Vivek Jaiswal
TCS - BT Global Services

---

I started pulling TC into a modular form a while back but never split out 
Jasper

I took out Clustering and SSI...
What I've got is no longer TC... I'm skinning it and making it app like when 
I get time.

TC is not very modular at present...

In the sandbox theres a chap working on a similar thing from a diff angle... 
he's pulled out the valves so far

http://svn.apache.org/repos/asf/tomcat/sandbox/tomcat-lite/

If you have a dev team that going to do serious work on this you may get 
really lucky... but this is work... its not plug and play.

If so you welcome to what I done so far... but I want the lite back ;)

---
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: Tomcat Master for PHP Hosting?

2008-09-25 Thread Johnny Kewl


- Original Message - 
From: Alan Chaney [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Thursday, September 25, 2008 8:58 PM
Subject: Re: Tomcat Master for PHP Hosting?



Its called a 'web service'.

Make your tomcat application a web service. Use a php application to 
invoke it. Distribute the php applications to the php servers.


The php application has a user interface and generates the invocation 
request (probably as an xml file). Your 'MASTER' does the business logic 
and generates a reply, either as an xml file which you can use XSLT in php 
to render or some other form.


If you really wanted to get sophisticated you could write a tomcat 
application that generated most/all of the php against some specification 
and style the displayed pages with css.


There are, of course, numerous standards and implementations for web 
services. You could also make it an AJAX app if you wanted to.


HTH

Alan


Thanks Alan... yes, u right.
Little things like common login and shared sessions and that sort of thing 
would have to be sorted...
But essentially even if we now had a functions like 
php_include_servlet('xyx')

it is at a generic level, a client talking to a server (web service).

Maybe there is something else really brilliant out there as well?
I'm fishing ;)

---
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: Tomcat thread blocking

2008-09-24 Thread Johnny Kewl


- Original Message - 
From: Darren Kukulka [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Wednesday, September 24, 2008 9:37 AM
Subject: Tomcat thread blocking


Hi,



I've recently observed a scenario in Tomcat 6.0.13 64-bit under SUN JDK
1.6_03 (x64 Windows platform), where a large number of threads show a
status of BLOCKED.



Can someone please advise the easiest and most effective way of helping
identify the original cause of the block?or have I just opened up a
can of worms?!



The behaviour is not something I can replicate so I need a method for in
situ investigation, before I have to restart Tomcat to restore service
(after a while Tomcat consumes too much CPU and becomes unresponsive)



Any pointers would be much appreciated.

==
Google for VisualVM... its in the later Java versions
Heap Dumps, Thread Dumps... its like JConsole on steroids ;)

---
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: manipualting a select list from within an event handler

2008-09-24 Thread Johnny Kewl


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

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, September 24, 2008 4:20 PM
Subject: manipualting a select list from within an event handler


Manipulating checkboxes from withing an onchange event handler works  but 
I'd like to manipulate a select list like in this code example,
but without luck? I'd appreciate some little help, that would be 
fantastic.



Thank's for some input here ;)

kind regards,

Robert


function CheckAuswahl(currForm)
{
  a = document.form_addresses.form_protocol.value;
if(a==33554432)
  {

for(var x=0; x  currForm.elements.length; x++) {
var y = currForm.elements[x];

y.checked = currForm.form_exch_enabled.checked;

if (y.name == form_exch_enabled) {
y.checked = true;
//alert(y.name);
}

if (y.name == form_exch_name) {
if(y.value == ) {
y.value = ggg;
}
}

if (y.name == form_exch_pass) {
if(y.value == ) {
y.value = ggg;
}
}

if (y.name == form_permitted_rcv) {
//var a=y.createElement('option');
//a.name=TEST;
//y.focus();
y.add('Test',null);
alert(y.size);
}
}
  }
}


td%=Label_Protocol%/td
  td
%
  int intProtocol = Integer.parseInt(Value_Protocol);
%
select name=form_protocol 
onchange=CheckAuswahl(this.form) %=Label_State%


option % if ( intProtocol == sysProtocol_ZModem) {%selected%}%
value=%=sysProtocol_ZModem% 
%=Value_Protocol_ZModem%/option


---


Robert just looking at it... you passing a form element and the select in 
not in one...

Have a look at this example...

http://www.mredkj.com/tutorials/tutorial005.html

and Javascript is a mine field so get yourself FireFox at least and the 
plugin so you can see the whole DOM and what params are available...
Then make it work just in a normal HTML editor... then stick it in JSP... 
else its difficult...
Like for example... look at that example... can you see they making special 
allowances for IE... because microsoft are on their own mission.


Google for Javascript stuff... W3 Schools is quite good, but there are tons 
of tut sites out there
Javascript is something you really want to use in moderation... its not easy 
getting it cross browser compat...


And you'll get crapped out if you ask here ;)
Kinda fun though ;)

---
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: Tomcat Is not starting

2008-09-23 Thread Johnny Kewl


- Original Message - 
From: Martin Gainty [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, September 23, 2008 8:11 PM
Subject: RE: Tomcat Is not starting



hi partha

check out
http://forums.sun.com/thread.jspa?threadID=5121172start=0tstart=0

take a working copy of mscvr71.dll  from
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr71
and copy to

--
   The file may already be in your jdk1.6.0_04\bin folder
   Do as martin says copy into /windows/system32

   On the older window systems you'll start getting alot of these issues...
   Google for and get a program called Dependency Walker...
   It allows you to see what an application is looking for very handy 
;)

   So if the fix doesnt work, you can check what the right fix is yourself.

---
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: Tomcat6.0.18+Log entries upon shutting down TomCat

2008-09-23 Thread Johnny Kewl


Subhrajyoti

Look I dont know, I've never seen this, we dont run the latest as policy...
But I would drop back a few TC versions...

I think a wrapper represents a servlet instance... (guess)... and 253,020 
sounds like a huge number.


I think you should be concerned... whether it is a TC issue or a Webapp 
issue you only going to discover if you try a few TC's that have been around 
for a while...


I think document your entire system the JRE as well... and if it does 
not show in an earlier TC, let the dev group know


The thing that would tell you that there is definitely an issue, is if you 
watch the memory during the load test... if thats getting less and less with 
time its crashing...


It seems to be holding servlets in memory and making new ones... it may not 
be TC... you now have to experiment


... it doesnt look right... but then it may be that your system is just 
enormous ;)

... or some new feature in the latest TC ??

I think you right been concerned... doesnt smell right ;)

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



- Original Message - 
From: [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Tuesday, September 23, 2008 11:20 AM
Subject: Tomcat6.0.18+Log entries upon shutting down TomCat



Hi All,
 My first question in this forum . I am load testing our
webapp using Jmeter . The test was configured to simulate  50 simultaneous
users . After running the test for about 18hours or so , I decided to
shutdown Tomcat  and after executing shutdown.bat file , I got the
following messages inside catalina.2008-09-23.log . At the time when I
stopped Tomcat, Jmeter was showing as all the 50 threads up and running .
My question :

1. What this line INFO: Waiting for 253,020 instance(s) to be deallocated
means ?
2. Are these messages worrisome from the application point of view ?
.

Sep 23, 2008 1:53:38 PM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Sep 23, 2008 1:53:39 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Sep 23, 2008 1:53:39 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 253,020 instance(s) to be deallocated
Sep 23, 2008 1:53:40 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 253,016 instance(s) to be deallocated
Sep 23, 2008 1:53:41 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 253,015 instance(s) to be deallocated
Sep 23, 2008 1:53:41 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 42 instance(s) to be deallocated
Sep 23, 2008 1:53:42 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 42 instance(s) to be deallocated
Sep 23, 2008 1:53:43 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 42 instance(s) to be deallocated
Sep 23, 2008 1:53:43 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 7,570 instance(s) to be deallocated
Sep 23, 2008 1:53:44 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 7,570 instance(s) to be deallocated
Sep 23, 2008 1:53:45 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 7,570 instance(s) to be deallocated
Sep 23, 2008 1:53:53 PM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080


Regards,

Subhrajyoti
Mobile: +919830079545
Mail: [EMAIL PROTECTED]
Web: www.labware.com

LabWare LIMS Solutions - Results Count 



-
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: HTTPS and Virtual Hosts

2008-09-22 Thread Johnny Kewl


- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, September 22, 2008 10:57 AM
Subject: HTTPS and Virtual Hosts



Hi.

I'm not an expert at anything below, that's why I am asking.
I am also not looking for a very precise answer, just a rough summary.

The question :

As I remember from reading about this a while ago, there is/was a 
fundamental incompatibility between the HTTP Virtual Host mechanism, and 
HTTPS/SSL, in the sense that there is some egg-and-chicken problem 
involved, which roughly goes like this :
- the client connects to the host and requests an encrypted connection to 
a certain hostname
- the host and client negociate the encryption (based or not on the name 
of the host)
- on subsequent requests, the client sends the request encrypted, 
including the Host: header that (acording to the HTTP protocol) should 
indicate the name of the Virtual Host it wants to talk to
- the server should decode the request (including this Host: HTTP 
header) in order to determine which Host the request is addressed to, but 
it can't because it does not know which host it is yet, and thus cannot 
decode the request

- we are thus stuck

Is the above, very roughly and approximatively still a valid explanation 
of what happens, or is it totally wrong, or has something changed 
in-between that I am unaware of ?


Thanks


--

Mmm yes... kinda

Andre check out the hand shake in SSL...
Keeping it very conceptual... the secure system between a browser and server 
is owned by Verisign, or GoDaddy, or whatever CA.


And it is checking a few things...
Like the domain name used and the expiry date...

So when you buy a cert and give them www.andre.com
Thats it...

This is because the cert is pulled (checked) during the handshake... and 
host headers only come later...


 thats the official version of the story, but I actually cant see any 
reason why the hand shake couldnt be extended to look at the incoming URL... 
other than people would start doing server tricks and making extra free 
certs ;)


I conclude... its more about biz, that it is about technology 
certificates are sold per domain... this is the real issue ;)


Its actually interesting, because when we were making the Pojo server, this 
issue came up... especially because we want to give the company using the 
system the ability to be a CA... so we dropped the domain check, and then 
the only condition on the server is that the administrator knows the private 
key...
... clearly a really crap biz model because one can use the certs on a 
million servers... but an interesting thing happens...


... virtual host are NOT and issue
... Its secure on any port

Ha ha... its about the biz model I believe ;)

Hell they got to make money and it is beeg bucks... a local 
chap made a cool 3 billion dollars out of his CA ;)


 Yup... I think its about biz ;)

---
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: HTTPS and Virtual Hosts

2008-09-22 Thread Johnny Kewl


- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, September 22, 2008 10:57 AM
Subject: HTTPS and Virtual Hosts



Hi.

I'm not an expert at anything below, that's why I am asking.
I am also not looking for a very precise answer, just a rough summary.

The question :

As I remember from reading about this a while ago, there is/was a 
fundamental incompatibility between the HTTP Virtual Host mechanism, and 
HTTPS/SSL, in the sense that there is some egg-and-chicken problem 
involved, which roughly goes like this :
- the client connects to the host and requests an encrypted connection to 
a certain hostname
- the host and client negociate the encryption (based or not on the name 
of the host)
- on subsequent requests, the client sends the request encrypted, 
including the Host: header that (acording to the HTTP protocol) should 
indicate the name of the Virtual Host it wants to talk to
- the server should decode the request (including this Host: HTTP 
header) in order to determine which Host the request is addressed to, but 
it can't because it does not know which host it is yet, and thus cannot 
decode the request

- we are thus stuck

Is the above, very roughly and approximatively still a valid explanation 
of what happens, or is it totally wrong, or has something changed 
in-between that I am unaware of ?


Thanks


--

Mmm yes... kinda

Andre check out the hand shake in SSL...
Keeping it very conceptual... the secure system between a browser and server 
is owned by Verisign, or GoDaddy, or whatever CA.


And it is checking a few things...
Like the domain name used and the expiry date...

So when you buy a cert and give them www.andre.com
Thats it...

This is because the cert is pulled (checked) during the handshake... and 
host headers only come later...


 thats the official version of the story, but I actually cant see any 
reason why the hand shake couldnt be extended to look at the incoming URL... 
other than people would start doing server tricks and making extra free 
certs ;)


I conclude... its more about biz, that it is about technology 
certificates are sold per domain... this is the real issue ;)


Its actually interesting, because when we were making the Pojo server, this 
issue came up... especially because we want to give the company using the 
system the ability to be a CA... so we dropped the domain check, and then 
the only condition on the server is that the administrator knows the private 
key...
... clearly a really crap biz model because one can use the certs on a 
million servers... but an interesting thing happens...


... virtual host are NOT and issue
... Its secure on any port

Ha ha... its about the biz model I believe ;)

Hell they got to make money and it is beeg bucks... a local 
chap made a cool 3 billion dollars out of his CA ;)


 Yup... I think its about biz ;)

---
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: HTTPS and Virtual Hosts

2008-09-22 Thread Johnny Kewl


- Original Message - 
From: Peter Crowther [EMAIL PROTECTED]

To: 'Tomcat Users List' users@tomcat.apache.org
Sent: Monday, September 22, 2008 12:19 PM
Subject: RE: HTTPS and Virtual Hosts



From: Johnny Kewl [mailto:[EMAIL PROTECTED]
I actually cant see any
reason why the hand shake couldnt be extended to look at the
incoming URL...


Because the URL (or at least the host header) would have to be sent over the 
wire in cleartext, as it's before the encrypted connection is negotiated. 
This is an information disclosure vulnerability.


   - Peter


http://support.microsoft.com/kb/257591

If it send the HOST info in step one and the server chose the correct 
cert I see no problem, the secure session hasnt even kicked in yet ;)


So what are they not allowing?
I think the only vulnerability is to the CA's biz model ;)
If not what is the vulnerability? Whatever cert is sent what oput there by 
the admin dudes, and will be checked client side anyway ;)


---
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: HTTPS and Virtual Hosts

2008-09-22 Thread Johnny Kewl


- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, September 22, 2008 12:21 PM
Subject: Re: HTTPS and Virtual Hosts



Mark Thomas wrote:

Ognjen Blagojevic wrote:

André Warnier wrote:

Is the above, very roughly and approximatively still a valid
explanation of what happens, or is it totally wrong, or has something
changed in-between that I am unaware of ?

Yes, that's about it. Here is the official explanation:

  http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#vhosts

The workaround is also proposed. You can use different ports or IP
adresses for different SSL enabled virtual hosts. For instance, you
could put 2 or more network cards in the server, and than configure one
virtual host for each of these cards.


You do not need multiple NICs to support multiple IP addresses. You can
quite happily configure a NIC with multiple IP addresses.


Allright.
Thanks to everyone for the answers and references.
This was also linked to another thread Re. Connector problem, for which 
I am also interested in the practical solution.


Now, a follow-up question :

I seem to remember that there was talk about a scheme or a protocol that 
would allow (very roughly) a client/server pair to start a session using 
HTTP (not SSL), negociate, then in the course of the session upgrade 
this link to HTTPS.  And that this somehow could be a solution to the 
Virtual Host issue under HTTPS.
Am I dreaming this up, or does there exist something in that general area 
?


Andre, I'm not aware of anything like it... one can actually do anything 
with crypto stuff, but the problem is that half the engine is built into the 
browser, if it doesnt want to play, it doesnt happen... there are do it 
yourself secure layers out there at javascript level, but they have 
issues... dont secure whole page etc.


... dont think so...

However as soon as you leave the browser environment... anything is 
possible.


---
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: [OT] RE: HTTPS and Virtual Hosts

2008-09-22 Thread Johnny Kewl


- Original Message - 
From: Peter Crowther [EMAIL PROTECTED]

To: 'Tomcat Users List' users@tomcat.apache.org
Sent: Monday, September 22, 2008 2:30 PM
Subject: [OT] RE: HTTPS and Virtual Hosts


[Marked OT as this is not even remotely about Tomcat]


From: Johnny Kewl [mailto:[EMAIL PROTECTED]
http://support.microsoft.com/kb/257591


... OK...


If it send the HOST info in step one


... which it doesn't as far as I can see...


and the server chose the correct
cert I see no problem, the secure session hasnt even
kicked in yet ;)


Yes, exactly.  So anything sent across the wire (such as the host header) is 
subject to eavesdropping.


The URL, in particular, MUST NOT be sent in cleartext - consider a URL of 
the form 
https://www.innocentsite.com/myphotos/notsoinnocent/llamapr0n372.jpg *.  The 
user would no doubt expect SSL to defend his/her access to that URL from 
eavesdropping :-).


The case for not sending the host header in cleartext is weaker, but still 
present.  Consider a blog site such as LiveJournal, for example.  It hosts a 
range of content, separated onto one hostname per blog.  Some of that 
content is pretty explicit, and some people might get rather upset if they 
knew that *even though they thought they were on a secure channel* then 
others could eavesdrop on the mere fact that they were reading *that* 
content, rather than some other innocent content that happened to be on the 
same IP.  So I consider that the ID vul is still present, even via 
disclosure of just the host header.



If not what is the vulnerability? Whatever cert is sent what
oput there by
the admin dudes, and will be checked client side anyway ;)


You're thinking about ID vuls from the side of the server admin.  Broaden 
your thinking - what might a *client* get upset about?


   - Peter

Ok... its off thread, but I disagree the secure session doesnt start out 
secure... even a certificate is clear text, dont see the big deal... once 
you in a session, different story...

I guess this means you not going to help me with my new book ;)
   Curve Ball technology for biz sake... ha ha

---
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: jstack and Tomcat 6 on Windows

2008-09-22 Thread Johnny Kewl


- Original Message - 
From: Surendrakumar Viswanathan -X (suviswan - HCL at Cisco) 
[EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, September 22, 2008 11:55 AM
Subject: RE: jstack and Tomcat 6 on Windows


Check Eclipse Memory Analyzer Tool www.eclipse.org/mat/. This is
alternate to JMAP, but it can parse the hprof file faster and have a
very visual GUI.

Thanks
Suren



Cool, if people just chat about how they find these out of mem errors, this 
will become a very cool thread...

Up until I discovered these tools, it seems such a black hit and miss art.

... before this I actually cant think of anything that let one peek inside 
those class loaders... short of writing your own code...


In earlier threads there are also guys trying to figure out why TC wont let 
go... it holds... and I'm wondering if JHat wouldnt be able to help in those 
area's as well...

... its this class that wont let go... etc.

... it looks really nice

... did it help you, did you find the leak?

---
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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-22 Thread Johnny Kewl


- Original Message - 
From: Christopher Schultz [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, September 22, 2008 3:14 PM
Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Sinoea,

sinoea kaabi wrote:

Christopher Schultz wrote:

You aren't using any class-level members in your static methods so
you should be fine.


This means that I cannot declare a:

public class Data {

private static DataSource datasource = null;

public static DataSource getDataSource() {
  if (datasource == null) {
 // create a datasource
  }
  return datasource;
}

}


Well, you /can/, but it wouldn't be a very good idea.


In the code above the class-level member is the datasource.

Do you mean I should do like this instead:

public class Data {


public static DataSource getDataSource() {

  // create a new datasource for each call to this method

  return datasource;

}
}


Assuming that the 'datasource' object is still shared among threads,
it's still a bad idea. DataSource objects are not guaranteed to be
threadsafe, so you shoule not share them.

This is a bad example, because you should never cache the DataSource in
the first place: you should always get it from the JNDI tree.

- -chris


Ah... thanks Chris being able to

   DataSource ds = 
(DataSource)initContext.lookup(java:/comp/env/jdbc/xmecsDB);

from anywhere in the webapp would solve a lot of problems in that code...

Thanks...

---
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: jstack and Tomcat 6 on Windows

2008-09-22 Thread Johnny Kewl


- Original Message - 
From: Brian Clark [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, September 22, 2008 6:11 PM
Subject: Re: jstack and Tomcat 6 on Windows


Thanks again for all of our suggestions. The Eclipse Memory Analyzer Tool 
looks very interesting and helpful. It also calls out the 
AVA_OPT  -XX:+HeapDumpOnOutOfMemoryError to auto generate a heap dump for 
me. I was originally looking for a way to automatically generate a thread 
dump, but this will be extremely helpful as well.


Another alternative to JHAT is Sun's new free tool, Visual VM. I think 
JHAT is part of its underlying technology. Visual VM now ships with Sun 
JDK 1.6.0_07 and later, and is available via download separately from 
https://visualvm.dev.java.net/


I believe that VisualVM will eventually replace Sun's Jconsole, as it has 
all of Jconsole's functionality as well as heap dump, thread dump, and 
basic profiler functionality. It seems to have some of the functionality 
that is in Eclipse MAT. Not sure of the pro's and con's of one vs. the 
other though. I plan on looking at both.


Thanks again,
Brian


VisualVM... damn its nice...

---
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: Tomcat 5.5 / Windows / procrun ?

2008-09-21 Thread Johnny Kewl


- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Sunday, September 21, 2008 1:41 AM
Subject: Tomcat 5.5 / Windows / procrun ?



Hi.

I have Tomcat 5.5 running on a variety of platforms, among them Windows XP 
(my laptop) and Windows 2003 server.
For the Windows installation, until now I have been using the Windows 
Service Installer from the Tomcat 5.5 download page, and it works fine.


But could someone shed some light on the following puzzle ?

A recent discussion on this list triggered my curiosity, and as a result I 
bumped into several things :


- the installer for Windows installs a version of Tomcat 5.5 devoid of the 
usual startup.sh/bat, catalina.sh/bat etc.. and instead just installs 
a couple of files in Tomcat_home\bin, of which a tomcat5.exe (which seems 
to be the Tomcat executable), and a tomcat5w.exe which is the Windows GUI 
allowing to configure the Tomcat service..


- the ImagePath Registry entry for the Tomcat 5.5 Service shows this :
 C:\Tomcat5.5\bin\tomcat5.exe //RS//Tomcat5

- On the Tomcat 5.5 download page, in addition to the installer, there 
also exists a Tomcat 5.5 zip file. That one seems to contain the full 
complement of usual files of Tomcat, including Tomcat_home\bin, plus the 
tomcat5.exe and tomcat5w.exe which are also in the installer package.
It also contains a file service.bat which is described nowhere, but 
seesm to be related to the procrun item of which question below.


The Tomcat 5.5 and Tomcat 6 on-line documentation, setup page, section for 
Windows, only seem to mention the Installer package.  There is a link on 
both the 5.5 and 6.0 Windows setup sections, pointing to a Windows 
Service HowTo, which leads to a page mentioning procrun 1.0, but in the 
same breath indicating that it is now obsolete.


Digging further, I found a link to the Apache Commons project Daemon, 
which seems to include this procrun for Windows, and also a jsvc for 
Unix.


The page there relative to procrun,
(http://commons.apache.org/daemon/procrun.html)
 apart from being relatively difficult to read, seems interesting and 
seems to match the way my Windows Tomcat 5.5 instances are really 
installed and running.

(See registry line above).
But I found nowhere a link to download this procrun in binary form.
I also did not find any link there pointing to any other version of 
procrun...


On the other side of things, this same Apache Commons Daemon project also 
covers a jsvc, which seems to be a wrapper allowing to run Tomcat as a 
daemon under Unix/Linux.


I believe I have seen mentions of this jsvc in some Tomcat documents (or 
in this forum ?), but at any rate my Tomcat Debian Linux systems seem to 
run Tomcat 5.5 as daemon perfectly fine, without seeming to use this jsvc 
module.

So I wonder what it is used for.


What I kind of piece together of all this is as follows :

- the packagers of Tomcat 5.5 and Tomcat 6 for Windows use this procrun 
program (in whatever version, but probably not 1.0), to take the java JVM 
executable and make it into a Windows service which runs Tomcat.
This Windows Service executable is named tomcat5.exe in the msi 
distribution. (Or else this tomcat5.exe is not really java packaged as a 
service, but just a stub pointing to an installed Java jvm dll).
Anyway the result is packaged, together with the other Tomcat components, 
into a Windows Service Installer package which is the one on the Tomcat 
download page.


- the documentation of this procrun (or whatever is related to it for 
Tomcat), on the Tomcat site, is out-of-date and does not match the version 
of procrun that is being used above.


- the procrun program is a general utility that allows to take any Java 
program (or any program ?) and turn it into a Windows service.  It thus 
seems to be something like the old srvany workhorse, but a bit more 
sophisticated.  But this procrun program does not seem to be available for 
download in binary form.


- and I don't have a clue as to what jsvc may be for.




Thanks
André

---
Thats about right from when I looked at it a while back...

Java can be controlled from C... thats what the libs do... there is a linux 
and windows version...
If you look at the tomcat bootstrap class, you will see it has the 
(interface) methods that Procrun calls into.


So its just a windows service that starts the java engine, and calls into a 
java class to get it running...


If you want the binary for procrun... its just the tomcatX.exe file... 
rename it... ha ha


The TomcatW file is just a human interface... probably talking directly to 
the windows registry (params).


service bat... lets a user get it installed...

So if you have the TC zip version and want to install it as a service...
service install
will do it.

The real problem with installing TC from a zip is just that the APR is not 
there... and its a mission to guess the right one...
Stupid window users 

Re: JVM config for tomcat5.5

2008-09-21 Thread Johnny Kewl


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

To: [EMAIL PROTECTED]
Cc: 'Tomcat Users List' users@tomcat.apache.org
Sent: Sunday, September 21, 2008 7:51 AM
Subject: RE: JVM config for tomcat5.5


Tomcat requires Java (at least SDK; but JDK won't harm) to be installed. 
On

my machine I usually set:

JAVA_HOME to the installation path for jdk/sdk e.g. /usr/java/jdk1.6.0_07
CATALINA_HOME to the installation path for /usr/apache-tomcat-6.0.16.

Hope this helps.

-Original Message-
From: jaki [mailto:[EMAIL PROTECTED]
Sent: 20 September 2008 08:55
To: users@tomcat.apache.org
Subject: JVM config for tomcat5.5


Hi,
I wanted to know where java_home is set for Tomcat when it's installed as 
a

service since I can't find any .bat/.sh files in my tomcat folder. Thanks
--
View this message in context:
http://www.nabble.com/JVM-config-for-tomcat5.5-tp19583097p19583097.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


Tomcat guys... please pack the the TC.EXE installer with all the script 
files as well...

Windows users do eventually want them...

Its a good question

JAVA_HOME is only used when you run TC from a bat...

On linux it is probably also used by the service but every linux will do 
its own thing, so you need to ask the dist guys...
But on Windows you run TomcatW.exe... you get a nice GUI, you click on 
the JAVA tab, and thats where you set stuff...

Notice that it doesnt use JAVA it uses the java C portal called JVM.DLL.
Thats how you do it...

And then in Netbeans the JRE used is neither of the above, its uses the 
JRE that you have set on the platform for you projects


It actually makes it very easy... and its nice being able to start it from 
script on one JRE, from the service on another JRE, and from NB on any JRE 
you want.


And you have to... because you may use templates in your servlets... and all 
is well, but flip the JRE to a lower version, and you get nailed.


... these TC guys are pretty clever dudes ;)

---
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: jstack and Tomcat 6 on Windows

2008-09-20 Thread Johnny Kewl


- Original Message - 
From: Brian Clark [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Saturday, September 20, 2008 12:58 AM
Subject: Re: jstack and Tomcat 6 on Windows



Thanks everyone for their suggestions.

Unfortunately, that doesn't help me with my particular issue. I have a 
memory leak in one of my apps, and when the system runs out of memory, it 
stops responding to new requests. I have a script that will detect this 
condition and automatically restart Tomcat. I was hoping to add a jstack 
command to this script to give me a thread dump prior to restarting Tomcat 
to give me better troubleshooting information. Your solution would work 
under normal circumstances, but I don't know how to script a ctrl+break. 
;-)




Oh... I dont know if trying to find the issue on production server is going 
to be easy...

Out Of Mem ... scary start praying that it is, one of your apps...
Normally JMeter and a quiet system is the easiet way to find which one is 
the problem...


The later JDK's 6 do what you looking for... google for JHAT... here ...
http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html

Notice the HeapDumpOnOutOfMemoryError java option...

And also check out JMX, JConsole you may find all that useful... esp the 
force heap garbage collection option.


Another rough guide is runs the various web-apps thru the browser... and 
watch the window handles... not the memory...
If that keeps sliding up... thats the bad webapp... trouble with all the 
Java monitoring stuff is that unless a GC is done (at least twice), what you 
looking at doesnt mean much


I've never tried the JHat stuff... but they made it because OOM errors are a 
nightmare... let us know if JHat is the thing we all being waiting for ;)


Good Luck ;)

---
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: jstack and Tomcat 6 on Windows

2008-09-20 Thread Johnny Kewl

Thanks everyone for their suggestions.

Unfortunately, that doesn't help me with my particular issue. I have a 
memory leak in one of my apps, and when the system runs out of memory, it 
stops responding to new requests. I have a script that will detect this 
condition and automatically restart Tomcat. I was hoping to add a jstack 
command to this script to give me a thread dump prior to restarting 
Tomcat to give me better troubleshooting information. Your solution would 
work under normal circumstances, but I don't know how to script a 
ctrl+break. ;-)





OK... I couldnt resist giving it a little go... JHat is exactly what you 
looking for...

http://weblogs.java.net/blog/jfarcand/archive/2006/02/using_mustangs.html

Well done Sun... its exactly what I've been looking for...

Let the server run a little do a dump, run the server and then from the 
browser to the HIST option...


The highest non Sun class... webapp class... is going to be the bad guy ;)

Damn thats nice...

---
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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-19 Thread Johnny Kewl


- Original Message - 
From: sinoea kaabi [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, September 19, 2008 9:18 AM
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




You aren't using any class-level
members in your static methods so you should be fine.

This means that I cannot declare a:

public class Data {

private static DataSource datasource = null;

public static DataSource getDataSource() {
 if (datasource == null) {
// create a datasource
 }
 return datasource;
}

}

In the code above the class-level member is the datasource.

Do you mean I should do like this instead:

public class Data {


public static DataSource getDataSource() {

 // create a new datasource for each call to this method

 return datasource;

}



}

---

Hi sinoea

If a datasource in DBCP represents the pool... you cant, you'd make a 
million data pools...


These are the innocent looking things that can give problems...

The new trick to isolate the class global vars wont help in this case
So in theory... all access to that datasource variable should be synch'd...

In the routine you showing and in all the others that use it...

You dont sync at method level
public static DataSource getDataSource()

you just sync access to that shared global

The Java tut has examples of the various ways to sync method and code 
sections...


As soon as more than one thread is sharing something... you either try 
change the structure so that its not shared
or you sync it... it is normally too difficult to imagine the possible race 
conditions...

The java tut has some example on just how tricky it can be as well...

---
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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-19 Thread Johnny Kewl

Heres the blurb on the stuff...

http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html/01/

Where I spoke about the New Trick... they blab on about immutable..
The stuff you prbably want to look at is
Synchronized Statements

In C they talk about semisphores and stuff... if you come from there, its 
that made easier...


You cant jam sync statements everywhere... that will have some surprizing 
results as well... just where they needed...


... no expert... I just try avoid shared stuff to begin with

... the book has the truth ;)

---
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: jstack and Tomcat 6 on Windows

2008-09-19 Thread Johnny Kewl


- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, September 19, 2008 11:42 PM
Subject: Re: jstack and Tomcat 6 on Windows



André Warnier wrote:

Brian Clark wrote:

Hello,

I run Tomcat 6.0.x as a service on Windows 2003, using Sun JDK 1.6. I 
was trying to use the jstack program, part of the JDK, to get a stack 
dump from Tomcat/Java on my server. However, I ran into a problem. First 
of all, Tomcat on Windows seems to hide the JVM instance. Java doesn't 
show up in my process listing. I tried running jstack against the 
Tomcat PID but it errored out.
Any idea how to make jstack work with Tomcat running as a service on 
Win2k3?



I can't answer your question, but a look here might provide a clue :
http://commons.apache.org/daemon/procrun.html

That seems to be the way in which Tomcat is now implemented under 
Windows. Versions prior to 5.5 used to have a structure similar to the 
Unix version, with startup.bat and catalina.bat invoking Tomcat via Java, 
but that seems to have changed nowadays.


Also, if it might help somewhat : open a command window and navigate to 
the Tomcat/bin directory. Then, instead of running tomcat as a service, 
just enter the tomcatx.exe command (where x is probably 6 in your case) 
(not the tomcatxW.exe). That will run Tomcat in the command window, maybe 
easier for you to figure out what is going on.

Not for me though.



Addendum :
I just had another look at the Tomcat site. For version 5.5, there are 2 
downloads for Windows : one is a zip, the other an msi installer.

I must have in the past downloaded and installed the msi.
I downloaded the zip version now, and that one seems to contain the usual 
startup.bat and catalina.bat files, in addition to the Win32 tomcat5 and 
tomcat5W executables.
Maybe the .bat files allow to start Tomcat in the traditional way, via 
Java etc.. ?



As a Service the PID is TomcatX

From the start.BAT its JAVA


The easiest way to get the PID is to type
netstat -noa
Its the one next to the port you on...

On windows... you install your service version EXE
Then you download the zip version and copy the missing BIN scripts across... 
then you have all the files


If you need thread dumps

Start TC from the BAT file.
When you need a dump... press ctrl + break from term window... easier than 
Jstack...


Andre is right. as a service Tomcat appears under the non normal java... 
because its started from a windows service... not launched as a normal java 
process.


---
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: Tomcat 5.5, JNDI Connection Pooling, Active connections keepincreasing....

2008-09-18 Thread Johnny Kewl


- Original Message - 
From: Caldarale, Charles R [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Thursday, September 18, 2008 5:26 AM
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections 
keepincreasing




From: sinoea kaabi [mailto:[EMAIL PROTECTED]
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active
connections keepincreasing

I could accept the fact that we should create new objects of Dao's,
but for getting a datasource or connection it should make sense
to have a utility class with static methods.


Absolutely - Johnny K's suggestion of doing a new every time is utter 
nonsense.


---

I eat humble pie you right... completely off track...

One of the problems is that I'm not thinking framework... and sinoea is in 
one.
Also not having used DBCP I'm at a disadvantage here... maybe should just 
shut the hell up...


As I see it... sinoea is creating a singleton... to hold that data source... 
he has to because the control servlet is inside a framework, so he is 
holding a pool from the fridge of the framework...


So... struts people... just help this guy...
Does struts have a better built in way to manage the pool... so he can just 
get the reference to it?
If not... what is standard practice for using a third party pool in the 
struts framework...


He's into holding stuff in statics... because he is trying to keep a single 
instance of the pool available to all the rest of his action objects...


Thats what he's asking... what is the right way to do that in struts 
like maybe its standard practice to hold DHCP in a servlet context 
attribute... or maybe struts has a really clever way of doing that for 
you... thats the question?


... my suggestions do suck... what is the right way in struts to hold that 
3rd party pool dish out references where they needed ?


---
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: Tomcat 5.5, JNDI Connection Pooling, Active connections keepincreasing....

2008-09-18 Thread Johnny Kewl


- Original Message - 
From: sinoea kaabi [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Thursday, September 18, 2008 1:24 PM
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections 
keepincreasing




Struts datasource usage is deprecated, they encourage users not to try their
datasource configuration in  the xml.
Instead I was advised to manually configure JNDI connection pooling with 
Struts.



Ah... the thlot pickens

---
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: Tomcat as Windows service and output window

2008-09-18 Thread Johnny Kewl


- Original Message - 
From: SerFingolfin [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Thursday, September 18, 2008 10:44 AM
Subject: Tomcat as Windows service and output window




Hi to everybody!
I installed Tomcat as service in Windows XP.
In my application i use java.awt.TrayIcon to show an icon in system 
Traybar.
If i start tomcat (as service) without checking allow service interact 
with
Desktop i don't see my icon on system traybar. Checking that flag makes 
my

icon appear and working well, but tomcat's output window also appears...is
there a way to hide it?
Thanks in advance.
--
View this message in context: 
http://www.nabble.com/Tomcat-as-Windows-service-and-output-window-tp19548553p19548553.html

Sent from the Tomcat - User mailing list archive at Nabble.com.


Interesting

I think you probably into a little Win32 API

I vaguely remember ShowWindow(yada blah)...
and there is a way in Win32 to also get the window handle from the window 
name... I've forgotten..

so thats a little JNI

I dont think its too easy

Another rather weird way of maybe tackling it... is that Java as a JavaW 
variation on windows...
JavaW starts a java program without a window... so a little messing around 
with BAT files will let you see if the task bar still works with that... I 
imagine it does...


Then just leave the service as a service... because it runs without a 
user or dont use a service at all and start TC from the RUN folder in 
windows
But then you are going to have to add something to you task bar to let the 
guy shut it down... a process to shutdown.bat because the use is blind...


Then the service itself in tomacat is a program called Procrun... in fact 
its just renamed to TomcatW...
it doesnt work with java in works with java's dll ie its starting the 
bootstrap classes from C code
But you can redirect that to any java class you like with the right 
interface so you could start your SuperTaskBarJava.class... it does a 
JavaW tomcat... or startup bat calling JavaW and then if the user closes 
the services... your SuperTaskBarJava.class will do it...


... Take your pick... I think they all lots of work ;)

Hopefully one idea there works 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: Tomcat as Windows service and output window

2008-09-18 Thread Johnny Kewl


- Original Message - 
From: SerFingolfin [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Thursday, September 18, 2008 5:29 PM
Subject: Re: Tomcat as Windows service and output window




Thanks for your help!
But that's not so easy doing that...
I was wondering how Netbeans can make my traybar work
hiding tomcat's output window at the same time!
And not only hide : they can redirect tomcat's output to a text area
inside the IDE...



Netbeans doesnt start TC as a service?
Its probably starting TC with
   JavaW

ie Java (shows terminal)
JavaW (does not)

A windows service is a different animal that starts TC thru a JVM.dll

Netbeans is capturing the PrintStream... google for PrintStream System

Because a normal user started NB... the processes are running in that users 
name and they have desktop rights...

A service does not (windows thing) unless allow whatever is set.

So all NB is doing is
   JavaW tomcat
   Capture printstream

I'm not sure how much you can see in the ant script... but how they launch 
TC is probably there...


A service... is a different story... because they run even when no one has 
logged on...


... something like that ;)

Linux is much easier... same trick with a little  behind it ;)

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: Invoking JSP/servlet from non-request thread?

2008-09-18 Thread Johnny Kewl


- Original Message - 
From: Jess Holle [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Thursday, September 18, 2008 6:36 PM
Subject: Invoking JSP/servlet from non-request thread?



I want to invoke JSPs/servlets from non-request threads, e.g. to render
HTML for use in e-mails, etc.

I tried the simple-minded approach (with Tomcat 6.0.18):

   ServletContext  servletContext = MyContextMonitor.getContext(
   /myContextName );
   RequestDispatcher  dispatcher =
   servletContext.getRequestDispatcher( /somePage.jsp );
   dispatcher.include( new Request( servletContext ), new 
Response() );


where Request and Response are mock HttpServletRequest and
HttpServletResponse implementations.  Response's output stream and
writer are routed to System.out.

I get the dispatcher fine.  I get output if I use
/somePropertiesFile.properties in place of /somePage.jsp -- but only
if I use include(), not forward().  I don't get output for /somePage.jsp
in either case.

Any ideas?  Anyone /successfully /doing this sort of thing?

Is there an existing library for this that I'm overlooking?  It seems
really bizarre that for all the time and energy invested in servlet and
JSP based HTML page generation that there's not a standard bridge to
using servlets and JSPs from other threads to generate HTML files,
e-mails, etc.

--
Jess Holle


Jess, someone a while back was trying something similar, and I dont think 
they came right...
Part of the reason is that even though TC makes is look simple, its one hell 
of an engine... like for example the buffering and things like chunking, 
where its not actually happening in one conversation...
I think you going to find it much easier just making a dummy http client... 
Url Connection or something like that.


If it was just JSP's and one was trying to generate html, I would guess that 
tying straight into Jasper with a dummy engine may work...


I would also just google for MIME and things like JavaMail... in the hope 
you stumble onto engines/tricks others are using...


good luck
---
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: question about realm auth and digest attribute

2008-09-18 Thread Johnny Kewl


- Original Message - 
From: Joe A [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Thursday, September 18, 2008 8:07 PM
Subject: question about realm auth and digest attribute



if i'm going to be using sha-1 for the encryption, do i just specify
digest=SHA, digest=SHA1, digest=SHA-1?

thanks,
joe


SHA, MD2, or MD5... I think

I cant remember the reasons off hand, but in practice its MD5 only.

(help me here people)

---
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: staging

2008-09-18 Thread Johnny Kewl


- Original Message - 
From: Frank Uccello [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Thursday, September 18, 2008 10:42 PM
Subject: staging


I have a test server and a staging server: In the test server I have two
war files abclaunch.war and abcota.war
It works fine when I pull up it from the web browser

I copy this two file to the staging but it shows me the old version on
the staging web page I have confirmed there the same release date and
size I have also restart tomcat server for this webapp I now stuck I not
sure how do I get the test and staging to be same version why keep
showing the old version even though the war files are the same...

I also to test delete the files from staging and no web page shows up so
I know it is call from the correct directory


Please help

Frank

---
Frank... maybe a browsr caching, but unlikely.
Maybe... autodeploy not set, but unlikely
But one way to make sure... its use /manager/html
and undeploy the old one
Then also use that to deploy or drop the wars in...

Also do that on your test server because very often its the test server that 
is actually fooling you, because its not looking at the wars, its looking at 
the IDE.


If you get a funny in TC... undeploy old stuff... then drop in... especially 
on the dev env with IDE's attached to that TC

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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-17 Thread Johnny Kewl


- Original Message - 
From: sinoea kaabi [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 11:31 AM
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




Thanks,
First I will try to close resources before returning.

Although I am sure that the finally blocks are reached, since I use logging 
in the last finally block and the log is

outputted.

try {

} finally {
  connection.close();
  Data.logConnection(connection); // this is logged
}

But  I'll give it a try anyway.

Object object = null;
try {

} finally {
   close resources..
}
return object;


The static methods are not thread-safe you say!

So, what exactly does it mean when we say that Tomcat is thread safe for 
requests.

Tomcat creates a new thread for each request, so somehow my static methods
are then thread safe (incdirectly, since it is managed by Tomcat).

Request A  new Thread A  using my static method for loadBranches(...)
Request B  new Thread B  using my static method for loadBranches(...)

Thread B must wait until Thread A is done.

Since threads are managed by tomcat, no thread should be able to use a 
static method that is used by another thread.


Or in fact, you must be right, should I declare them synchronized?

public static synchronized loadBranches(...)

Thanks,
Sinoea

=

Yes your finally blocks are working I checked that... the book is right 
;)



On threading. No just make the class *non* static

CollectionBranch branches =  *NEW* 
BranchData().loadBranches(Data.getDataSource(), 1);


so now each thread has its own class.

I imagine thats tomcats pool is already thread safe...

synchronized will work... but its a bottle neck... it will make tomcat Q... 
and there is a setting in tomcat somewhere where one can make it single 
threaded... but again it will slow it down... you only use that when a coder 
has cocked up ;)


In threading the thing to watch is those global variables... so without 
seeing your actual code its difficult to spot problems...

Thread safety is more of an art than a science...

New should do it because every thread is getting its own class... so a class 
is isolated, the connection and everything else is inside it... and they 
cant mess with each other... in theory... if there are no shared globals...


So I think whats happening in your static class is something like this...

Thread 1 opens connection 1 inside class
Thread 2 open connection 2 also inside class

Close connection 2
Close connection 2

ie same connection is no closed twice and connection 1 slips out... that 
wont happen if the class in not static...


 I think ;)

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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-17 Thread Johnny Kewl


- Original Message - 
From: sinoea kaabi [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 12:48 PM
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




Just a question here,
I am using a Data class to retrieve the datasource

public class Data {

/**
* Gets a [EMAIL PROTECTED] DataSource} for database connection usage.
* @return The datasource for database connection.
* @throws SQLException
*/
public static DataSource getDataSource() throws SQLException {
if (ds == null) {
DATASOURCE.info(DataSource is NULL );
MANY_CONNECTIONS.info(DataSource is NULL );
try {
final Context initContext = new InitialContext();
ds = (BasicDataSource)initContext.lookup(java:/comp/env/jdbc/myDB);
initContext.close();
logDataSource(ds);
return ds;
} catch (final NamingException e) {
e.printStackTrace();
throw new RuntimeException(Java naming exception when getting connection 
from tomcat pool:  + e.getMessage());

}
} else {
logDataSource(ds);
return ds;
}
   }

}

=
Sineoa, my feeling is dont use static, unless you really want it in a 
multithreaded environment

It pumps all the threads thru one pipe...

So yes I would *new* that as well...

But note this is where you will better be server by a DBCP user... because 
we dont use it...


ie someone may say that declaring the Context as static is standard practice 
and saves time... but I dont think so


You cant really go wrong by making it new... but you can get nailed by 
making it static ;)


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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-17 Thread Johnny Kewl


 So, what exactly does it mean when we say that Tomcat is thread safe 
 for

 requests.
 Tomcat creates a new thread for each request, so somehow my static 
 methods

 are then thread safe (incdirectly, since it is managed by Tomcat).


I actually searched all over to try find something for you this looks ok
http://www.codestyle.org/java/servlets/faq-Threads.shtml


But here my un-scientific way of thinking about it...

When tomcat sends a thread into your doGet method...
All those local variables in that thread are ok...

So I think about it as each thread being a lane on a big freeway/highway...

So yes you right in a way... Tomcat isnt allowing those local method 
variables to get mixed up...
but the second you decalare a static method or static variable... you had 
better be sure its thread safe.


What happens to that highway is that all the lanes merge into one, and every 
car has to go through it...


When you add synchronized... your 30 lane high way becomes a single lane and 
its one car at a time...


You dont want to add synchronized because here you have the TC guys gone 
thru all the hassle of making sure you can have a 30 lane highway... and you 
bang it into one lane so new is better because each lane gets its own 
engine... and java is pretty damn good at garbage collecting, that little 
bit of memory is a blip on the radar screen...


You got to really know what your code is doing when its static... you got to 
know its thread safe, and it can be really hard to see that 30 car pile up 
coming on the highway ;)


My way of thinking about this stuff. mad science - chapter 1 ;)

---
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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-17 Thread Johnny Kewl


- Original Message - 
From: David Smith [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 3:40 PM
Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




Comments inline ...

Johnny Kewl wrote:



 So, what exactly does it mean when we say that Tomcat is thread
safe  for
 requests.
 Tomcat creates a new thread for each request, so somehow my static
 methods
 are then thread safe (incdirectly, since it is managed by Tomcat).


I actually searched all over to try find something for you this
looks ok
http://www.codestyle.org/java/servlets/faq-Threads.shtml


But here my un-scientific way of thinking about it...

When tomcat sends a thread into your doGet method...
All those local variables in that thread are ok...

As long as you mean variables defined inside of the doGet() method.
Class instance variables are not cool in servlets.


So I think about it as each thread being a lane on a big
freeway/highway...

But objects are not thread local unless they are setup that way
implementing something like ThreadLocal.  Only the references to the
object are local.


No... ouch mention 2 words in a sentence and association kicks in ha ha
I'm saying...
These local variables are completely private; there is no way for one thread 
to access the local variables of another thread.

Nothing at all to do with ThreadLocal...



So yes you right in a way... Tomcat isnt allowing those local method
variables to get mixed up...
but the second you decalare a static method or static variable... you
had better be sure its thread safe.

Let's not confuse static methods and static variables.  Static variables
should be avoided unless they are true constants.  Static methods on the
other hand are fine, but need to be careful when those static methods
interact with object instances that may not be thread safe.


All true... but damn hard to see when you plugged into someone elses 
engine...
... in your own code in a static method, only have to worry about your 
globals...
But someone elses code... not easy... unless they explicitly say thread 
safe.




What happens to that highway is that all the lanes merge into one, and
every car has to go through it...

Now your are talking about a singleton -- a whole different ball of wax.


No... I'm not... its actually your C analogy


When you add synchronized... your 30 lane high way becomes a single
lane and its one car at a time...

Still in singleton land with the one lane analogy.  Syncs do add a huge
performance penalty though, so even outside of singletons, syncs should
be avoided as much as possible.


You dont want to add synchronized because here you have the TC guys
gone thru all the hassle of making sure you can have a 30 lane
highway... and you bang it into one lane so new is better because
each lane gets its own engine... and java is pretty damn good at
garbage collecting, that little bit of memory is a blip on the radar
screen...

You got to really know what your code is doing when its static... you
got to know its thread safe, and it can be really hard to see that 30
car pile up coming on the highway ;)

My way of thinking about this stuff. mad science - chapter 1 ;)

Johnny -- You might find the java language reference an interesting
read.  It describes all the rules regarding threading, access, value vs
reference variables, etc., ...


Maybe you want to tell us why it is his code is leaking connections?
What is it exactly in his code thats jumping a connection?
Do you know?


-
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 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-17 Thread Johnny Kewl


- Original Message - 
From: sinoea kaabi [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 4:48 PM
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




This question about static variables seems a bit deeper than I
thought, the more I think about it the more confused I get.

I could accept the fact that we should create new objects of Dao's,
but for getting a datasource or connection it should make sense
to have a utility class with static methods.

CollectionBranch branches = new BranchDao().loadBranches(
new DBUtil().getDataSource(),  // This feels crap, I'd rather use 
DBUtil.getDataSource() (without new)

1);


DBUtil should have static methods for retrieving a datasource or a 
connection,

creating a new DBUtil for each request does not feel right.

Well, you say that static methods don't necessarliy improve performance
in the long run, but why does the code at the bottom work for others.


And what is a thread-safe object:
An object whose state cannot be modified

So is a connection a thread-safe object or not?
It looks like you can modify its state (closing and opening it)

Below is a new connection object created, it is therefore
not a static class variable, only the method is static.
This means that the method should be thread safe, since a new connection
object is created for each thread.



public static Connection getConnection(){

   try {

   Context context =(Context) new 
InitialContext().lookup(java:comp/env);


   DataSource dataSource = (DataSource) context.lookup(jdbc/FooBar);

   Connection connection = dataSource.getConnection();

   return connection;

   } catch (NamingException namingException) {

   log.fatal(namingException);

   throw new RuntimeException(namingException);

   } catch (SQLException sqlException) {

   log.fatal(sqlException);

   throw new RuntimeException(sqlException);

   }

}

sinoea, of course you can... that looks thread safe... but what I'm trying 
to do, is just make it bullet proof...
You leaking connections, we dont know why... so idea is to try take any 
threading issues out of the equation...
Then you run it, it works... you play with the code...add your routines 
back... find whats causing it...
 and then you going to tell us why it was leaking thats what we 
dying to know;)


You wont be the first person that stared at a piece of code for 2 days and 
not seen the threading issue...

It can be really hard to spot...

If a person gives you a class and says... this is NOT thread safe... what 
you going to do with it?

Thats the thing I'm showing you...

David right, I'm no teacher... but I've done it a million times... send me 
your code, I'll find the problem for you...


---
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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-17 Thread Johnny Kewl


- Original Message - 
From: sinoea kaabi [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 4:48 PM
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




This question about static variables seems a bit deeper than I
thought, the more I think about it the more confused I get.

I could accept the fact that we should create new objects of Dao's,
but for getting a datasource or connection it should make sense
to have a utility class with static methods.

CollectionBranch branches = new BranchDao().loadBranches(
new DBUtil().getDataSource(),  // This feels crap, I'd rather use 
DBUtil.getDataSource() (without new)

1);


DBUtil should have static methods for retrieving a datasource or a 
connection,

creating a new DBUtil for each request does not feel right.
--
Are you an ex C programmer
Sounds like it... theres a couple strange feeling things in Java...

   String x = new Thing();

in a loop is something else you see a C programmer wants to stick the
declaration outside the loop... so its easy to clean up java nah... that 
garbage collector is pure magic ;)


You get used of it...

There is a pretty good threading tut in the famous Java Tutorial...
Normal stuff, like race conditions... yada yada... its good reading
but when you actually doing it... its a feeling... because its a timing 
issue.

No error message that says anything... just wrong values.

---
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: URLEncoding of \ Character

2008-09-17 Thread Johnny Kewl

- Original Message - 
From: Erik Onnen [EMAIL PROTECTED]
To: users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 8:51 PM
Subject: URLEncoding of \ Character


 Verified on 6.0.16 and 6.0.18, 2.6.24 Linux kernel, JVM 1.6.0_10-beta. When
 I attempt to encode a \ character into a url resulting in a %5C in the URL
 on the wire, I'm seeing a 400 from the server and none of my code is hit.
 I've tried URLEncoding=UTF-8 on the connector with no luck. Same URL
 serves fine on Jetty6. Other encoded, non-URL safe chars seem to work fine.
 
 A sample of the URL on the wire looks like:
 
 GET /people/s%5Clash
 
 I'm hoping someone can tell me I've encoded the URL wrong and that Tomcat is
 doing the correct thing. Anybody seen similar issues?


Re: URLEncoding of \ Character

2008-09-17 Thread Johnny Kewl


- Original Message - 
From: Johnny Kewl

To: Tomcat Users List
Sent: Wednesday, September 17, 2008 9:26 PM
Subject: Re: URLEncoding of \ Character



- Original Message - 
From: Erik Onnen [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 8:51 PM
Subject: URLEncoding of \ Character


Verified on 6.0.16 and 6.0.18, 2.6.24 Linux kernel, JVM 1.6.0_10-beta. 
When
I attempt to encode a \ character into a url resulting in a %5C in the 
URL

on the wire, I'm seeing a 400 from the server and none of my code is hit.
I've tried URLEncoding=UTF-8 on the connector with no luck. Same URL
serves fine on Jetty6. Other encoded, non-URL safe chars seem to work 
fine.


A sample of the URL on the wire looks like:

GET /people/s%5Clash

I'm hoping someone can tell me I've encoded the URL wrong and that Tomcat 
is

doing the correct thing. Anybody seen similar issues?


Would help if I said something in the first post hey ;)

Not sure what you up to exactly but
%5C  is right for \
but \
I thing is probably an illegal servlet or file name, so it cant work

If its part of a query... then its because you missing the ?
eg:

GET /path/script.cgi?field1=value1field2=value%5C2 HTTP/1.0

... I think
---
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: URLEncoding of \ Character

2008-09-17 Thread Johnny Kewl


- Original Message - 
From: Mark Thomas [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 10:01 PM
Subject: Re: URLEncoding of \ Character



Johnny Kewl wrote:

Would help if I said something in the first post hey ;)

Not sure what you up to exactly but
%5C  is right for \
but \
I thing is probably an illegal servlet or file name, so it cant work


On what basis? The OPs request is completely legal.

Mark


GET /people/s%5Clash

Just looked odd to me

GET /people/s\lash

You right... but I cant think of a reason to write it like that in the first 
place


Why are you writing it like this?

Like a windows path getting mixed with a url... and then why encode it?

Doesnt seem strange to you?

Ok... works I guess ;)

---
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: URLEncoding of \ Character

2008-09-17 Thread Johnny Kewl


- Original Message - 
From: Erik Onnen [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 10:27 PM
Subject: Re: URLEncoding of \ Character



Thanks Mark, much appreciated. I had no idea the extra system props even
existed.

On Wed, Sep 17, 2008 at 12:07 PM, Mark Thomas [EMAIL PROTECTED] wrote:


Erik Onnen wrote:
 Verified on 6.0.16 and 6.0.18, 2.6.24 Linux kernel, JVM 1.6.0_10-beta.
When
 I attempt to encode a \ character into a url resulting in a %5C in 
 the

URL
 on the wire, I'm seeing a 400 from the server and none of my code is 
 hit.

 I've tried URLEncoding=UTF-8 on the connector with no luck. Same URL
 serves fine on Jetty6. Other encoded, non-URL safe chars seem to work
fine.

 A sample of the URL on the wire looks like:

 GET /people/s%5Clash


Erik... why does this happen?
Trying to understand why you end up with this url?
Why cant you just turn it into this?
/people/s/lash

---
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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-17 Thread Johnny Kewl


- Original Message - 
From: sinoea kaabi [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 9:56 PM
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




Right, I have attached the source code.

I have included the whole package with the database classes.
Also, I have included the package with three action classes, in reality 
there are more action classes but it would be a nightmare,
and also the database classes are used quiet similarly in other action 
classes.


This is a Struts web application, so action classes are used.

= Arrrg not our favorite... should be fun

Notice on some database classes where I use the connection in several inner 
methods:


public static void doSomething(datasource) {

 Connection connection = datasource.getConnection();
 try {
innerMethod(connection);
anotherInnerMethod(connection);

 } finally {
 connection.close();  // should be OK to use the connection in 
inner classes, as the connection gets finally closed.

 }
}


private static void innerMethod(connection) {
Statetement statement = connection.createStatement();
try {

} finally {
 statement.close();
}
}


If you spot a problem then FANTASTIC.

I have had this problem for years and I really want to solve the problem 
now.


Also, I would be grateful if you could let me know how you design your 
database classes.


= Everything is ours we dont use frameworks
= Pools, Persistence... all our own stuff... makes it kind of easy to find 
problems ;)


The whole pattern and usage basically.

= KISS... keep it simple stupid ;)
= Basic TC MVC patterns... you can read up on them on the web... MVC 
methodology, not a framework

CoreServlets has some nice articles

Thanks for putting up with me so far

= Hey I'm bored stiff... our banks are still running here... ha ha...

= Its almost midnight here... we'll play with it in the morning... looks 
like you on the same time zone


---
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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-17 Thread Johnny Kewl


- Original Message - 
From: André Warnier [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, September 17, 2008 10:18 PM
Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




Caldarale, Charles R wrote:


That's completely erroneous.



Shame, Johnny's story was so nice..


I didnt even get to toll booths on the highway... when the threads have to 
all stop there, thats the global variable, can be dangerous, if you sharing 
one with oncoming traffic ;)


No doubt not a chapter in the University Java Hand Book ;)
---
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: disable caching of static files in tomcat 5.5

2008-09-16 Thread Johnny Kewl


- Original Message - 
From: Joerg Endrullis [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Tuesday, September 16, 2008 1:13 PM
Subject: disable caching of static files in tomcat 5.5



Hi,

I have a dynamically generated image a.jpg
and I want Tomcat to always deliver the current version.

Unfortunately Tomcat seems to have some kind of caching of static files?
Where can one disable caching of static files in Tomcat?

Why do I think Tomcat has caching of static files...

You can reproduce the problem as follows:
- create two different images x.jpg and y.jpg
- then create a symbolic link from a.jpg to x.jpg, download a.jpg,
 change the symbolic link to y.jpg, download a.jpg again:

 $ ln -s x.jpg a.jpg;
 $ wget http://localhost:8180/a.jpg?time=0;
 $ rm a.jpg;
 $ ln -s y.jpg a.jpg;
 $ wget http://localhost:8180/a.jpg?time=1

You will see that both downloaded images a.jpg.1 and a.jpg.2 are equal to 
x.jpg,

which leads to the conclusion that Tomcat uses some kind of caching.
(in order to reproduce the problem, the commands have to be
executed fast after each other, if you wait 5 seconds before the last 
wget,

then Tomcat returns the correct image)

Btw. it does not help to attach an artificial time-stamp to the URL:
 $ ln -s x.jpg a.jpg;
 $ wget http://localhost:8180/a.jpg?time=0;
 $ rm a.jpg;
 $ ln -s y.jpg a.jpg;
 $ wget http://localhost:8180/a.jpg?time=1
will produce identical images a.jpg?time=0 and a.jpg?time=1.

Any help would be appreciated.

Thanks,
Joerg


Joerg, not sure here... but this is what I think is happening...
The images are been delivered to the page using ETAGS... basically they look 
at the file on disk size and modified time...
If that changes they send it, if it does change it, nothing is sent to the 
browser...


It seems to imply that symboloc links are not changing these links... but I 
dont think linux is that stupid...
So I think its just the browser hanging on so try this... in the main 
JSP servlet/html page do this...


response.setHeader(Cache-Control, no-cache);
response.setHeader(Expires, Sun, 15 Jan 1998 17:00:00 GMT);
response.setHeader(Pragma, no-cache);
response.setDateHeader(Max-Age, 0);

In html this is all meta tags... just look em up...

Now you saying to the browser do not cache this page... and I'm hopng 
thats the images as well, and that ETAGS are not an issue with links...
ie if it doesnt work... linux is showing tomcat the same modified time 
(doubtful) or tomcat can detect the change of the file, and does not update 
the etag stuff... more likely... hopefully telling the whole page not to 
cache gets around it...


You have to do it all those ways because MS did their own thing... as usual 
;)


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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-16 Thread Johnny Kewl


- Original Message - 
From: sinoea kaabi [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, September 16, 2008 5:10 PM
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing





Yes, as I said in the first post, that I have checked through all the code,
and I am closing all the connections (in a finally block) after they have 
been used.




final Connection connection = datasource.getConnection();
try {



BUT you have a
 return branches; 
HERE


It can never get to HERE

Just put the return after the finally


blah .. blah
} finally {
  connection.close();
}


Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing

Date: Tue, 16 Sep 2008 11:02:46 -0400
From: [EMAIL PROTECTED]
To: users@tomcat.apache.org

At the end of the servlet or JSP or whichever, you need to kill off
connections created that you establish.



-Original Message-
From: sinoea kaabi [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 16, 2008 9:56 AM
To: Tomcat Users List
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections
keep increasing


How exaclt do you mean?

Anywhere in my code where you have seen that?

Thanks!


Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections

keep increasing

Date: Tue, 16 Sep 2008 10:26:03 -0400
From: [EMAIL PROTECTED]
To: users@tomcat.apache.org

Sounds like you're not explicitly killing off the connections you set
in the first place.

-Original Message-
From: sinoea kaabi [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 16, 2008 4:24 AM
To: users@tomcat.apache.org
Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep
increasing


Dear all,
I seem to have problems with connection pooling.
I have tried so many ways, before I use to get the exhausted scenario,



where there were no connections left to use, and now I am getting a
different problem.

I have been digging in this issue for too long, and I am not sure if I



understand the depth of the connection pooling concept.


I have set the max active connections to 40.

My active connections keep increasing, they never seem to return back
to the pool, eventhough when no-one is visiting the site.
(Well, I have had up to 3 idle connections and that is the most I have



ever had)

After a few days, the active connections reach to 37, and then
afterwards the active connections are reset to 0.

It basically starts from 0 to 37 and then again 0 to 37, and so on


My understanding is that:

1. An active connection is a connection that is currently used, and
not yet returned back to the pool

2. An active connection will be returned back to the pool straight
after its usage and become an idle connection The active connection is



returned back to the pool as soon as you

call the connection.close() method (assuming that you have configured
for connection pooling)

3. An idle connection can only be idle for an X amount of time and
then it will be removed from the pool and get destroyed

4. An idle connection will become an active connection when it is
required and then returned back to the pool as an idle connection when



calling connection.close()


--
--

If that is all correct then why do my active connections keep
increasing?

--
--


Am I closing all the connections?
Well, I have checked every single line of code, and yes I am closing
result sets, statements and connections in a finally block:

[code]
} finally {
results.close();
}

} finally {
statement.close();
}

} finally {
connection.close();
}
[/code]

Please have a look at my code and configuration below:


My environment:
JDK 1.5.0_12
Tomcat 5.5.27
MySQL 5

My Web apps context.xml under the META-INF folder:
[code]

name=jdbc/myDB
factory=org.apache.commons.dbcp.BasicDataSourceFactory
auth=Container
type=javax.sql.DataSource
maxActive=40
maxIdle=10
maxWait=15000
removeAbandoned=true
removeAbandonedTimeout=60
logAbandoned=true
username=username
password=password
driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/mydb /

[/code]

My Host configuration in server.xml
[code]
appBase=webapps/mysite unpackWARs=true autoDeploy=false
xmlValidation=false xmlNamespaceAware=false

className=org.apache.catalina.valves.FastCommonAccessLogValve
prefix=mysite_access_log.
suffix=.txt
pattern=common
directory=C:/Program Files/Apache Software Foundation/Tomcat
5.5/webapps/mysite/logs/ mysite.com

[/code]


Here is the class that I use the get the datasource [code]

import...

public class Data {

private static final Logger SQL = Logger.getLogger(sql); private
static final Logger DATASOURCE = Logger.getLogger(datasource);
private static final Logger MANY_CONNECTIONS =

Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-16 Thread Johnny Kewl


- Original Message - 
From: Brantley Hobbs [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, September 16, 2008 5:27 PM
Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




return statements do not prevent the finally block from executing:

http://java.sun.com/docs/books/tutorial/essential/exceptions/finally.html


I stand corrected...
Always understood as during exception handling... but you right it seems

I just cant bring myself to write code like that... feels un-natural...

I would still put return after the close... apologies...

---
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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-16 Thread Johnny Kewl


sinoea I dont use the JNDI pools, but I've marked a possible issue below...
Dont think its getting to finally guess ;)

On the dB pools I use... connections will not increase... unless that many 
threads are used at same time..
ie the connections represent a max activity level... otherwise it wont 
increase...


... why it resets at 37 I dont know, but I think you are leaking 
connections...




- Original Message - 
From: sinoea kaabi [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Tuesday, September 16, 2008 11:23 AM
Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




Dear all,
I seem to have problems with connection pooling.
I have tried so many ways, before I use to get the exhausted scenario, where 
there

were no connections left to use, and now I am getting a different problem.

I have been digging in this issue for too long, and I am not sure if I
understand the depth of the connection pooling concept.


I have set the max active connections to 40.

My active connections keep increasing, they never seem to return back to the 
pool,

eventhough when no-one is visiting the site.
(Well, I have had up to 3 idle connections and that is the most I have ever 
had)


After a few days, the active connections reach to 37, and then afterwards 
the active connections

are reset to 0.

It basically starts from 0 to 37 and then again 0 to 37, and so on


My understanding is that:

1. An active connection is a connection that is currently used, and not
  yet returned back to the pool

2. An active connection  will be returned back to the pool
  straight after its usage and become an idle connection
  The active connection is returned back to the pool as soon as you

  call the connection.close() method (assuming that you have configured for 
connection pooling)


3. An idle connection can only be idle for an X amount of time and then
  it will be removed from the pool and get destroyed

4. An idle connection will become an active connection when it is
  required and then returned back to the pool as an idle connection
 when calling connection.close()



If that is all correct then why do my active connections keep increasing?



Am I closing all the connections?
Well, I have checked every single line of code, and yes I am closing
result sets, statements and connections in a finally block:

[code]
   } finally {
   results.close();
   }

   } finally {
   statement.close();
   }

   } finally {
   connection.close();
   }
[/code]

Please have a look at my code and configuration below:


My environment:
JDK 1.5.0_12
Tomcat 5.5.27
MySQL 5

My Web apps context.xml under the META-INF folder:
[code]
Context
   Resource
   name=jdbc/myDB
factory=org.apache.commons.dbcp.BasicDataSourceFactory
auth=Container
type=javax.sql.DataSource
maxActive=40
maxIdle=10
maxWait=15000
removeAbandoned=true
removeAbandonedTimeout=60
logAbandoned=true
username=username
password=password
driverClassName=com.mysql.jdbc.Driver
   url=jdbc:mysql://localhost:3306/mydb /
/Context
[/code]

My Host configuration in server.xml
[code]
 Host name=www.mysite.com deployOnStartup=true debug=0 
appBase=webapps/mysite unpackWARs=true autoDeploy=false 
xmlValidation=false xmlNamespaceAware=false

 Valve
 className=org.apache.catalina.valves.FastCommonAccessLogValve
 prefix=mysite_access_log.
 suffix=.txt
 pattern=common
 directory=C:/Program Files/Apache Software Foundation/Tomcat 
5.5/webapps/mysite/logs/

 Aliasmysite.com/Alias
 /Host
[/code]


Here is the class that I use the get the datasource
[code]

import...

public class Data {

   private static final Logger SQL = Logger.getLogger(sql);
   private static final Logger DATASOURCE = Logger.getLogger(datasource);
   private static final Logger MANY_CONNECTIONS = 
Logger.getLogger(manyconnections);

   private static BasicDataSource ds = null;


   public static DataSource getDataSource() throws SQLException {
   if (ds == null) {
   DATASOURCE.info(DataSource is NULL );
   MANY_CONNECTIONS.info(DataSource is NULL );
   try {
   final Context initContext = new InitialContext();
   ds = 
(BasicDataSource)initContext.lookup(java:/comp/env/jdbc/myDB);

   initContext.close();
   logDataSource(ds);
   return ds;
   } catch (final NamingException e) {
   e.printStackTrace();
   throw new RuntimeException(Java naming exception when 
getting connection from tomcat pool:  + e.getMessage());

   }
   } 

Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-16 Thread Johnny Kewl


- Original Message - 
From: Johnny Kewl [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, September 16, 2008 5:17 PM
Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing





- Original Message - 
From: sinoea kaabi [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, September 16, 2008 5:10 PM
Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




Yes, as I said in the first post, that I have checked through all the 
code,
and I am closing all the connections (in a finally block) after they have 
been used.




final Connection connection = datasource.getConnection();
try {



BUT you have a
 return branches; 
HERE


It can never get to HERE

Just put the return after the finally


blah .. blah
} finally {
  connection.close();
}


sinoea
in the context of exceptions finally is always run... exception or 
not...

BUT...
you still have to let the program get there
... you returning too early the connections are not closing...

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: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....

2008-09-16 Thread Johnny Kewl


- Original Message - 
From: Johnny Kewl [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, September 16, 2008 5:41 PM
Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing





- Original Message - 
From: Brantley Hobbs [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, September 16, 2008 5:27 PM
Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep 
increasing




return statements do not prevent the finally block from executing:

http://java.sun.com/docs/books/tutorial/essential/exceptions/finally.html


I stand corrected...
Always understood as during exception handling... but you right it seems

I just cant bring myself to write code like that... feels un-natural...

I would still put return after the close... apologies...



Ok sinoea, what I thought was just s little slip turns out to be right... I 
actually tested it... that finally does run as the method loses scope... I 
actually wonder how they do that... I imagine a destructor in a C class 
underneath Java... its interesting, but I got to tell you, you doing the all 
the good text bokk stuff, but the code makes me feel uncomfortable... 


Anyway... I think you got a threading problem...
You using static class and servlets are multithreaded

Rather do something like this...

CollectionBranch branches =  new 
BranchData().loadBranches(Data.getDataSource(), 1);


and get rid of the static methods in that BranchData class

ie make it thread safe... at the moment you have multiple threads in that 
static method... and with that finally I really dont know... haha


and then...

results.close();
statement.close();
connection.close();
return branches;

Would make me happy... and handle those exceptions

   } catch (SQLException e) {
   branch.setErrorMsg(Dear User, you have run out of 
connections);

   }finally{
   //absolute critical stuff
   }


But that really is just a style thing from the looks of things... although I 
do think that with just a finally, you will still get a ungly servlet 
exception...
ie you are definitely cleaning up... but you not telling the user why... its 
style


You doing all the good stuff... but more important even if you forget a 
final or two... is just a nice clean readable flow... I think ;)


We have a style clash ;)

Anyway thing your problem may go away once its thread safe ;)

Thanks... learnt something ;)
Will keep guessing till we get it ;)
---
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: Interapp Communications

2008-09-15 Thread Johnny Kewl


- Original Message - 
From: Darryl Pentz [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, September 15, 2008 10:37 AM
Subject: Interapp Communications


Some time back I needed to communicate between two apps running in the 
same Tomcat instance. I decided on using a simple HTTP call with Apache 
Commons HttpClient. For some reason use of this class is causing PermGen 
errors (I should add that I use a dynamic language in the mix, which might 
impact that in some way) so I want to abandon that approach anyway, 
because it just doesn't 'feel right' :-).


So I was wondering, is JMS the way to go with something like this? I see 
Tomcat is able to use JMS via a JNDI read-only lookup.


Many thanks,
Darryl Pentz


Well, the way you doing it is also good for cross machine, cross domain 
you using simple SOAP... Axis your way...
That HTTPd client is quite heavy, maybe Java's URL Connection will do what 
you need


I dont bother too much with the stuff out there... JMS is a way, but you 
looking for JNDI registries now.

Not sure if TC built in JNDI... targeting tomcat... will be enuf?
Some very rough code for you to play with... Java really makes http very 
very easy



private byte[] loadURLFileBytes(String urlPlusFile) {

   byte[] data = new byte[0];
   try {
   URL url = new URL(urlPlusFile);

   URLConnection connection = url.openConnection();

   connection.setDoInput(true);//GET
   connection.setUseCaches(false); // get fresh from server
   InputStream in = connection.getInputStream();
   BufferedInputStream bis = new BufferedInputStream(in);

   int length = connection.getContentLength();

   int len;
   byte[] buffer = new byte[512];
   while ((len = bis.read(buffer)) != -1) {
   data = appendBlock(data,buffer,len);

   }

   in.close();
   bis.close();

   } catch(Exception ex) {
   //JOptionPane.showMessageDialog(null, ex.getMessage() , Error 
during data download, JOptionPane.WARNING_MESSAGE);

   return null;
   }

   return data;
}

That all your HTTP is doing for you...
Then Tomcat can do cross contexts as well... theres a cross context flag to 
set and some code that looks like this..

The post also describes the issue...
http://forums.java.net/jive/thread.jspa?messageID=215873

One day when your site is huge, you making millions... maybe your cross 
machine way will sound good again ;)


Theres SOA/EJB as well... ;)

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]



  1   2   3   4   5   6   7   8   >