Tomcat Connection Problem

2009-09-27 Thread Sharath Babu S S S
Hi 
 
  When i checked my log file i found this error.
 

java.sql.SQLException: Connection is closed at 
org.apache.tomcat.dbcp.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:291)

at 
org.apache.tomcat.dbcp.dbcp.DelegatingConnection.createStatement(DelegatingConnection.java:159)

at 
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.createStatement(PoolingDataSource.java:204).

 

 


 
 
With Regards
Sharat Babu Shravanam


Byte and Switch Names Solix Technologies 
One of the Top 10 Startups to Watch
 
Read More at http://www.solix.com/top10startups
-







 CAUTION - Disclaimer *

This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
solely for the use of the addressee(s). If you are not the intended
recipient, please notify the sender by e-mail and delete the original
message. Further, you are not to copy, disclose, or distribute this
e-mail or its contents to any other person and any such actions are
unlawful. This e-mail may contain viruses. Solix has taken every
reasonable precaution to minimize this risk, but is not liable for any
damage you may sustain as a result of any virus in this e-mail. You
should carry out your own virus checks before opening the e-mail or
attachment. Solix reserves the right to monitor and review the content
of all messages sent to or from this e-mail address. Messages sent to or
from this e-mail address may be stored on the Solix e-mail system.


End of Disclaimer **





Re: Cannot set remote address in valve (Tomcat 5.5)

2009-09-27 Thread Mark Thomas
Elli Albek wrote:
 Hi,
 We have Tomcat behind a load balancer. The servlet API and tomcat libraries
 see the load balancer IP as the client IP.
 
 I tried to write a simple valve which will extract the IP from HTTP header 
 X-Forwarded-For
 and continue the valve chain using this IP as the client IP. This will be
 the first valve in the chain, so everything will work as normal afterwards
 including log files, IP filter valve, etc.
 
 The problem I am facing, is when I try to set the remote IP on the request
 from my valve, the code does nothing. This is the set method in the class
 org.apache.catalina.connector.Request:
 
 public void setRemoteAddr(String remoteAddr) {
 // Not used
 }
 
 The variable is protected so I cannot access it directly from my code.
 
 Is there any way to implement this Valve?
 
 Is there anything already shipped in tomcat to extract the client IP from
 the header?
 
 I DO NOT want to write a servlet filter for various reasons, so I hope there
 is a way to do it with a valve.

https://issues.apache.org/bugzilla/show_bug.cgi?id=47330 is on the todo
list but my current plan is to implement it as a Filter rather than a valve.

What is the issue with using a Filter?

If you really want to write a filter than that bug report should be all
you need.

Mark




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat Connection Problem

2009-09-27 Thread Mark Thomas
Sharath Babu S S S wrote:
 Hi 
  
   When i checked my log file i found this error.
 
 java.sql.SQLException: Connection is closed at 
 org.apache.tomcat.dbcp.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:291)
 at 
 org.apache.tomcat.dbcp.dbcp.DelegatingConnection.createStatement(DelegatingConnection.java:159)
 at 
 org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.createStatement(PoolingDataSource.java:204).

http://catb.org/~esr/faqs/smart-questions.html

Mark




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Cannot set remote address in valve (Tomcat 5.5)

2009-09-27 Thread Elli Albek
Thanks for the response. Is there any problem in fixing this method to actually 
set the variable (which is already in the class)?

I think the set methods should actually set the values, so others can write 
such extensions without putting their code in the apache packages.

Right now I guess the only thing I can do is to either use the valve class 
referenced in this bug report or put my class in an apache package, which I 
don't think it belongs to.

I see that the class you pointed to is also in an apache package just for that 
reason.

E

- Original Message -
From: Mark Thomas ma...@apache.org
To: Tomcat Users List users@tomcat.apache.org
Sent: Sun, 27 Sep 2009 02:13:49 -0700 (PDT)
Subject: Re: Cannot set remote address in valve (Tomcat 5.5)

https://issues.apache.org/bugzilla/show_bug.cgi?id=47330 is on the todo
list but my current plan is to implement it as a Filter rather than a valve.

What is the issue with using a Filter?

If you really want to write a filter than that bug report should be all
you need.

