Need help deploying web-service to EC2 with Tomcat7

2011-06-14 Thread Lisa and Terence Davis

Hi Everyone,

I have a web-service that I've developed using Tomcat7/MySQL5 using
NetBeans 7.  In the IDE it all works fine.  For testing however, I need
to get it onto an EC2 instance so users other than me can access it.  I
have created an EC2 micro-instance, installed Tomcat 7 and MySQL 5 (the
same versions as on my dev env) and deployed my .war file.  The
deployment succeeds at least partially because I can get to the simple
static Hello World index jsp page and because it tries to access my
database user (which I then created).  I don't see any errors in the log
and I've gone back-and-forth trying all sorts of desperate things to try
and get this working.  I'm sure there must be a simple solution but I
just don't know what it is.

Any ideas?

Thanks in advance,

Terry



Re: Mod_jk working for failover

2011-06-14 Thread Manuel Fernández Panzuela
Thank you Rainer,
Now Apache is working with disable mode. Maybe later it changed again.

:)


2011/6/12 Rainer Jung rainer.j...@kippdata.de

 On 12.06.2011 09:30, Manuel Fernández Panzuela wrote:
  Is possible to combine both attributes distance - activation ?
  Distance looks like a very interesting attribute.

 Yes, of course you can combine. As long as you don't cnfuse yourself
 because it gets too complicated.

 Distace (e.g. 0 and 1) will lead to normally everything being sent to
 the close node, but when you switch its activation from active to
 disabled, new sessions will be created on the node with higher distance.
 Switching to stopped will result in every request being handled by the
 node with higher distance.

 Regards,

 Rainer

  2011/6/11 Rainer Jung rainer.j...@kippdata.de
 
  On 08.06.2011 12:12, Felix Schumacher wrote:
  Am Mittwoch, den 08.06.2011, 09:47 +0200 schrieb Manuel Fernández
  Panzuela:
  Yes Felix, you are right i am working with 2 instances.
  I want primary node receives all requests and on failure send requests
  to
  the secondary node.
  Is it possible with your recomendation ?
  You may also want to read
 
 http://tomcat.apache.org/connectors-doc/generic_howto/loadbalancers.html
  if http://tomcat.apache.org/connectors-doc/reference/workers.html was
  not helpful.
 
 
  worker.43m2g1.activation=d
  degraded ??? is a condition ? then all requests will be redirected to
  43m2g1
  disabled
 
  The attribute distance provides an alternative approach.
 
  Regards,
 
  Rainer

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




Re: How to configure USE_SECURE_RANDOM_FOR_UUID?

2011-06-14 Thread franckie frank
Honestly, I was simply curious why the cryptographically secure generation
of random unique ids (through java.security.SecureRandom API)  is disabled
by default.

And It was unclear to me if it is at all possible to change the default
behavior.
Thanks,
Franckie14

2011/6/14 Mark Thomas ma...@apache.org

 On 13/06/2011 22:43, Christopher Schultz wrote:
  Frank,
 
  On 6/13/2011 11:46 AM, franckie frank wrote:
  I ve noticed that in Tomcat 7.0.14 s
  org.apache.catalina.tribes.io.ChannelData there is public static field
 
  'public static volatile boolean USE_SECURE_RANDOM_FOR_UUID'.
 
  and it seems to be used only once in the same class. By default its
 value is
  false.
 
  Do you know if there is a way to change/configure its value?
 
  How about:
 
  import org.apache.catalina.tribes.io.ChannelData;
 
  ...
 
 ChannelData.USE_SECURE_RANDOM_FOR_UUID = true;

 But that begs the questions, why would you want to?

 Mark



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




Re: How to configure USE_SECURE_RANDOM_FOR_UUID?

2011-06-14 Thread markt


ranckie frank francki...@gmail.com wrote:

Honestly, I was simply curious why the cryptographically secure
generation
of random unique ids (through java.security.SecureRandom API)  is
disabled
by default.

Because it is more expensive. I can't think of a reason why you would need 
SecureRandom there but left some code so it would be easy to change at a later 
point if someone came up with a reason.

And It was unclear to me if it is at all possible to change the default
behavior.

Not with config, only as previously descibed.

Mark




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



Re: error in clustering: NullPointerException at java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength

2011-06-14 Thread Ronald Klop

Hi,

I see the issue if solved in an upcoming version of Tomcat. Thank you very much 
for that. But can I expect an upcoming version of Tomcat 6.0 in the not too 
distant future?
At the tomcat-dev list I only see recent votings for 7.0.x.
Who normally is the initiator of the 6.x release cycle?

Ronald.


Op vrijdag, 10 juni 2011 13:03 schreef Ronald Klop ronald-mailingl...@base.nl:


  
 
 Hi,
 
   I'm running a 4 node cluster and seeing the same exception as described in this issue.

   https://issues.apache.org/bugzilla/show_bug.cgi?id=51306
 
   What can I do to workaround it or what can I information can I provide to help?
 
   I'm running 6.0.32 with a securitymanager on Debian 5. Java version 1.6.0_22 from debian sun-java pkgs.
 
   My clusterconfig is this:

   Engine name=Catalina defaultHost=..
 Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=UserDatabase /
   Cluster 
className=org.apache.catalina.ha.tcp.SimpleTcpCluster
   Channel 
className=org.apache.catalina.tribes.group.GroupChannel
   Membership 
className=org.apache.catalina.tribes.membership.McastService port=47727 /
   /Channel
   /Cluster
 
   !-- Zorg dat de appBase regel direct na de 'Host name' regel staat --

   Host name=..
   appBase=/data/webapps/xxx-xxx/deployed
   unpackWARs=true autoDeploy=false
   xmlValidation=false xmlNamespaceAware=true
   /Host
   /Engine
 
   
 
   The exception from my catalina.out.
 
   Jun 10, 2011 11:08:52 AM org.apache.catalina.ha.session.DeltaManager messageReceived

   SEVERE: Manager [crm.realworks.nl#]: Unable to receive message through TCP 
channel
   java.lang.NullPointerException
   at 
java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength(ObjectOutputStream.java:2106)
   at 
java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:1977)
   at java.io.ObjectOutputStream.writeUTF(ObjectOutputStream.java:849)
   at 
org.apache.catalina.ha.session.DeltaRequest.writeExternal(DeltaRequest.java:267)
   at 
org.apache.catalina.ha.session.DeltaRequest.serialize(DeltaRequest.java:287)
   at 
org.apache.catalina.ha.session.DeltaManager.serializeDeltaRequest(DeltaManager.java:716)
   at 
org.apache.catalina.ha.session.DeltaManager.requestCompleted(DeltaManager.java:1224)
   at 
org.apache.catalina.ha.session.DeltaSession.expire(DeltaSession.java:403)
   at 
org.apache.catalina.ha.session.DeltaManager.handleSESSION_EXPIRED(DeltaManager.java:1546)
   at 
org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1452)
   at 
org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:1173)
   at 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:92)
   at 
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:901)
   at 
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:882)
   at 
org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:269)
   at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
   at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
   at 
org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived(TcpFailureDetector.java:110)
   at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
   at 
org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:241)
   at 
org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:225)
   at 
org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:188)
   at 
org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:91)
   at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)
 
   
   Ronald.
 



 


Re: Tomcat 6.0.18 clustering problem

2011-06-14 Thread Nilesh - MiKu
Thanks Mark. :)

My comments inlined...

Over and above, the underlined network pipeline system also seems to be
fine. Still dont understand what is wrong. After enabling the logs to FINE
level, i could see following...

Jun 14, 2011 10:26:38 AM org.apache.catalina.tribes.transport.ReceiverBase
getBind
FINE: Starting replication listener on address:xx.xx.xx.xxx
Jun 14, 2011 10:26:38 AM org.apache.catalina.tribes.transport.ReceiverBase
bind
INFO: Receiver Server Socket bound to:/xx.xx.xx.xxx:4000
Jun 14, 2011 10:26:38 AM
org.apache.catalina.tribes.membership.McastServiceImpl setupSocket
INFO: Setting cluster mcast soTimeout to 500
Jun 14, 2011 10:26:38 AM
org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Sleeping for 1000 milliseconds to establish cluster membership, start
level:4
Jun 14, 2011 10:26:39 AM
org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Done sleeping, membership established, start level:4
Jun 14, 2011 10:26:39 AM
org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Sleeping for 1000 milliseconds to establish cluster membership, start
level:8
Jun 14, 2011 10:26:40 AM
org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Done sleeping, membership established, start level:8