Mark




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Error opening zip file /usr/bin/build-classpath

2009-09-27 Thread Andreas Forstmayr
Hello!

I wrote a Java/Spring application and it works on my local SLES 10 testing
vm and all other test systems perfectly. If I deploy it on another SLES 10
SP2 (x86_64) server with Tomcat 5.0.28 and java-1_5_0-ibm-1.5.0_sr7 it also
works at first view, but if I want to view some pages of the app I get the
following error on the screen:

 

Compile failed; see the compiler error output for details.
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:933)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:407)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
 
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
11)
 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
95)
 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
 
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilt
er(FilterChainProxy.java:378)
 
...

 

In the log file:

 

2009-09-25 09:28:25,596 [http-8080-Processor25] ERROR
org.apache.jasper.compiler.Compiler - Env: Compile:
javaFileName=/srv/www/tomcat5/base/work/Catalina/localhost/myapp//org/apache
/jsp/WEB_002dINF/jsp/myjsp_jsp.java
 
classpath=/srv/www/tomcat5/base/webapps/myapp/WEB-INF/classes/:...:/usr/shar
e/tomcat5/common/classes/:/usr/share/java/xerces-j2-2.7.1.jar:/usr/share/jav
a/xerces-j2-2.7.1.jar:/usr/share/tomcat5/common/lib/naming-resources.jar:/us
r/share/tomcat5/common/lib/jasper-compiler.jar:/usr/share/tomcat5/common/lib
/jasper-runtime.jar:/usr/share/tomcat5/common/lib/naming-common.jar:/usr/sha
re/tomcat5/common/lib/naming-factory.jar:/usr/share/tomcat5/common/lib/namin
g-java.jar:/usr/share/java/ant-1.6.5.jar:/usr/share/java/jakarta-commons-col
lections-3.1.jar:/usr/share/java/jakarta-commons-dbcp-1.2.1.jar:/usr/share/j
ava/jakarta-commons-pool-1.2.jar:/usr/share/java/jakarta-commons-logging-api
-1.0.4.jar:/usr/share/java/jakarta-commons-el-1.0.jar:/usr/share/java/jaf-1.
0.2.jar:/usr/share/java/jta-1.0.1.jar:/usr/share/java/javamail/mailapi-1.3.3
_01.jar:/usr/share/java/javamail/imap-1.3.3_01.jar:/usr/share/java/javamail/
imap-1.3.3_01.jar:/usr/share/java/javamail/pop3-1.3.3_01.jar:/usr/share/java
/javamail/mailapi-1.3.3_01.jar:/usr/share/java/javamail/smtp-1.3.3_01.jar:/u
sr/share/java/javamail/pop3-1.3.3_01.jar:/usr/share/java/javamail/smtp-1.3.3
_01.jar:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/server.jar:/usr/shar
e/java/mx4j/mx4j-jmx-1.1.1.jar:/usr/share/java/jspapi-5.0.18.jar:/usr/share/
java/servletapi5-5.0.18.jar:/usr/share/java/log4j-1.2.12.jar:/usr/lib64/jvm/
java-1_5_0-ibm-1.5.0_sr7/jre/lib/core.jar:/usr/share/java/servletapi5-5.0.18
.jar:/usr/share/java/jspapi-5.0.18.jar:/usr/share/java/ant-1.6.5.jar:/usr/sh
are/java/jakarta-commons-collections-3.1.jar:/usr/share/java/jakarta-commons
-dbcp-1.2.1.jar:/usr/share/java/jakarta-commons-pool-1.2.jar:/usr/share/java
/jakarta-commons-logging-api-1.0.4.jar:/usr/share/java/jakarta-commons-el-1.
0.jar:/usr/share/java/jaf-1.0.2.jar:/usr/share/java/jta-1.0.1.jar:/usr/share
/java/javamail/mailapi-1.3.3_01.jar:/usr/share/java/javamail/imap-1.3.3_01.j
ar:/usr/share/java/javamail/imap-1.3.3_01.jar:/usr/share/java/javamail/pop3-
1.3.3_01.jar:/usr/share/java/javamail/mailapi-1.3.3_01.jar:/usr/share/java/j
avamail/smtp-1.3.3_01.jar:/usr/share/java/javamail/pop3-1.3.3_01.jar:/usr/sh
are/java/javamail/smtp-1.3.3_01.jar:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/
jre/lib/server.jar:/usr/share/java/mx4j/mx4j-jmx-1.1.1.jar:/usr/share/java/j
spapi-5.0.18.jar:/usr/share/java/servletapi5-5.0.18.jar:/usr/share/java/log4
j-1.2.12.jar:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/core.jar:/usr/l
ib64/jvm/java-1_5_0-ibm-1.5.0_sr7/lib/tools.jar:/usr/share/tomcat5/bin/boots
trap.jar:/usr/share/tomcat5/bin/commons-logging-api.jar:/usr/bin/build-class
path:/%20error:/%20JVM_LIBDIR%20/usr/lib64/jvm-exports/java-1%20does%20not%2
0exist%20or%20is%20not%20a%20directory:/usr/bin/build-classpath:/%20error:/%
20JVM_LIBDIR%20/usr/lib64/jvm-exports/java-1%20does%20not%20exist%20or%20is%
20not%20a%20directory:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/dt
fj-interface.jar:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/CmpCrmf
.jar:/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/ibmcmsprovider.jar:
/usr/lib64/jvm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/dtfj.jar:/usr/lib64/jvm/
java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/IBMKeyManagementServer.jar:/usr/lib64/j
vm/java-1_5_0-ibm-1.5.0_sr7/jre/lib/ext/gskikm.jar:/usr/lib64/jvm/java-1_5_0
-ibm-1.5.0_sr7/jre/lib/ext/ibmjceprovider.jar:/usr/lib64/jvm/java-1_5_0-ibm-

Re: debugging model classes tied to Tomcat datasources

2009-09-27 Thread David Smith
Eric P wrote:
 Hi,

 (Tomcat newb alert)

 I've got a simple database servlet application that has a few model
 classes on the back end.

 I have the model classes pretty well genericized so that they could
 (almost) be utilized outside of Tomcat by another app, but they do
 utilize the Tomcat data sources I've set up (via an InitialContext
 data source lookup).  So this makes it impossible (?) to execute the
 model classes outside of Tomcat.

 Does anyone have any suggestions about how they would approach this
 problem so that they could debug and/or utilize these model classes
 that rely on database access?

 Thanks for reading.  I'm open to any/all ideas.
 Eric P.

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


I'll bet the only thing your code does with a JNDI string is perform the
lookup and get a Datasource.  You could implement multiple constructors
allowing your code to be initialized w/ a JNDI string, DataSource
object, or url/username/password.  The code utilizing the model classes
would simply create them using which ever constructor it has data for.

--David


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Cannot set remote address in valve (Tomcat 5.5)

2009-09-27 Thread David Smith
Elli Albek wrote:
 Hi,
 We have Tomcat behind a load balancer. The servlet API and tomcat libraries
 see the load balancer IP as the client IP.

 I tried to write a simple valve which will extract the IP from HTTP header 
 X-Forwarded-For
 and continue the valve chain using this IP as the client IP. This will be
 the first valve in the chain, so everything will work as normal afterwards
 including log files, IP filter valve, etc.

 The problem I am facing, is when I try to set the remote IP on the request
 from my valve, the code does nothing. This is the set method in the class
 org.apache.catalina.connector.Request:

 public void setRemoteAddr(String remoteAddr) {
 // Not used
 }

 The variable is protected so I cannot access it directly from my code.

 Is there any way to implement this Valve?

 Is there anything already shipped in tomcat to extract the client IP from
 the header?

 I DO NOT want to write a servlet filter for various reasons, so I hope there
 is a way to do it with a valve.

 Any help appreciated.


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org

   
What about just implementing this as a filter and then construct a
request wrapper in the filter to read that header and override the
getRemoteAddr() method.

--David

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Error opening zip file /usr/bin/build-classpath

2009-09-27 Thread Pid

On 27/09/2009 13:51, Andreas Forstmayr wrote:

Hello!

I wrote a Java/Spring application and it works on my local SLES 10 testing
vm and all other test systems perfectly. If I deploy it on another SLES 10
SP2 (x86_64) server with Tomcat 5.0.28 and java-1_5_0-ibm-1.5.0_sr7 it also
works at first view, but if I want to view some pages of the app I get the
following error on the screen:


Any chance you can upgrade your Tomcat to 6.0 (or even 5.5)?

5.0 is no longer supported - if you're using java 1.5 you should really 
try to use a newer Tomcat version.


p

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: debugging model classes tied to Tomcat datasources

2009-09-27 Thread Mark Shifman

Hi:
This is what I do for testing. I made a class for creating a jndi 
directory and I create this in my main, then I can get a datasource from 
the jndi directory just like I do it when running tomcat.


jndi.properties
java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory
java.naming.factory.url.pkgs=org.apache.naming
java.naming.provider.url=java 



public static void create_JNDI(){
   //jndi.properties must be on the classpath to make the 
initial context
   //you can either add the environment manually vida infra 
or have a jndi.properties file

/*  Hashtable env = new Hashtable();
   
env.put(Context.INITIAL_CONTEXT_FACTORY,org.apache.naming.java.javaURLContextFactory);

   env.put(Context.URL_PKG_PREFIXES,org.apache.naming);
   env.put(Context.PROVIDER_URL,java);
   Context initial = new InitialContext(env);*/
   try {
   Context initial = new InitialContext();
   Context javaCompEnv = initial.
   createSubcontext(new 
CompositeName().add(java:)).

   createSubcontext(comp).
   createSubcontext(env);
   Context jdbc = javaCompEnv.createSubcontext(jdbc);

   DataSource dataSource = setupDataSource();
   jdbc.bind(mydatasourcet, dataSource);
   } catch (NamingException e) {
   throw new RuntimeException(e);
   }

   }

private static DataSource setupDataSource() {
// BasicDataSource is from DBCP commons or it is repackaged by tomcat as 
//org.apache.tomcat.dbcp.dbcp.BasicDataSource
   BasicDataSource ds = new BasicDataSource(); //this is from DBCP 
commons

   ds.setDriverClassName(yourdrivergoeshere);
   ds.setUsername(user);
   ds.setPassword(pwxxx);
   ds.setUrl(yourjdbcurlgoeshere);
   ds.setMaxActive(4);
   ds.setMaxIdle(4);
   return ds;
   }
mas

Eric P wrote:

Hi,

(Tomcat newb alert)

I've got a simple database servlet application that has a few model 
classes on the back end.


I have the model classes pretty well genericized so that they could 
(almost) be utilized outside of Tomcat by another app, but they do 
utilize the Tomcat data sources I've set up (via an InitialContext 
data source lookup).  So this makes it impossible (?) to execute the 
model classes outside of Tomcat.


Does anyone have any suggestions about how they would approach this 
problem so that they could debug and/or utilize these model classes 
that rely on database access?


Thanks for reading.  I'm open to any/all ideas.
Eric P.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: debugging model classes tied to Tomcat datasources

2009-09-27 Thread Martin Gainty

Mark

have you been able to implement JNDI (standalone) in TC?
i see craig's comment on implementing JNDI in org.apache.catalina.Container.java
 * libResources/b - JNDI directory context enabling access to static
 * resources, enabling custom linkages to existing server components when
 * Catalina is embedded in a larger server.
 * /ul
i *thought* Catalina would need to be 'embedded' into A J2EE AppServer (such as 
Glassfish)
to implement JNDI functionality?