Since, the clusters do not recognize anything, no communication in the logs!
:(



On Tue, Jun 14, 2011 at 5:07 AM, Mark Eggers its_toas...@yahoo.com wrote:

 - Original Message -

  From: Nilesh - MiKu niles...@directi.com
  To: users@tomcat.apache.org
  Cc:
  Sent: Monday, June 13, 2011 8:36 AM
  Subject: Tomcat 6.0.18 clustering problem
 
  Hi people...
 
  Background :
 
  I have two nodes (say, n1 and n2) running 3 instances of tomcat (say t1,
 t2,
  t3), with n1 running t1, t3 and n2 running t2. (All running same
  application.). I want to make clustering for n1-t1 and n2-t2.
 
  Clustering cofig for n1-t1 is
 
  Cluster className=org.apache.catalina.ha.tcp.SimpleTcpCluster
  channelSendOptions=8
 
  Manager className=org.apache.catalina.ha.session.DeltaManager
  expireSessionsOnShutdown=false
  notifyListenersOnReplication=true/
 
  Channel
  className=org.apache.catalina.tribes.group.GroupChannel
  Membership
  className=org.apache.catalina.tribes.membership.McastService
  address=228.0.0.4
  port=45564
  frequency=500
  dropTime=3000/
 
  Receiver
  className=org.apache.catalina.tribes.transport.nio.NioReceiver
  address=auto
  port=4000
  autoBind=100
  selectorTimeout=5000
  maxThreads=6/
 
  Sender
  className=org.apache.catalina.tribes.transport.ReplicationTransmitter
  Transport
 
 className=org.apache.catalina.tribes.transport.nio.PooledParallelSender/
  /Sender
 
  Interceptor
 
 className=org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor/
  Interceptor
 
 className=org.apache.catalina.tribes.group.interceptors.TcpFailureDetector/
  Interceptor
 
 className=org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor/
  /Channel
 
  Valve className=org.apache.catalina.ha.tcp.ReplicationValve
  filter=.*\.ico;.*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.css;.*\.txt;/
 
  ClusterListener
  className=org.apache.catalina.ha.session.ClusterSessionListener/
 
  /Cluster
 
  Clustering cofig for n2-t2 is same as above
 
  n1-t3 has element Cluster commented and is not participating in
  clustering
  at all. Its being used for some other special purpose.
 
  Here is what i get when i start the tomcat instance.
 
  Jun 11, 2011 9:26:18 AM org.apache.catalina.core.AprLifecycleListener
 init
  INFO: The APR based Apache Tomcat Native library which allows optimal
  performance in production environments was not found on the
  java.library.path: /usr/lib/jvm/jav
 
 a-1.6.0-sun-1.6.0.13/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-sun-1.6.0.13/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-sun-1.6.0.13/jre/../lib/amd64:/usr/java/packages
  /lib/amd64:/lib:/usr/lib
  Jun 11, 2011 9:26:18 AM org.apache.coyote.http11.Http11Protocol init
  INFO: Initializing Coyote HTTP/1.1 on http-8080
  Jun 11, 2011 9:26:18 AM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 446 ms
  Jun 11, 2011 9:26:18 AM org.apache.catalina.core.StandardService start
  INFO: Starting service Catalina
  Jun 11, 2011 9:26:18 AM org.apache.catalina.core.StandardEngine start
  INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
  Jun 11, 2011 9:26:18 AM org.apache.catalina.ha.tcp.SimpleTcpCluster start
  INFO: Cluster is about to start
  Jun 11, 2011 9:26:18 AM org.apache.catalina.tribes.transport.ReceiverBase
  bind
  INFO: Receiver Server Socket bound to:/70.87.28.134:4000
  Jun 11, 2011 9:26:18 AM
  org.apache.catalina.tribes.membership.McastServiceImpl setupSocket
  INFO: Setting cluster mcast soTimeout to 500
  Jun 11, 2011 9:26:18 AM
  org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
  INFO: Sleeping for 1000 milliseconds to establish cluster membership,
 start
  level:4
  Jun 

Re: Tomcat 7.0.11 embedded does not load context.xml [SEC=UNCLASSIFIED]

2011-06-14 Thread Mark Thomas
On 14/06/2011 05:14, Fraser, James wrote:
 UNCLASSIFIED 
 
 Hi, 
 
 I am trying to embed Tomcat 7.0.11 into my standard web application.
 This web application defines some Resource elements in
 META-INF/context.xml - yet, Tomcat is not loading this file.

addWebapp should return a Context object. You'll need to call
setConfigFile() on that Context object.

Mark

 
 tomcat = new Tomcat();
 tomcat.setBaseDir(.);
 tomcat.setPort(8084);
 tomcat.addWebapp(/, System.getProperty(user.dir) +
 /build/web);
 tomcat.setHostname(localhost);
 tomcat.enableNaming();
 tomcat.start(); 
 
 Causes the following error: 
 
 javax.naming.NamingException: Cannot create resource instance
 at
 org.apache.naming.factory.ResourceEnvFactory.getObjectInstance(ResourceE
 nvFactory.java:117)
 at
 javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:826)
 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:145)
 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:814)
 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:159)
 at
 dsto.adiib.ws.harmoniser.AdiibHarmoniser.init(AdiibHarmoniser.java:113
 )
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
 Method)
 at
 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
 ccessorImpl.java:39)
 at
 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
 tructorAccessorImpl.java:27)
 at
 java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at java.lang.Class.newInstance0(Class.java:355)
 at java.lang.Class.newInstance(Class.java:308)
 at
 com.sun.xml.ws.api.server.InstanceResolver.createNewInstance(InstanceRes
 olver.java:215)
 at
 com.sun.xml.ws.api.server.InstanceResolver.createDefault(InstanceResolve
 r.java:180)
 at
 com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.jav
 a:123)
 at
 com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:505)
 at
 com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(D
 eploymentDescriptorParser.java:253)
 at
 com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(Deploymen
 tDescriptorParser.java:147)
 at
 com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextIn
 itialized(WSServletContextListener.java:124)
 
 at
 org.apache.catalina.core.StandardContext.listenerStart(StandardContext.j
 ava:4681)
 at
 org.apache.catalina.core.StandardContext$1.call(StandardContext.java:518
 4)
 at
 org.apache.catalina.core.StandardContext$1.call(StandardContext.java:517
 9)
 at
 java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
 at java.util.concurrent.FutureTask.run(FutureTask.java:138)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
 r.java:886)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
 va:908)
 at java.lang.Thread.run(Thread.java:662) 
 
 Line 113 of AdiibHarmoniser is like so: 
 
 HarmoniserImplConfigBean harmoniserImplConfigBean =
 (HarmoniserImplConfigBean)envCtx.lookup(beanName); 
 
 This essentially loads some external beans for me. 
 
 My context.xml looks like so: 
 
 ?xml version=1.0 encoding=UTF-8?
 Context antiJARLocking=true path=/AdiibHarmoniser
   Resource auth=Container csdTypeComparatorValue=VIDEO
 csdViewDataModel=NSIL_VIDEO_VIEW dibTextPath=//video
 factory=org.apache.naming.factory.BeanFactory harmonise=true
 harmoniserClassName=dsto.adiib.ws.harmoniser.FmvHarmoniser
 name=bean/FmvFactory subscriptionId=adiibFmvHarmoniser
 type=dsto.adiib.ws.harmoniser.HarmoniserImplConfigBean/
 
   Resource auth=Container csdTypeComparatorValue=IMAGERY
 csdViewDataModel=NSIL_IMAGERY_VIEW dibTextPath=//nitf
 factory=org.apache.naming.factory.BeanFactory harmonise=true
 harmoniserClassName=dsto.adiib.ws.harmoniser.NitfHarmoniser
 name=bean/NitfFactory subscriptionId=adiibNitfHarmoniser
 type=dsto.adiib.ws.harmoniser.HarmoniserImplConfigBean/
 
 /Context 
 
 Using normal Tomcat (non embedded) everything works fine. I found a post
 similar to my problem here:
 http://stackoverflow.com/questions/5238451/jndi-jdbc-data-source-in-embe
 dded-tomcat-7, yet this caused a followon exception.
 
 java.lang.NoSuchMethodError:
 org.apache.catalina.Context.setConfigFile(Ljava/lang/String;)V 
 
 Any ideas? 
 
 Kind Regards, 
 
 James 
 
 IMPORTANT: This email remains the property of the Department of Defence
 and is subject to the jurisdiction of section 70 of the Crimes Act 1914.
 If you have received this email in error, you are requested to contact
 the sender and delete the email. 
 
 
 