thanks,
Martin Gainty 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Date: Sun, 27 Sep 2009 12:38:11 -0400
 From: mark.shif...@yale.edu
 Subject: Re: debugging model classes tied to Tomcat datasources
 To: users@tomcat.apache.org
 
 Hi:
 This is what I do for testing. I made a class for creating a jndi 
 directory and I create this in my main, then I can get a datasource from 
 the jndi directory just like I do it when running tomcat.
 
 jndi.properties
 java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory
 java.naming.factory.url.pkgs=org.apache.naming
 java.naming.provider.url=java 
 
 
  public static void create_JNDI(){
 //jndi.properties must be on the classpath to make the 
 initial context
 //you can either add the environment manually vida infra 
 or have a jndi.properties file
 /*  Hashtable env = new Hashtable();
 
 env.put(Context.INITIAL_CONTEXT_FACTORY,org.apache.naming.java.javaURLContextFactory);
 env.put(Context.URL_PKG_PREFIXES,org.apache.naming);
 env.put(Context.PROVIDER_URL,java);
 Context initial = new InitialContext(env);*/
 try {
 Context initial = new InitialContext();
 Context javaCompEnv = initial.
 createSubcontext(new 
 CompositeName().add(java:)).
 createSubcontext(comp).
 createSubcontext(env);
 Context jdbc = javaCompEnv.createSubcontext(jdbc);
 
 DataSource dataSource = setupDataSource();
 jdbc.bind(mydatasourcet, dataSource);
 } catch (NamingException e) {
 throw new RuntimeException(e);
 }
 
 }
 
 private static DataSource setupDataSource() {
 // BasicDataSource is from DBCP commons or it is repackaged by tomcat as 
 //org.apache.tomcat.dbcp.dbcp.BasicDataSource
 BasicDataSource ds = new BasicDataSource(); //this is from DBCP 
 commons
 ds.setDriverClassName(yourdrivergoeshere);
 ds.setUsername(user);
 ds.setPassword(pwxxx);
 ds.setUrl(yourjdbcurlgoeshere);
 ds.setMaxActive(4);
 ds.setMaxIdle(4);
 return ds;
 }
 mas
 
 Eric P wrote:
  Hi,
 
  (Tomcat newb alert)
 
  I've got a simple database servlet application that has a few model 
  classes on the back end.
 
  I have the model classes pretty well genericized so that they could 
  (almost) be utilized outside of Tomcat by another app, but they do 
  utilize the Tomcat data sources I've set up (via an InitialContext 
  data source lookup).  So this makes it impossible (?) to execute the 
  model classes outside of Tomcat.
 
  Does anyone have any suggestions about how they would approach this 
  problem so that they could debug and/or utilize these model classes 
  that rely on database access?
 
  Thanks for reading.  I'm open to any/all ideas.
  Eric P.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
  

Re: debugging model classes tied to Tomcat datasources

2009-09-27 Thread Mark Shifman

Martin Gainty wrote:

Mark

have you been able to implement JNDI (standalone) in TC?
  

No, I never tried.


i see craig's comment on implementing JNDI in org.apache.catalina.Container.java
 * libResources/b - JNDI directory context enabling access to static
 * resources, enabling custom linkages to existing server components when
 * Catalina is embedded in a larger server.
 * /ul
i *thought* Catalina would need to be 'embedded' into A J2EE AppServer (such as 
Glassfish)
to implement JNDI functionality?

thanks,
Martin Gainty 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




  

Date: Sun, 27 Sep 2009 12:38:11 -0400
From: mark.shif...@yale.edu
Subject: Re: debugging model classes tied to Tomcat datasources
To: users@tomcat.apache.org

Hi:
This is what I do for testing. I made a class for creating a jndi 
directory and I create this in my main, then I can get a datasource from 
the jndi directory just like I do it when running tomcat.


jndi.properties
java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory
java.naming.factory.url.pkgs=org.apache.naming
java.naming.provider.url=java 



 public static void create_JNDI(){
//jndi.properties must be on the classpath to make the 
initial context
//you can either add the environment manually vida infra 
or have a jndi.properties file

/*  Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,org.apache.naming.java.javaURLContextFactory);

env.put(Context.URL_PKG_PREFIXES,org.apache.naming);
env.put(Context.PROVIDER_URL,java);
Context initial = new InitialContext(env);*/
try {
Context initial = new InitialContext();
Context javaCompEnv = initial.
createSubcontext(new 
CompositeName().add(java:)).

createSubcontext(comp).
createSubcontext(env);
Context jdbc = javaCompEnv.createSubcontext(jdbc);

DataSource dataSource = setupDataSource();
jdbc.bind(mydatasourcet, dataSource);
} catch (NamingException e) {
throw new RuntimeException(e);
}

}