-
To unsubscribe, 

mod_jk problem

2011-06-14 Thread Orgil Tulga
Hello All,
 
  I am using apache and tomcat with mod_jk.
apache version : 2.2.19
tomcat version : 6.0
mod_jk version : 1.2.30
 
My web runs through servlet.
 
http://domainname:8080/contact.shtml - is working
http://domainname/contact.shtml - is not working
 
mod_jk log :
 
[debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1036): Attempting to map 
URI '/contact.shtml' from 4 maps
 [trace] find_match::jk_uri_worker_map.c (839): enter
 [debug] find_match::jk_uri_worker_map.c (850): Attempting to map context URI 
'/servlets/*=ajp13' source 'JkMount'
 [debug] find_match::jk_uri_worker_map.c (850): Attempting to map context URI 
'/servlet/*=ajp13' source 'JkMount'
 [debug] find_match::jk_uri_worker_map.c (850): Attempting to map context URI 
'/*.jsp=ajp13' source 'JkMount'
 [debug] find_match::jk_uri_worker_map.c (850): Attempting to map context URI 
'/*=ajp13' source 'JkMount'
 [debug] find_match::jk_uri_worker_map.c (863): Found a wildchar match 
'/*=ajp13'
 [trace] find_match::jk_uri_worker_map.c (866): exit
 [trace] map_uri_to_worker_ext::jk_uri_worker_map.c (1065): exit
 [trace] map_uri_to_worker_ext::jk_uri_worker_map.c (951): enter
 [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1036): Attempting to map 
URI '/404.shtml' from 4 maps
 [trace] find_match::jk_uri_worker_map.c (839): enter
 [debug] find_match::jk_uri_worker_map.c (850): Attempting to map context URI 
'/servlets/*=ajp13' source 'JkMount'
 [debug] find_match::jk_uri_worker_map.c (850): Attempting to map context URI 
'/servlet/*=ajp13' source 'JkMount'
 [debug] find_match::jk_uri_worker_map.c (850): Attempting to map context URI 
'/*.jsp=ajp13' source 'JkMount'
 [debug] find_match::jk_uri_worker_map.c (850): Attempting to map context URI 
'/*=ajp13' source 'JkMount'
 [debug] find_match::jk_uri_worker_map.c (863): Found a wildchar match 
'/*=ajp13'
 [trace] find_match::jk_uri_worker_map.c (866): exit
 [trace] map_uri_to_worker_ext::jk_uri_worker_map.c (1065): exit
 
Why jk connector not converting to servlet? any idea?

Re: mod_jk problem

2011-06-14 Thread Calum
On 14 June 2011 12:07, Orgil Tulga orgio...@yahoo.com wrote:
 Hello All,

   I am using apache and tomcat with mod_jk.
 apache version : 2.2.19
 tomcat version : 6.0
 mod_jk version : 1.2.30

 My web runs through servlet.

 http://domainname:8080/contact.shtml - is working
 http://domainname/contact.shtml - is not working

 Why jk connector not converting to servlet? any idea?

I imagine people will ask to see your jk config.

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



Re: mod_jk problem

2011-06-14 Thread Orgil Tulga
My jk connector config is below.
 
Below is jk.conf:

JkWorkersFile /usr/local/jakarta/tomcat/conf/workers.properties
JkLogFile /usr/local/apache/logs/mod_jk.log
JkLogLevel trace
JkLogStampFormat [%a %b %d %H:%M:%S %Y] 
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat %w %V %T
=
 