private static DataSource setupDataSource() {
// BasicDataSource is from DBCP commons or it is repackaged by tomcat as 
//org.apache.tomcat.dbcp.dbcp.BasicDataSource
BasicDataSource ds = new BasicDataSource(); //this is from DBCP 
commons

ds.setDriverClassName(yourdrivergoeshere);
ds.setUsername(user);
ds.setPassword(pwxxx);
ds.setUrl(yourjdbcurlgoeshere);
ds.setMaxActive(4);
ds.setMaxIdle(4);
return ds;
}
mas

Eric P wrote:


Hi,

(Tomcat newb alert)

I've got a simple database servlet application that has a few model 
classes on the back end.


I have the model classes pretty well genericized so that they could 
(almost) be utilized outside of Tomcat by another app, but they do 
utilize the Tomcat data sources I've set up (via an InitialContext 
data source lookup).  So this makes it impossible (?) to execute the 
model classes outside of Tomcat.


Does anyone have any suggestions about how they would approach this 
problem so that they could debug and/or utilize these model classes 
that rely on database access?


Thanks for reading.  I'm open to any/all ideas.
Eric P.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

  

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


 		 	   		  
_

Hotmail® 

Creating a copy of existing webapp in tomcat

2009-09-27 Thread asuhail100

Hi,

I have a webapplication deployed on tomcat 5.5.x.
The application is in the webapps directory of tomcat.
Lets call the deployed application a.
A couple of days ago, copy/duplicate of a was created by someone under the
webapps directory, lets call the duplicate copy b.
Tomcat was restarted and both a and b were running properly.
Now I created a second duplicate of a and I named it c, and I restarted
the tomcat but c doesn't seem to work. I get Error 404, the requested
resource (/c/) is not available.

I contacted the person who created the first duplicate and as per him, all
he did was 
cp -r a bon the linux box, no further changes were
necessary. By further changes, I mean editing and adding an entry in the
web.xml or something.

I executed the same command but the duplicate copy I created doesn't work
after restarting tomcat.

Is there anything else that needs to be done?

Thanks.

-- 
View this message in context: 
http://www.nabble.com/Creating-a-copy-of-existing-webapp-in-tomcat-tp25636745p25636745.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Tomcat Connection Problem

2009-09-27 Thread George Sexton
Good for you. We'd hate to see an error go unfound.

George Sexton
MH Software, Inc.
http://www.mhsoftware.com/
Voice: 303 438 9585
 

 -Original Message-
 From: Sharath Babu S S S [mailto:sharath.b...@solix.com]
 Sent: Sunday, September 27, 2009 12:35 AM
 To: users@tomcat.apache.org
 Subject: Tomcat Connection Problem
 
 Hi
 
   When i checked my log file i found this error.
 
 
 java.sql.SQLException: Connection is closed at
 org.apache.tomcat.dbcp.dbcp.DelegatingConnection.checkOpen(DelegatingCo
 nnection.java:291)
 
 at
 org.apache.tomcat.dbcp.dbcp.DelegatingConnection.createStatement(Delega
 tingConnection.java:159)
 
 at
 org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrappe
 r.createStatement(PoolingDataSource.java:204).
 
 
 
 
 
 
 
 
 With Regards
 Sharat Babu Shravanam
 
 
 Byte and Switch Names Solix Technologies
 One of the Top 10 Startups to Watch
 
 Read More at http://www.solix.com/top10startups
 -
 
 
 
 
 
 
 
  CAUTION - Disclaimer *
 
 This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
 solely for the use of the addressee(s). If you are not the intended
 recipient, please notify the sender by e-mail and delete the original
 message. Further, you are not to copy, disclose, or distribute this
 e-mail or its contents to any other person and any such actions are
 unlawful. This e-mail may contain viruses. Solix has taken every
 reasonable precaution to minimize this risk, but is not liable for any
 damage you may sustain as a result of any virus in this e-mail. You
 should carry out your own virus checks before opening the e-mail or
 attachment. Solix reserves the right to monitor and review the content
 of all messages sent to or from this e-mail address. Messages sent to
 or
 from this e-mail address may be stored on the Solix e-mail system.
 
 
 End of Disclaimer **
 
 



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: debugging model classes tied to Tomcat datasources

2009-09-27 Thread Martin Gainty

http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
is a JNDI 'emulator'

i heard chilisoft was implementing JNDI for Tomcat but EOL'ed when Glassfish 
came out
I wonder if anyone can resurrect?