Below is jkmount.conf :
=
IfModule mod_jk.c
  JkMount /* ajp13
  JkMount /*.jsp ajp13
  JkMount /servlet/* ajp13
  JkMount /servlets/* ajp13
/IfModule
=
 
I inserted below lines in httpd.conf
 
LoadModule jk_module modules/mod_jk.so
Include /usr/local/apache/conf/jk.conf
Include /usr/local/apache/conf/jkmount.conf



--- On Tue, 6/14/11, Calum cal...@gmail.com wrote:


From: Calum cal...@gmail.com
Subject: Re: mod_jk problem
To: Tomcat Users List users@tomcat.apache.org
Date: Tuesday, June 14, 2011, 4:20 AM


On 14 June 2011 12:07, Orgil Tulga orgio...@yahoo.com wrote:
 Hello All,

   I am using apache and tomcat with mod_jk.
 apache version : 2.2.19
 tomcat version : 6.0
 mod_jk version : 1.2.30

 My web runs through servlet.

 http://domainname:8080/contact.shtml - is working
 http://domainname/contact.shtml - is not working

 Why jk connector not converting to servlet? any idea?

I imagine people will ask to see your jk config.

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



Re: mod_jk problem

2011-06-14 Thread Calum
On 14 June 2011 12:28, Orgil Tulga orgio...@yahoo.com wrote:
 My jk connector config is below.

 Below is jk.conf:
 
 JkWorkersFile /usr/local/jakarta/tomcat/conf/workers.properties

Can we see this?

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



Re: mod_jk problem

2011-06-14 Thread Orgil Tulga
No. I am testing on local domain.

--- On Tue, 6/14/11, Calum cal...@gmail.com wrote:


From: Calum cal...@gmail.com
Subject: Re: mod_jk problem
To: Tomcat Users List users@tomcat.apache.org
Date: Tuesday, June 14, 2011, 4:35 AM


On 14 June 2011 12:28, Orgil Tulga orgio...@yahoo.com wrote:
 My jk connector config is below.

 Below is jk.conf:
 
 JkWorkersFile /usr/local/jakarta/tomcat/conf/workers.properties

Can we see this?

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



Re: mod_jk problem

2011-06-14 Thread Calum
On 14 June 2011 12:49, Orgil Tulga orgio...@yahoo.com wrote:
 No. I am testing on local domain.

I don't understand this. The ajp13 bit in your jkmount.conf needs to
refer to a worker in workers.properties.
We would need to see it to understand what's happening.

This might help you a little?
http://tomcat.apache.org/connectors-doc/reference/workers.html

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



Re: Need help deploying web-service to EC2 with Tomcat7

2011-06-14 Thread Pid
On 14/06/2011 08:03, Lisa and Terence Davis wrote:
 
 Hi Everyone,
 
 I have a web-service that I've developed using Tomcat7/MySQL5 using
 NetBeans 7.  In the IDE it all works fine.  For testing however, I need
 to get it onto an EC2 instance so users other than me can access it.  I
 have created an EC2 micro-instance, installed Tomcat 7 and MySQL 5 (the
 same versions as on my dev env) and deployed my .war file.  The
 deployment succeeds at least partially because I can get to the simple
 static Hello World index jsp page and because it tries to access my
 database user (which I then created).  I don't see any errors in the log
 and I've gone back-and-forth trying all sorts of desperate things to try
 and get this working.  I'm sure there must be a simple solution but I
 just don't know what it is.

What do the logs say?


p



signature.asc
Description: OpenPGP digital signature


Re: Need help deploying web-service to EC2 with Tomcat7

2011-06-14 Thread Hassan Schroeder
On Tue, Jun 14, 2011 at 12:03 AM, Lisa and Terence Davis
lisn...@verizon.net wrote:

OT: Dear Lisa and Terence -- It's 2011, and while togetherness is
wonderful, it's hard to take someone seriously who can't figure out
how to get at least their own free gmail account :-)

 I have a web-service that I've developed using Tomcat7/MySQL5 using
 NetBeans 7.  In the IDE it all works fine.

Great. How's it work when you run it locally *without* the IDE?

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

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



Re: One process per webapp

2011-06-14 Thread Pid
On 13/06/2011 22:53, Christopher Schultz wrote:
 Gili,
 
 On 6/13/2011 1:07 PM, cowwoc wrote:
 I posted a RFE at https://issues.apache.org/bugzilla/show_bug.cgi?id=51366
 asking for the ability to seamlessly deploy webapps into separate JVMs.
 
 So you want Tomcat to have an option to run as a supervisor in one JVM
 and deploy webapps to separate JVMs?

You can, right now, start blank Tomcat instances and deploy apps to them
- managing the instance using JMX.

What you can't do, is seamlessly transfer request processing from one
running JVM to another - using Tomcat instances alone - because you
can't exactly determine when one instance releases a port, enabling
another to bind to it.

This is why I referred to parallel deployment, which does permit
seamless transfer to a new version of the app.


 Tomcat 7.0's parallel deployment sounds nice but it still doesn't solve the
 JNI and memory leak problems that haunt a single JVM architecture.

Tomcat has some memory leak prevention capability (since 6.0.24) but JNI
memory issues it can't prevent.  What problems are you seeing?


 Parallel deployment is at once orthogonal to and the opposite of what
 you are requesting.

Yeah, my fault, I misread what he was asking.  See above.


 Please read the proposal and let me know what you think.
 
 What single management interface are you describing in your
 enhancement comments? The Tomcat manager webapp? It's trivial to run a
 manager in each JVM and use that for deployment.
 
 If you know that your webapp needs to do things such as register a
 shared library on startup, you can do one of two things:
 
   1. Always bounce Tomcat directly instead of re-loading the webapp
   2. Fix the webapp so it doesn't bomb on startup when the library
  is already loaded
 
 Tomcat provides the manager webapp and ant tasks to access it, plus a
 toolbox of scripts to start/stop/etc. Tomcat. Your needs seem to be
 fairly specific... why not just roll your own solution?

Bouncing a JVM requires admin access to the local operating system,
which you probably wouldn't want to give to a Tomcat application.

Assuming I've understood correctly this time.


p


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





signature.asc
Description: OpenPGP digital signature


How to configure logging in embedded Tomcat?

2011-06-14 Thread Rüdiger Herrmann
Hi all,

I am running Tomcat embedded and just can't figure out how to
programmatically configure the logging of the engine itself.
Ideally I would redirect logging to a custom implementation, but
changing the log level (to off) would already help.
The LogFactory doesn't seem to offer such functionality (?) and
manipulating the underlying java.util.logging.Logger didn't help
either.
Any insights?

TIA
Rüdiger

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



Re: How to configure logging in embedded Tomcat?

2011-06-14 Thread Mark Thomas
On 14/06/2011 16:24, Rüdiger Herrmann wrote:
 Hi all,
 
 I am running Tomcat embedded and just can't figure out how to
 programmatically configure the logging of the engine itself.
 Ideally I would redirect logging to a custom implementation, but
 changing the log level (to off) would already help.
 The LogFactory doesn't seem to offer such functionality (?) and
 manipulating the underlying java.util.logging.Logger didn't help
 either.
 Any insights?

Without you telling us the Tomcat version you are using, insight is
unlikely.

Mark



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



Re: How to configure logging in embedded Tomcat?

2011-06-14 Thread Rüdiger Herrmann
ups, sorry. I am using version 7.

On Tue, Jun 14, 2011 at 18:03, Mark Thomas ma...@apache.org wrote:
 On 14/06/2011 16:24, Rüdiger Herrmann wrote:
 Hi all,

 I am running Tomcat embedded and just can't figure out how to
 programmatically configure the logging of the engine itself.
 Ideally I would redirect logging to a custom implementation, but
 changing the log level (to off) would already help.
 The LogFactory doesn't seem to offer such functionality (?) and
 manipulating the underlying java.util.logging.Logger didn't help
 either.
 Any insights?

 Without you telling us the Tomcat version you are using, insight is
 unlikely.

 Mark



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





-- 
--
EclipseSource
http://eclipsesource.com
Tel: 0721 - 66 47 33 - 0
Fax: 0721 - 66 47 33 29

Innoopract Informationssysteme GmbH
Stephanienstrasse 20, 76133 Karlsruhe, Germany
General Manager: Jochen Krause
Registered Office: Karlsruhe, Commercial Register Mannheim HRB 107883

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



Re: One process per webapp

2011-06-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Gili,

On 6/13/2011 9:26 PM, cowwoc wrote:
   Assuming we simply use one webapp per Tomcat instance I'm still looking
 for two changes:
 
 * Restart the entire JVM on webapp redeploy (to avoid JNI and ClassLoader
 problems)

Why bother redeploying, then? Instead of doing ant redeploy, just do
ant bounce or something similar.

 * Faster webapp redeploys if the entire JVM is restarted. I'm aiming for one
 second but currently we're at ten seconds.

Tomcat simply takes a certain amount of time to start. The fewer things
you have configured at startup the better, but Tomcat starts up pretty
quickly. Generally speaking, it's your webapp that is going to take a
long time to start up if you have lots of things happening in
ServletContextListeners, load-on-startup Servlets, etc.

If you deploy no webapps, how long does it take Tomcat to start up?

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

iEYEARECAAYFAk33o00ACgkQ9CaO5/Lv0PBDmACgi0uBTXZ8RHtFjggelFNWlk48
iZsAnjEsq3bkhYzPZXIuDqcsw+649L9p
=FZoe
-END PGP SIGNATURE-

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



Re: One process per webapp

2011-06-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Pid,

On 6/14/2011 9:34 AM, Pid wrote:
 On 13/06/2011 22:53, Christopher Schultz wrote:

 What single management interface are you describing in your
 enhancement comments? The Tomcat manager webapp? It's trivial to run a
 manager in each JVM and use that for deployment.

 If you know that your webapp needs to do things such as register a
 shared library on startup, you can do one of two things:

   1. Always bounce Tomcat directly instead of re-loading the webapp
   2. Fix the webapp so it doesn't bomb on startup when the library
  is already loaded

 Tomcat provides the manager webapp and ant tasks to access it, plus a
 toolbox of scripts to start/stop/etc. Tomcat. Your needs seem to be
 fairly specific... why not just roll your own solution?
 
 Bouncing a JVM requires admin access to the local operating system,
 which you probably wouldn't want to give to a Tomcat application.

Not necessarily... we run Tomcat unprivileged so bouncing the JVM just
requires normal user access. If you need port 80, use jsvc or one of
the other similar options.

Now, bouncing the JVM from withing the JVM... that requires some creativity.

It sounds like the OP could just wrap the Tomcat launcher in a script
that looks roughly like this:

#/bin/sh

while [ 1 ]
do
  ${CATALINA_HOME}/bin/startup.sh run  $CATALINA_OUT 21
done

This would start a Tomcat and wait for it to finish, then restart when
the original JVM came down. I suspect using JMX or whatever, one can
request a Tomcat shutdown which will ultimately terminate the JVM
(unless some foolish person launched a non-daemon thread at some point).
The script will re-start Tomcat.

This just doesn't seem like a difficult thing to implement oneself, nor
does it seem like something that is widely applicable.

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

iEYEARECAAYFAk33pYkACgkQ9CaO5/Lv0PC8SACfVOfOhDAvgLzv6bdlKnzVJ96i
k50AnRi3Si75/+E1j0ME/YMQESVcFdbY
=jcbN
-END PGP SIGNATURE-

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



Re: One process per webapp

2011-06-14 Thread cowwoc


Christopher Schultz-2 wrote:
 
 Why bother redeploying, then? Instead of doing ant redeploy, just do
 ant bounce or something similar.
 

I am running inside Netbeans (remember the focus here is on improving
development productivity, less so on improving production deployments).
Modifying what they run under the hood is probably not going to be trivial.

 * Faster webapp redeploys if the entire JVM is restarted. I'm aiming for
 one
 second but currently we're at ten seconds.


Christopher Schultz-2 wrote:
 
 Tomcat simply takes a certain amount of time to start. The fewer things
 you have configured at startup the better, but Tomcat starts up pretty
 quickly. Generally speaking, it's your webapp that is going to take a
 long time to start up if you have lots of things happening in
 ServletContextListeners, load-on-startup Servlets, etc.
 
 If you deploy no webapps, how long does it take Tomcat to start up?

It takes about 10 seconds to shut down and start up a new instance. Starting
up a new instance is fairly quick. Shutting down takes a while.

When restarting a webapp, we don't have to wait for the old instance to
finish shutting down (which is slow) before transferring access to another
Tomcat instance. The new instance can simply bind to a different port and
the proxy running at port 80 can switch which port it is redirecting
requests to. The only snag I can think of is that the old instance might
keep files locked on disk (but I think this is no longer the case with
Tomcat 7.x)

Gili
-- 
View this message in context: 
http://old.nabble.com/One-process-per-webapp-tp31836121p31845924.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: One process per webapp

2011-06-14 Thread cowwoc


Pid * wrote:
 
 You can, right now, start blank Tomcat instances and deploy apps to them
 - managing the instance using JMX.
 

Granted I can do a lot of this myself, but it's a lot of work for every user
to reinvent this wheel. This kind of feature needs to be improved in the
official release.


Pid * wrote:
 
 What you can't do, is seamlessly transfer request processing from one
 running JVM to another - using Tomcat instances alone - because you
 can't exactly determine when one instance releases a port, enabling
 another to bind to it.
 

You don't need to wait. You have a proxy webapp running on port 80 that
redirects traffic to whatever port each webapp runs on. When an admin
restarts a webapp you simply redirect traffic to the port of the new Tomcat
instance (which may differ from the port of the instance you are shutting
down). That way you don't need to wait for the old instance to shut down
(which is slow) before launching the new one.


Pid * wrote:
 
 Tomcat has some memory leak prevention capability (since 6.0.24) but JNI
 memory issues it can't prevent.  What problems are you seeing?
 

The new leak prevention is great, but last time I checked it couldn't solve
100% of offending libraries/webapps. Running webapps in their own JVM would
be a 100% fix without having to resort to any magic/hacks.

Gili
-- 
View this message in context: 
http://old.nabble.com/One-process-per-webapp-tp31836121p31846007.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: One process per webapp

2011-06-14 Thread cowwoc


   1. Always bounce Tomcat directly instead of re-loading the webapp

This is too slow (10-15 seconds) in its current form. If you use the
mechanism I'm proposing restart time is instant (you have a blank Tomcat
instance waiting to pick up a new webapp).

   2. Fix the webapp so it doesn't bomb on startup when the library
  is already loaded

As far as I know what you are proposing is impossible. Here is what I've
seen:

* A webapp must invoke System.loadLibrary() to use JNI.
* If a library is loaded by one ClassLoader and another ClassLoader invokes
System.loadLibrary() the JVM will throw: java.lang.UnsatisfiedLinkError:
Native Library x already loaded in another classloader.
* Tomcat loads each webapp into its own ClassLoader.
* When reloading a webapp, there is no guarantee that the old ClassLoader
will get garbage-collected (thereby ensuring that the old library is
unloaded) before the new webapp is launched. When I reload such webapps, I
get UnsatisfiedLinkError virtually 100% of the time.
* There is nothing a webapp can do to prevent this problem. Either each
webapp needs to run in its own JVM or Tomcat needs to guarantee that the old
ClassLoader is GCed before loading the new webapp instance.

 Tomcat provides the manager webapp and ant tasks to access it, plus a
 toolbox of scripts to start/stop/etc. Tomcat. Your needs seem to be
 fairly specific... why not just roll your own solution?

Because then every user would have to roll their own solution. Right now it
is impossible to reload webapps that use JNI and it is extremely slow to
reload the entire JVM. Fixing this in the official release would benefit
anyone wishing to use JNI (or libraries that use JNI) from within Tomcat.
Nowadays with the rise of RESTful interfaces, it makes a lot more sense to
wrap a RESTful interface around libraries that interface with native code.


Christopher Schultz-2 wrote:
 
 It sounds like the OP could just wrap the Tomcat launcher in a script
 that looks roughly like this:
 
 #/bin/sh
 
 while [ 1 ]
 do
   ${CATALINA_HOME}/bin/startup.sh run  $CATALINA_OUT 21
 done
 
 This would start a Tomcat and wait for it to finish, then restart when
 the original JVM came down. I suspect using JMX or whatever, one can
 request a Tomcat shutdown which will ultimately terminate the JVM
 (unless some foolish person launched a non-daemon thread at some point).
 The script will re-start Tomcat.
 
 This just doesn't seem like a difficult thing to implement oneself, nor
 does it seem like something that is widely applicable.
 

Chris, I'm asking for a lot more sophistication than simply restarting the
JVM. I'm talking about sticking a proxy (on port 80) that acts a front-man.
Then each webapp run in its own JVM in some custom port. The proxy redirects
traffic to the custom ports. Reloading webapps would do the following:

* Grab a blank (loaded without any webapps) Tomcat instance from some pool,
ask it to load the new webapp instance.
* The new instance runs in a different port than the existing instance
* We ask the proxy to forward traffic to the new port instead of the old one
* We ask the old instance to shut down
* Note that traffic moves across instances instantly (without waiting for
the old instance to shut down)

I wouldn't want to try implementing this in terms of simple script files.
It's a lot more involved.

Gili
-- 
View this message in context: 
http://old.nabble.com/One-process-per-webapp-tp31836121p31846107.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



Drop message SESSION-EXPIRED inside GET_ALL_SESSIONS

2011-06-14 Thread John Clark
I am experiencing an issue with my cluster I have been unable to figure out.

My cluster contains 4 servers each with 4 instances of Tomcat segregated by
mod_jk directives.

Server1 Directives:
/ - tomcat.server1
/app1 - tomcat-app1.server1
/app2 - tomcat-app2.server1
/app3 - tomcat-app3.server1

Server2 Directives:
/ - tomcat.server2
/app1 - tomcat-app1.server2
/app2 - tomcat-app2.server2
/app3 - tomcat-app3.server2

... and so on


All Tomcat segmentations are clustered and share session data so our users
can move between them seamlessly on our application.

Here's the scenario I'm experiencing:

- User1 logs on to server1 and navigates to tomcat-app1.server1
- tomcat-app1.server1 becomes unresponsive and is removed from the cluster
- User1 is moved to tomcat-app1.server2 successfully and experiences no
issues.
- tomcat-app1.server1 becomes responsive and is added back to the cluster.
- tomcat-app1.server1 requests session states and throws the following error
in catalina.out:
 WARNING: Manager [localhost#]: Drop message SESSION-EXPIRED inside
GET_ALL_SESSIONS sync phase start date 6/14/11 1:59 PM message date 12/31/69
6:00 PM
 INFO: Lost Session [A56F0A74DCF2FBA7F179100C3D84A485.app1.server2] at
path []
- Load balancer moves User1 back to tomcat-app1.server1
- User1 gets logged out (lost session)


Re: One process per webapp

2011-06-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Gili,

On 6/14/2011 3:28 PM, cowwoc wrote:
 Christopher Schultz-2 wrote:

 Why bother redeploying, then? Instead of doing ant redeploy, just do
 ant bounce or something similar.
 
 I am running inside Netbeans (remember the focus here is on improving
 development productivity, less so on improving production deployments).
 Modifying what they run under the hood is probably not going to be trivial.

Can't Netbeans bounce the Tomcat JVM for you?

If this is just in development, why not just wrap System.loadLibrary()
in a try/catch block and ignore the exception you get when re-loading
the native library?

This just seems like it would be a lot of work for not much gain.

 If you deploy no webapps, how long does it take Tomcat to start up?
 
 It takes about 10 seconds to shut down and start up a new instance.

With no webapps deployed at all? Wow, something is not right. Are you
sure you have enough memory installed on your dev instance?

 Starting
 up a new instance is fairly quick. Shutting down takes a while.

That seems strange... do you have a complicated shutdown procedure for
your webapp? Tomcat shuts down on my end in very short order when no
webapps need to be undeployed.

 When restarting a webapp, we don't have to wait for the old instance to
 finish shutting down (which is slow) before transferring access to another
 Tomcat instance.

If they're going to be using the same port, you do.

 The new instance can simply bind to a different port and
 the proxy running at port 80 can switch which port it is redirecting
 requests to.

So... you want Tomcat to also notify a 3rd-party that it's being shut
down so that a proxy can re-configure itself?

 The only snag I can think of is that the old instance might
 keep files locked on disk (but I think this is no longer the case with
 Tomcat 7.x)

I don't believe Tomcat locks anything specific. Under certain
situations, the JVM and the OS conspire to lock certain resources
(usually .jar files) and that can be a problem.

If you're starting a new instance in parallel, wouldn't you want to do
it from a separate directory anyway?

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

iEYEARECAAYFAk330RgACgkQ9CaO5/Lv0PCH6ACfTAZ1m0wSocjfvnfLeYHegzbd
BJAAoLAFzIa5fQ/V/k3GYFPtUw6qKjm2
=/62c
-END PGP SIGNATURE-

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



Re: One process per webapp

2011-06-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Gili,

On 6/14/2011 3:54 PM, cowwoc wrote:
   1. Always bounce Tomcat directly instead of re-loading the webapp
 
 This is too slow (10-15 seconds) in its current form. If you use the
 mechanism I'm proposing restart time is instant (you have a blank Tomcat
 instance waiting to pick up a new webapp).

So, now you want Tomcat to launch multiple copies of itself as hot
standbys for /potential future webapp deployments/? We'll never do this.

   2. Fix the webapp so it doesn't bomb on startup when the library
  is already loaded
 
 As far as I know what you are proposing is impossible.

Certainly not.

 Here is what I've seen:
 
 * A webapp must invoke System.loadLibrary() to use JNI.

Must it? You can load a native library at a higher-level instead of in
the webapp itself and avoid all of this.

 * If a library is loaded by one ClassLoader and another ClassLoader invokes
 System.loadLibrary() the JVM will throw: java.lang.UnsatisfiedLinkError:
 Native Library x already loaded in another classloader.

I don't believe this has anything to do with ClassLoaders.

 * Tomcat loads each webapp into its own ClassLoader.

True.

 * When reloading a webapp, there is no guarantee that the old ClassLoader
 will get garbage-collected (thereby ensuring that the old library is
 unloaded) before the new webapp is launched. When I reload such webapps, I
 get UnsatisfiedLinkError virtually 100% of the time.

I don't think the ClassLoader ever unloads the native library. I haven't
found any documentation that suggests that it will.

 * There is nothing a webapp can do to prevent this problem. Either each
 webapp needs to run in its own JVM or Tomcat needs to guarantee that the old
 ClassLoader is GCed before loading the new webapp instance.

Or you can put your .jar that wraps your native library in Tomcat's lib
directory and take it out of your webapp. That's not the most portable
solution, but neither is using a native library in the first place.

 Tomcat provides the manager webapp and ant tasks to access it, plus a
 toolbox of scripts to start/stop/etc. Tomcat. Your needs seem to be
 fairly specific... why not just roll your own solution?
 
 Because then every user would have to roll their own solution.

Yes, everyone who wants this solution would have to roll their own. From
what I can recall, you are the first one who has requested this
capability, so I suspect we wouldn't be saving thousands of staff hours
by implementing whatever-it-is that you are suggesting -- something like
a Tomcat-based hypervisor for multiple Tomcats.

 Right now it
 is impossible to reload webapps that use JNI and it is extremely slow to
 reload the entire JVM. Fixing this in the official release would benefit
 anyone wishing to use JNI (or libraries that use JNI) from within Tomcat.

It's not a good excuse, but native libraries are a pain in the ass in
Java. If you use one, be prepared to have your ass hurt.

 Nowadays with the rise of RESTful interfaces, it makes a lot more sense to
 wrap a RESTful interface around libraries that interface with native code.

Aah, you are a REST guy. That explains the constant appeals against
practicality. ;)

If you wrapped your JNI library with a REST interface, couldn't you
avoid all this foolishness?

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

iEYEARECAAYFAk331aUACgkQ9CaO5/Lv0PBdywCfZZISEH2dd7d5MvaP1vdT1EBJ
K3kAoLyerD+DbJl0D7L3ucbuc+kZzFPL
=UhCi
-END PGP SIGNATURE-

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



Re: One process per webapp

2011-06-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Gili,

(Sorry, your message was structured in a way I didn't expect, so I
didn't see the lower portion).

On 6/14/2011 3:54 PM, cowwoc wrote:
 Chris, I'm asking for a lot more sophistication than simply restarting the
 JVM. I'm talking about sticking a proxy (on port 80) that acts a front-man.
 Then each webapp run in its own JVM in some custom port. The proxy redirects
 traffic to the custom ports. Reloading webapps would do the following:
 
 * Grab a blank (loaded without any webapps) Tomcat instance from some pool,
 ask it to load the new webapp instance.
 * The new instance runs in a different port than the existing instance
 * We ask the proxy to forward traffic to the new port instead of the old one
 * We ask the old instance to shut down
 * Note that traffic moves across instances instantly (without waiting for
 the old instance to shut down)

The Tomcat team has thus far been unwilling to implement even an HTTP
proxy component due to lack of interest from the community. Given that
the HTTP proxy would be a major requirement to your above solution, I
don't see this happening anytime soon.

If this is something that you would like to design and implement
yourself, donations of code are always welcome. I don't think anyone
around here is going to take on that responsibility, though.

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

iEYEARECAAYFAk331swACgkQ9CaO5/Lv0PA0LQCfVybrSezyjMJxC/eHi1nIq1d6
Me8AoLq2f1pOYqLER/ndLhHMtGRJe+/1
=nr2i
-END PGP SIGNATURE-

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



Re: error in clustering: NullPointerException at java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength

2011-06-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ronald,

On 6/14/2011 6:23 AM, Ronald Klop wrote:
 I see the issue if solved in an upcoming version of Tomcat. Thank you
 very much for that. But can I expect an upcoming version of Tomcat 6.0
 in the not too distant future?
 At the tomcat-dev list I only see recent votings for 7.0.x.
 Who normally is the initiator of the 6.x release cycle?

I guess anyone can request a new version... whether anyone will roll it
is up to them :)

I believe Jean-Frederic Clere is the one who usually does TC 6.x releases:
http://tomcat.apache.org/tomcat-6.0-doc/changelog.html

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

iEYEARECAAYFAk332cEACgkQ9CaO5/Lv0PBB7ACfYNMPHeJDlltC9HHdKiC/VAml
RB4AniwAT6RTwBYNLG5H0nYQmv3hOzG3
=DmoN
-END PGP SIGNATURE-

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



Re: One process per webapp

2011-06-14 Thread cowwoc


Christopher Schultz-2 wrote:
 
 Can't Netbeans bounce the Tomcat JVM for you?
 

Sure, but if we use the existing mechanism of waiting for for the existing
instance to shut down before restarting it then it takes at least 20 seconds
each time. I'm looking for a second or less.


Christopher Schultz-2 wrote:
 
 If this is just in development, why not just wrap System.loadLibrary()
 in a try/catch block and ignore the exception you get when re-loading
 the native library?
 
 This just seems like it would be a lot of work for not much gain.
 

Because once you get this exception (whether you ignore it or not) you can
no longer invoke any of the native methods (they will throw their own
exceptions). Essentially, the reload operation has failed.


Christopher Schultz-2 wrote:
 
 With no webapps deployed at all? Wow, something is not right. Are you
 sure you have enough memory installed on your dev instance?
 
 Starting
 up a new instance is fairly quick. Shutting down takes a while.
 
 That seems strange... do you have a complicated shutdown procedure for
 your webapp? Tomcat shuts down on my end in very short order when no
 webapps need to be undeployed.
 

I don't think you and I are measuring the same thing. Tomcat loads up in
under 2 seconds, but it takes over 8 seconds to shut down. It is quite
possible that the Netbeans plugin is injecting a sleep() somewhere but I'm
not sure. I know they have a 5 second sleep for the Glassfish plugin. I'm
guessing they had a good reason for adding those calls though. Does Tomcat
provide hooks for integrators to know that the webapp is fully unloaded? How
long does a restart (without a webapp) take on your end?


Christopher Schultz-2 wrote:
 
 When restarting a webapp, we don't have to wait for the old instance to
 finish shutting down (which is slow) before transferring access to
 another
 Tomcat instance.
 
 If they're going to be using the same port, you do.
 

They wouldn't use the same port.


Christopher Schultz-2 wrote:
 
 The new instance can simply bind to a different port and
 the proxy running at port 80 can switch which port it is redirecting
 requests to.
 
 So... you want Tomcat to also notify a 3rd-party that it's being shut
 down so that a proxy can re-configure itself?
 

No. I would ask the proxy (which would be part of Tomcat) to restart an
instance on my behalf. It would do the necessary communication with the
instance to request a shutdown and listen for lifecycle events.


Christopher Schultz-2 wrote:
 
 The only snag I can think of is that the old instance might
 keep files locked on disk (but I think this is no longer the case with
 Tomcat 7.x)
 
 I don't believe Tomcat locks anything specific. Under certain
 situations, the JVM and the OS conspire to lock certain resources
 (usually .jar files) and that can be a problem.
 
 If you're starting a new instance in parallel, wouldn't you want to do
 it from a separate directory anyway?
 

Good point. We could do that.

Gili
-- 
View this message in context: 
http://old.nabble.com/One-process-per-webapp-tp31836121p31847022.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: One process per webapp

2011-06-14 Thread cowwoc


Christopher Schultz-2 wrote:
 
 So, now you want Tomcat to launch multiple copies of itself as hot
 standbys for /potential future webapp deployments/? We'll never do this.
 

The exact mechanism is not fixed in stone (I'm sure we could improve on the
initial idea). One approach is that administrators should be able to
configure webapps in development mode, and in only such a case you'd
launch a hot standby.


Christopher Schultz-2 wrote:
 
 * A webapp must invoke System.loadLibrary() to use JNI.
 
 Must it? You can load a native library at a higher-level instead of in
 the webapp itself and avoid all of this.
 

That's not good enough. Webapps that use JNI will modify DLLs between
reloads. Even if you If you load the DLL in some parent ClassLoader you'll
still need to unload it every time the webapp is reloaded, otherwise you'll
miss changes to the DLL.


Christopher Schultz-2 wrote:
 
 * If a library is loaded by one ClassLoader and another ClassLoader
 invokes
 System.loadLibrary() the JVM will throw: java.lang.UnsatisfiedLinkError:
 Native Library x already loaded in another classloader.
 
 I don't believe this has anything to do with ClassLoaders.
 

Yes it does. Read the evaluation of
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4286309
You may only load a library into one ClassLoader at a time. The library is
only unloaded from the JVM when the ClassLoader is garbage-collected.


Christopher Schultz-2 wrote:
 
 I don't think the ClassLoader ever unloads the native library. I haven't
 found any documentation that suggests that it will.
 

This was indeed hard to track down. See the evaluation of
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4119554 and
http://codethesis.com/tutorial.php?id=1

Worse-case scenario we could run independent tests to verify this but either
way I think we can both agree the safest and easiest way to ensure proper
reloading of native libraries is to restart the JVM.


Christopher Schultz-2 wrote:
 
 Or you can put your .jar that wraps your native library in Tomcat's lib
 directory and take it out of your webapp. That's not the most portable
 solution, but neither is using a native library in the first place.
 

That's not an option because as I've mentioned before the native library is
potentially the very thing you are redeploying.


Christopher Schultz-2 wrote:
 
 It's not a good excuse, but native libraries are a pain in the ass in
 Java. If you use one, be prepared to have your ass hurt.
 

:) With all due respect, they are only painful to use in web containers.
They are extremely simple to use in desktop applications.


Christopher Schultz-2 wrote:
 
 Aah, you are a REST guy. That explains the constant appeals against
 practicality. ;)
 
 If you wrapped your JNI library with a REST interface, couldn't you
 avoid all this foolishness?
 

That's precisely what I'm doing :) I still need to be able to redeploy the
native library though. Think of the native library + RESTful interface +
Tomcat as an appliance. I'm making regular updates to the library and I
need to restart it quickly to speed up the debugging process.

Gili
-- 
View this message in context: 
http://old.nabble.com/One-process-per-webapp-tp31836121p31847177.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 7.0.11 embedded does not load context.xml [SEC=UNCLASSIFIED]

2011-06-14 Thread Fraser, James
UNCLASSIFIED

Great, thankyou. 

-Original Message-
From: Mark Thomas [mailto:ma...@apache.org]
Sent: Tuesday, 14 June 2011 8:38 PM
To: Tomcat Users List
Subject: Re: Tomcat 7.0.11 embedded does not load context.xml
[SEC=UNCLASSIFIED]

On 14/06/2011 05:14, Fraser, James wrote:
 UNCLASSIFIED
 
 Hi,
 
 I am trying to embed Tomcat 7.0.11 into my standard web application.
 This web application defines some Resource elements in 
 META-INF/context.xml - yet, Tomcat is not loading this file.

addWebapp should return a Context object. You'll need to call
setConfigFile() on that Context object.

Mark

 
 tomcat = new Tomcat();
 tomcat.setBaseDir(.);
 tomcat.setPort(8084);
 tomcat.addWebapp(/, System.getProperty(user.dir) + 
 /build/web);
 tomcat.setHostname(localhost);
 tomcat.enableNaming();
 tomcat.start();
 
 Causes the following error: 
 
 javax.naming.NamingException: Cannot create resource instance
 at
 org.apache.naming.factory.ResourceEnvFactory.getObjectInstance(Resourc
 eE
 nvFactory.java:117)
 at

javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:826)
 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:145)
 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:814)
 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:159)
 at
 dsto.adiib.ws.harmoniser.AdiibHarmoniser.init(AdiibHarmoniser.java:1
 13
 )
 at
 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
 Method)
 at
 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructo
 rA
 ccessorImpl.java:39)
 at
 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCo
 ns
 tructorAccessorImpl.java:27)
 at
 java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at java.lang.Class.newInstance0(Class.java:355)
 at java.lang.Class.newInstance(Class.java:308)
 at
 com.sun.xml.ws.api.server.InstanceResolver.createNewInstance(InstanceR
 es
 olver.java:215)
 at
 com.sun.xml.ws.api.server.InstanceResolver.createDefault(InstanceResol
 ve
 r.java:180)
 at
 com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.j
 av
 a:123)
 at
 com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:505)
 at
 com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters
 (D
 eploymentDescriptorParser.java:253)
 at
 com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(Deploym
 en
 tDescriptorParser.java:147)
 at
 com.sun.xml.ws.transport.http.servlet.WSServletContextListener.context
 In
 itialized(WSServletContextListener.java:124)
 
 at
 org.apache.catalina.core.StandardContext.listenerStart(StandardContext
 .j
 ava:4681)
 at
 org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5
 18
 4)
 at
 org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5
 17
 9)
 at
 java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
 at java.util.concurrent.FutureTask.run(FutureTask.java:138)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecu
 to
 r.java:886)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
 ja
 va:908)
 at java.lang.Thread.run(Thread.java:662)
 
 Line 113 of AdiibHarmoniser is like so: 
 
 HarmoniserImplConfigBean harmoniserImplConfigBean = 
 (HarmoniserImplConfigBean)envCtx.lookup(beanName);
 
 This essentially loads some external beans for me. 
 
 My context.xml looks like so: 
 
 ?xml version=1.0 encoding=UTF-8? Context antiJARLocking=true 
 path=/AdiibHarmoniser
   Resource auth=Container csdTypeComparatorValue=VIDEO
 csdViewDataModel=NSIL_VIDEO_VIEW dibTextPath=//video
 factory=org.apache.naming.factory.BeanFactory harmonise=true
 harmoniserClassName=dsto.adiib.ws.harmoniser.FmvHarmoniser
 name=bean/FmvFactory subscriptionId=adiibFmvHarmoniser
 type=dsto.adiib.ws.harmoniser.HarmoniserImplConfigBean/
 
   Resource auth=Container csdTypeComparatorValue=IMAGERY
 csdViewDataModel=NSIL_IMAGERY_VIEW dibTextPath=//nitf
 factory=org.apache.naming.factory.BeanFactory harmonise=true
 harmoniserClassName=dsto.adiib.ws.harmoniser.NitfHarmoniser
 name=bean/NitfFactory subscriptionId=adiibNitfHarmoniser
 type=dsto.adiib.ws.harmoniser.HarmoniserImplConfigBean/
 
 /Context
 
 Using normal Tomcat (non embedded) everything works fine. I found a 
 post similar to my problem here:
 http://stackoverflow.com/questions/5238451/jndi-jdbc-data-source-in-em
 be dded-tomcat-7, yet this caused a followon exception.
 
 java.lang.NoSuchMethodError:
 org.apache.catalina.Context.setConfigFile(Ljava/lang/String;)V
 
 Any ideas? 
 
 Kind Regards,
 
 James
 
 IMPORTANT: This email remains the property of the Department of 
 Defence and is 

Embedded tomcat and unit testing.. Tomcat either stops or my unit tests don't execute? [SEC=UNCLASSIFIED]

2011-06-14 Thread Fraser, James
UNCLASSIFIED 

Hi, 

I have the following in my unit test. 

@BeforeClass
public static void setUpClass() throws ServletException,
LifecycleException, MalformedURLException {
tomcat = new Tomcat();
tomcat.setBaseDir(.);
tomcat.setPort(8084);
Context ctx = tomcat.addWebapp(/,
System.getProperty(user.dir) + /build/web);
tomcat.setHostname(localhost); 

File contextFile = new File(System.getProperty(user.dir) +
/build/web/META-INF/context.xml);
ctx.setConfigFile(contextFile.toURI().toURL()); 

tomcat.enableNaming();
tomcat.start();
tomcat.getServer().await();   
} 

Without the line `tomcat.getServer().await();`, Tomcat simply stops;
with the line `tomcat.getServer().await();`, it looks as though the
thread blocks and my unit tests don't execute.. Any idea?

James 

IMPORTANT: This email remains the property of the Department of Defence
and is subject to the jurisdiction of section 70 of the Crimes Act 1914.
If you have received this email in error, you are requested to contact
the sender and delete the email. 




RE: Embedded tomcat and unit testing.. Tomcat either stops or my unit tests don't execute? [SEC=UNCLASSIFIED]

2011-06-14 Thread Caldarale, Charles R
 From: Fraser, James [mailto:james.fra...@dsto.defence.gov.au] 
 Subject: Embedded tomcat and unit testing.. Tomcat either stops 
 or my unit tests don't execute? [SEC=UNCLASSIFIED]

 tomcat.enableNaming();
 tomcat.start();
 tomcat.getServer().await();   

 Without the line `tomcat.getServer().await();`, Tomcat simply stops;

As expected, since all of Tomcat's threads are daemons.

 with the line `tomcat.getServer().await();`, it looks as though the
 thread blocks and my unit tests don't execute..

Not having used an embedded Tomcat, I can't really comment on what you're 
missing.  You might first try diagnosing it by connecting to the program (with 
the await() in place) via JConsole, and see what threads are present.  Compare 
that with Tomcat running normally (not embedded).

 - 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: Embedded tomcat and unit testing.. Tomcat either stops or my unit tests don't execute? [SEC=UNCLASSIFIED]

2011-06-14 Thread Fraser, James
UNCLASSIFIED

I read that Apache use embedded Tomcat for unit testing. Are there any
examples floating around? 

-Original Message-
From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
Sent: Wednesday, 15 June 2011 10:01 AM
To: Tomcat Users List
Subject: RE: Embedded tomcat and unit testing.. Tomcat either stops or
my unit tests don't execute? [SEC=UNCLASSIFIED]

 From: Fraser, James [mailto:james.fra...@dsto.defence.gov.au]
 Subject: Embedded tomcat and unit testing.. Tomcat either stops or my 
 unit tests don't execute? [SEC=UNCLASSIFIED]

 tomcat.enableNaming();
 tomcat.start();
 tomcat.getServer().await();   

 Without the line `tomcat.getServer().await();`, Tomcat simply stops;

As expected, since all of Tomcat's threads are daemons.

 with the line `tomcat.getServer().await();`, it looks as though the 
 thread blocks and my unit tests don't execute..

Not having used an embedded Tomcat, I can't really comment on what
you're missing.  You might first try diagnosing it by connecting to the
program (with the await() in place) via JConsole, and see what threads
are present.  Compare that with Tomcat running normally (not embedded).

 - 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


IMPORTANT: This email remains the property of the Department of Defence
and is subject to the jurisdiction of section 70 of the Crimes Act 1914.
If you have received this email in error, you are requested to contact
the sender and delete the email.


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



RE: Embedded tomcat and unit testing.. Tomcat either stops or my unit tests don't execute? [SEC=UNCLASSIFIED]

2011-06-14 Thread Caldarale, Charles R
 From: Fraser, James [mailto:james.fra...@dsto.defence.gov.au] 
 Subject: RE: Embedded tomcat and unit testing.. Tomcat either 
 stops or my unit tests don't execute? [SEC=UNCLASSIFIED]

 I read that Apache use embedded Tomcat for unit testing. Are there any
 examples floating around? 

Good thought.  I believe all of the tests are in the Tomcat source download; 
they run inside junit.

I'm sure Mark T could tell you exactly what's wrong, but I suspect he's 
sleeping at the moment (UK).

 - 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: Embedded tomcat and unit testing.. Tomcat either stops or my unit tests don't execute? [SEC=UNCLASSIFIED]

2011-06-14 Thread Fraser, James
UNCLASSIFIED

Hi Chuck,

Thanks for your help. I got it working in the end. I suspect the main
problem had to do with not terminating the running instance of Tomcat
correctly in a tear-down method. I solved this using the example in the
Tomcat unit tests; i.e.

 @AfterClass
public static void tearDownClass() throws LifecycleException {
if (tomcat.getServer() != null
 tomcat.getServer().getState() !=
LifecycleState.DESTROYED) {
if (tomcat.getServer().getState() != LifecycleState.STOPPED)
{
tomcat.stop();
}
tomcat.destroy();
}
}

- James 

-Original Message-
From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
Sent: Wednesday, 15 June 2011 11:27 AM
To: Tomcat Users List
Subject: RE: Embedded tomcat and unit testing.. Tomcat either stops or
my unit tests don't execute? [SEC=UNCLASSIFIED]

 From: Fraser, James [mailto:james.fra...@dsto.defence.gov.au]
 Subject: RE: Embedded tomcat and unit testing.. Tomcat either stops or

 my unit tests don't execute? [SEC=UNCLASSIFIED]

 I read that Apache use embedded Tomcat for unit testing. Are there any

 examples floating around?

Good thought.  I believe all of the tests are in the Tomcat source
download; they run inside junit.

I'm sure Mark T could tell you exactly what's wrong, but I suspect he's
sleeping at the moment (UK).

 - 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


IMPORTANT: This email remains the property of the Department of Defence
and is subject to the jurisdiction of section 70 of the Crimes Act 1914.
If you have received this email in error, you are requested to contact
the sender and delete the email.


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