thanks
Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Date: Sun, 27 Sep 2009 15:27:35 -0400
 From: mark.shif...@yale.edu
 Subject: Re: debugging model classes tied to Tomcat datasources
 To: users@tomcat.apache.org
 
 Martin Gainty wrote:
  Mark
 
  have you been able to implement JNDI (standalone) in TC?

 No, I never tried.
 
  i see craig's comment on implementing JNDI in 
  org.apache.catalina.Container.java
   * libResources/b - JNDI directory context enabling access to static
   * resources, enabling custom linkages to existing server components 
  when
   * Catalina is embedded in a larger server.
   * /ul
  i *thought* Catalina would need to be 'embedded' into A J2EE AppServer 
  (such as Glassfish)
  to implement JNDI functionality?
 
  thanks,
  Martin Gainty 
  __ 
  Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
   
  Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene 
  Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte 
  Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht 
  dient lediglich dem Austausch von Informationen und entfaltet keine 
  rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von 
  E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
  Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
  destinataire prévu, nous te demandons avec bonté que pour satisfaire 
  informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie 
  de ceci est interdite. Ce message sert à l'information seulement et n'aura 
  pas n'importe quel effet légalement obligatoire. Étant donné que les email 
  peuvent facilement être sujets à la manipulation, nous ne pouvons accepter 
  aucune responsabilité pour le contenu fourni.
 
 
 
 

  Date: Sun, 27 Sep 2009 12:38:11 -0400
  From: mark.shif...@yale.edu
  Subject: Re: debugging model classes tied to Tomcat datasources
  To: users@tomcat.apache.org
 
  Hi:
  This is what I do for testing. I made a class for creating a jndi 
  directory and I create this in my main, then I can get a datasource from 
  the jndi directory just like I do it when running tomcat.
 
  jndi.properties
  java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory
  java.naming.factory.url.pkgs=org.apache.naming
  java.naming.provider.url=java 
 
 
   public static void create_JNDI(){
  //jndi.properties must be on the classpath to make the 
  initial context
  //you can either add the environment manually vida infra 
  or have a jndi.properties file
  /*  Hashtable env = new Hashtable();
  
  env.put(Context.INITIAL_CONTEXT_FACTORY,org.apache.naming.java.javaURLContextFactory);
  env.put(Context.URL_PKG_PREFIXES,org.apache.naming);
  env.put(Context.PROVIDER_URL,java);
  Context initial = new InitialContext(env);*/
  try {
  Context initial = new InitialContext();
  Context javaCompEnv = initial.
  createSubcontext(new 
  CompositeName().add(java:)).
  createSubcontext(comp).
  createSubcontext(env);
  Context jdbc = 
  javaCompEnv.createSubcontext(jdbc);
 
  DataSource dataSource = setupDataSource();
  jdbc.bind(mydatasourcet, dataSource);
  } catch (NamingException e) {
  throw new RuntimeException(e);
  }
 
  }
 
  private static DataSource setupDataSource() {
  // 

RE: Creating a copy of existing webapp in tomcat

2009-09-27 Thread Caldarale, Charles R
 From: asuhail100 [mailto:mn...@hotmail.com]
 Subject: Creating a copy of existing webapp in tomcat
 
 Now I created a second duplicate of a and I named it c, and I
 restarted the tomcat but c doesn't seem to work. I get Error 404,
 the requested resource (/c/) is not available.

And the Tomcat logs say?

You could well have a permissions problem if you did the copy under a different 
userid than the one Tomcat is running with.

 - Chuck


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


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: debugging model classes tied to Tomcat datasources

2009-09-27 Thread Mark Thomas
Martin Gainty wrote:
 http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
 is a JNDI 'emulator'

Huh? Care to explain what you mean by that remark?

 i heard chilisoft was implementing JNDI for Tomcat but EOL'ed when Glassfish 
 came out
 I wonder if anyone can resurrect? 

What was/is missing from Tomcat's JNDI implementation that makes you think that
is necessary?

Mark


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Yet another swallowOutput question

2009-09-27 Thread Vinicius Carvalho
Hello Mark. We have removed from all hosts the swallowOutput and add
it to the context section of each host. We have also added it to the
conf/context.xml.

Yet, the catalina.out keeps growing. We found that some apps, that are
using System.out/System.err, have their output redirected to
catalina.out. Also, since we put log4j on our classpath, and
configured a properties file for tomcat, now some apps are outputing
very verbose logs (DEBUG) to the catalina.out. Those came from ibatis,
that from some reason (we are checking the sources, but may take a
while) believes that the log4j is set to DEBUG.

My first guess is to believe that maybe those apps have a logging
configuration using DEBUG with a console appender, and that is being
redirected to catalina.out, would be this the issue?

We are generating several gigabytes of log per day, requesting us to
almost remove the log manually each 3-4 days.

Any ideas?

Regards

On Wed, Sep 23, 2009 at 10:20 AM, Mark Thomas ma...@apache.org wrote:
 Vinicius Carvalho wrote:
 Thanks Mark, do I have to set it for each context I have? I'm using
 several Hosts with few contexts on each.

 Yes, but there is a short-cut. Set it in CATALINA_BASE/conf/context.xml
 and it should apply to all contexts on that instance.

 Mark


 Regards

 On Fri, Sep 18, 2009 at 4:18 PM, Mark Thomas ma...@apache.org wrote:
 Vinicius Carvalho wrote:
 Hello there! I'm trying to redirect some legacy System.out calls in
 our app to a different logger. Since tomcat's logging implementation
 does not allow one to configure the maximum size of the catalina.out,
 we are easily reaching gigabytes of space on that file.

 I thought that by just adding:

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

 Would solve my problems, but, after re-starting the server and calling
 a servlet that deliberate calls system.out, the catalina out gets all
 the output
 Unsurprising, given that swallowOutput is not a valid attribute for a
 Host element. You want Context.

 Mark




 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org





 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Yet another swallowOutput question

2009-09-27 Thread Mark Thomas
Vinicius Carvalho wrote:
 Hello Mark. We have removed from all hosts the swallowOutput and add
 it to the context section of each host. We have also added it to the
 conf/context.xml.
 
 Yet, the catalina.out keeps growing. We found that some apps, that are
 using System.out/System.err, have their output redirected to
 catalina.out. Also, since we put log4j on our classpath, and
 configured a properties file for tomcat,

Phrases like added to the classpath always worry me slightly as the classpath
is something that in 99.9% if cases is best left alone.

 now some apps are outputing
 very verbose logs (DEBUG) to the catalina.out. Those came from ibatis,
 that from some reason (we are checking the sources, but may take a
 while) believes that the log4j is set to DEBUG.
 
 My first guess is to believe that maybe those apps have a logging
 configuration using DEBUG with a console appender, and that is being
 redirected to catalina.out, would be this the issue?
 
 We are generating several gigabytes of log per day, requesting us to
 almost remove the log manually each 3-4 days.
 
 Any ideas?

Fix the apps / raise a bug against the libraries.

Tomcat does what it can given the circumstances but swallowOutput is not a
panacea for apps/libraries with broken logging.

I'm fairly sure that the log4j output isn't going to get trapped by the
swallowOutput option.

Regards,

Mark

 
 Regards
 
 On Wed, Sep 23, 2009 at 10:20 AM, Mark Thomas ma...@apache.org wrote:
 Vinicius Carvalho wrote:
 Thanks Mark, do I have to set it for each context I have? I'm using
 several Hosts with few contexts on each.
 Yes, but there is a short-cut. Set it in CATALINA_BASE/conf/context.xml
 and it should apply to all contexts on that instance.

 Mark

 Regards

 On Fri, Sep 18, 2009 at 4:18 PM, Mark Thomas ma...@apache.org wrote:
 Vinicius Carvalho wrote:
 Hello there! I'm trying to redirect some legacy System.out calls in
 our app to a different logger. Since tomcat's logging implementation
 does not allow one to configure the maximum size of the catalina.out,
 we are easily reaching gigabytes of space on that file.

 I thought that by just adding:

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

 Would solve my problems, but, after re-starting the server and calling
 a servlet that deliberate calls system.out, the catalina out gets all
 the output
 Unsurprising, given that swallowOutput is not a valid attribute for a
 Host element. You want Context.

 Mark




 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org