Re: [somewhat OT] Apache Tomcat7 service start randomly after the installation of McAfee antivirus.

2014-07-02 Thread André Warnier

Blachon, Philippe wrote:

Good morning,

We have 4 identical servers with a scheduled task running every night on each of 
them. This task Stop Tomcat - Update some data - Start Tomcat.
This worked fine for months.
We have installed a new antivirus McAfee 3 weeks ago. Now the Tomcat7 service 
starts randomly. At least 1 of the 4 server needs a manual start of the Tomcat7 
service every morning.

Do you know if there is specifics problems between Tomcat and Mc Afee ?
We have already tried to exclude Tomcat.exe from McAfee scanning. Is there 
other thing we could exclude without compromising the security ?

Configuration:
Windows server 2008 R2 Standard - SP1
Apache Tomcat 7.0.29 Server
McAffee Agent 4.8.0.1500
Mcafee VirusScan Enterprise 8.8.04001

Thanks, have a nice day,
Philippe Blachon.



Not a direct answer to your question, but maybe a bit of lateral and logical 
thinking here :

Why would one run a virus scanner permanently on a Tomcat server ?
And why run it on most of the disk space, as opposed to just the few directories where 
some client /might/ upload external files ?

Do the applications even allow clients to put files on that server ?


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



Re: tomcat8: delayed file operations with webdav

2014-07-02 Thread Philippe
Ok, that's quite funny. With tomcat 6.0.41 and 7.0.54 the file is 
available immediately after upload (even without disabling the static 
resource caching). So either it's a bug or a feature in tomcat 8.


Regards,

Philippe


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



Re: tomcat8: delayed file operations with webdav

2014-07-02 Thread Konstantin Kolinko
2014-07-02 12:51 GMT+04:00 Philippe
d4naqaakgrnq6gizaigaqa...@protected32.unixadm.org:
 Ok, that's quite funny. With tomcat 6.0.41 and 7.0.54 the file is available
 immediately after upload (even without disabling the static resource
 caching). So either it's a bug or a feature in tomcat 8.


There is no such attribute as cachingAllowed on Context in Tomcat 8.
The attribute was moved to nested Resources element.
http://tomcat.apache.org/migration-8.html#Web_application_resources

Best regards,
Konstantin Kolinko

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



Re: Where can I store data files in a tomcat war

2014-07-02 Thread Paul Taylor


I guess I'm a little confused as to what this means.

I have a simple WAR based web application that uses Lucene created
indexes to provide search results in a xml format.

Especially given the following context:

and supplementary question how do I modify my pom file to do this
with maven

I was under the impression that Paul was building a separate
application using Lucene during the build stage to create the
indexes, but then using an application - specific mechanism to use
those indexes.


That's what I thought, too.
Yes correct, let me explain it a bit further. I'm trying to deploy an 
application that serves results from a lucene index in response to user 
requests. Deploying it manually to my own server is fine, first of all I 
just copy the index files to a location on the disk, then I deploy my 
application, and within its web.xml I have a servlet parameter that 
defines where the indexes are, so within the servlets init() method i 
initilize the indexes. The problem is that I'm trying to deploy my 
application to Amazon Web Services using autoscaled Elastic Beanstalk, 
this means that the application has to be able to be initilized and 
created based on what is in the war because Elastic Beanstalk will 
automatically start new servers as required due to load and terminate 
those instances when not required.


I do seem to have a solution, but I detail it here because it doesn't 
seem quite right and might be useful to others.


Short Answer:
Originally I first tried putting the index files (unzipped) into the 
src/main/resources folder of my maven project, and referred to the 
WEB-INF/classes/index_dir location in my web.xml and tomcat didn't 
start. It didnt seem right for non Java classes to be in that folder 
anyway so I discarded that idea, however Ive just tried it again locally 
and it worked so if it works on EB that is the solution I'm going to use 
for now unless any better suggestions. It does mean that the resulting 
.war file is rather  large, far too large to upload from my local 
machine but as I build the code and indexes from another AWS EC2 
instance I can just dump it into S3, and deploy from S3 to EB, if I need 
to redeploy you dont seem able to redeploy from S3 but Ive realised that 
when I need to redeploy I would do it to a new EB configuration and then 
swap the dns from EB1 to EB2 to mimimize downtime so that is not really 
a problem.


A supplementary question:
Is there a system property I can use to refer to the WEB-INF as a 
relative directory rather than full path


Long Answer:
Since originally  posting this question I have looked at a few other 
possible solutions but none were satisfactory.


1. Deploy war without indexes but in my servlet init() method write code 
to grab the compressed indexes from S3 and unzip to location specified 
in web.xml. This worked with a single instance EB but unfortunately AWS 
does not wait for the init() method (which takes 20 minutes)  to finish 
before declaring it, and this meant because it was busy unzipping 
indexes and could not serve request it caused AWS monitoring to declare 
it to busy and open another two instances, once all three instances 
finished their init() method they were all up and working , then a few 
minutes two were terminated because not needed. But this means if server 
is genuinely busy the newly started instances will be declared ready by 
AWS but fail to service requests during the init() period. This seems 
like a bug with AWS but not going to change anytime soon.


2. Deploy war without indexes and use AWS .ebextensions files to grab 
and unzip the indexes. This might work but I really dislike having to 
write custom deployment code/configurations as a general rule. And 
because the size of the disk provided by the AWS instance
is limited, unzipping is not so simple. For example instead of creating 
a tar.gz file , I had to gzip the files first and then tar so when 
untarrred I could decompress one file at a time which required less 
temporaray space, this would make the eb code more complex.


3. Create a custom Amazon Image that can be used by EB, this seems 
theoretically possible but quickly got very messy and seemed very much a 
hack.


4. Use Docker, AWS now supports the docker framework. This might be a 
good solution  but having spent far too much time on understanding AWS I 
wasnt keen to spen dmore time on yet another framework to solve one problem



If the Lucene API is used, then writing a servlet context listener
that digs out the initial indexes and places them in java.io.tmpdir
in a known subdirectory is probably the way to go. This ensures
that even if a WAR file is not exploded, the Lucene DirectoryReader
API can get to the files.

That's precisely what I was suggesting.

So this is what I did with 1 but because of the AWS issue didnt work as 
well as hoped.


Paul

-
To unsubscribe, e-mail: 

Re: Error in DBCP Connection Pool with tomcat 6.x

2014-07-02 Thread Daniel Mikusa
On Wed, Jul 2, 2014 at 1:48 AM, Vijendra Pachoriya 
vijendra.pachor...@indegene.com wrote:

 Hi Filip,

 This error comes at some point of time on production, when the server is
 on load.

 I am using hibernate and not closing any connection manually, its all
 managed by hibernate and tomcat dbcp connection pool.

 For me it seems like DBCP is trying to close the connection which is
 already closed by the database server.


Have you tried looking at your database server logs to see if it's closing
the connection?  You mentioned it's under load.  Perhaps you've hit some
limit (real or arbitrary) and it's dropping you.

Dan


 Please refer below related links.

 https://issues.apache.org/jira/browse/DBCP-329


 http://markmail.org/message/c2gx2xuzum4pv743#query:+page:1+mid:ncvixx4ewe7pho2x+state:results


 Regards,
 Vijendra

 -Original Message-
 From: Filip Hanik [mailto:fi...@hanik.com]
 Sent: 01 July 2014 21:06
 To: Tomcat Users List
 Subject: Re: Error in DBCP Connection Pool with tomcat 6.x

 Looks like your code already called java.sql.Connection.close() and then
 attempts to use the connection again

 Filip



 On Tue, Jul 1, 2014 at 8:09 AM, Propes, Barry L barry.l.pro...@citi.com
 wrote:

 
 
  -Original Message-
  From: Vijendra Pachoriya [mailto:vijendra.pachor...@indegene.com]
  Sent: Tuesday, July 01, 2014 2:31 AM
  To: users@tomcat.apache.org
  Cc: Alok Roy
  Subject: Error in DBCP Connection Pool with tomcat 6.x
 
  Hi Tomcat Team,
 
  Please help me out in solving below error.
 
  Below is the details :
 
  Configuration in my
  context.xml
 
 
  Resource name=jdbc/ABC
  auth=Container
  type=javax.sql.DataSource
  maxActive=50
  maxIdle=10
  maxWait=1
  username=ABC
  password=ABC
  removeAbandoned=true
  logAbandoned=true
  testOnBorrow=true
  testWhileIdle=true
  timeBetweenEvictionRunsMillis=3
  validationQuery=SELECT 1 FROM dual
  driverClassName=oracle.jdbc.driver.OracleDriver
  url=jdbc:oracle:thin:@MY_DB /
 
 
  ==Error Message
  
 
  at
 
 org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705)
  at
 
 org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)
  at
 
 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
  at java.lang.Thread.run(Thread.java:679)
  Caused by: org.springframework.transaction.TransactionSystemException:
  Could not roll back JPA transaction; nested exception is
  javax.persistence.PersistenceException: unexpected error when rollbacking
  at
 
 org.springframework.orm.jpa.JpaTransactionManager.doRollback(JpaTransactionManager.java:486)
  at
 
 org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:800)
  at
 
 org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:777)
  at
 
 org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:339)
  at
 
 org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
  at
 
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
  at
 
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
  at sun.proxy.$Proxy185.selectPharmaUser(Unknown Source)
  at
 
 com.aptilon.axcelrx.server.service.impl.AuthenticationServiceImpl.login(AuthenticationServiceImpl.java:170)
  at
 
 com.aptilon.axcelrx.server.ws.endpoint.AuthenticationEndpoint.login_aroundBody0(AuthenticationEndpoint.java:110)
  ... 45 more
  Caused by: javax.persistence.PersistenceException: unexpected error
  when rollbacking
  at
  org.hibernate.ejb.TransactionImpl.rollback(TransactionImpl.java:88)
  at
 
 org.springframework.orm.jpa.JpaTransactionManager.doRollback(JpaTransactionManager.java:482)
  ... 54 more
  Caused by: org.hibernate.exception.GenericJDBCException: Cannot
  release connection
  at
 
 org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
  at
 
 org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
  at
 
 org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
  at
 
 org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
  at
 
 org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:478)
  at
 
 

Loading Tomcat into an already running JVM

2014-07-02 Thread Todd Little
I have an unusual need that I've been unable to find an answer for. I
would like to load Tomcat into an already running JVM. I have a process
that performs some work, loads the JVM dynamically, and I would like to
load and start Tomcat into that JVM. Has anyone done this or can anyone
provide some guidance on how to go about doing this?   I'm currently
trying this with Tomcat 7.0.54 on Linux.


Regards,
Todd




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

Re: Where can I store data files in a tomcat war

2014-07-02 Thread Paul Taylor

On 02/07/2014 11:49, Paul Taylor wrote:


I guess I'm a little confused as to what this means.

I have a simple WAR based web application that uses Lucene created
indexes to provide search results in a xml format.

Especially given the following context:

and supplementary question how do I modify my pom file to do this
with maven

I was under the impression that Paul was building a separate
application using Lucene during the build stage to create the
indexes, but then using an application - specific mechanism to use
those indexes.


That's what I thought, too.
Yes correct, let me explain it a bit further. I'm trying to deploy an 
application that serves results from a lucene index in response to 
user requests. Deploying it manually to my own server is fine, first 
of all I just copy the index files to a location on the disk, then I 
deploy my application, and within its web.xml I have a servlet 
parameter that defines where the indexes are, so within the servlets 
init() method i initilize the indexes. The problem is that I'm trying 
to deploy my application to Amazon Web Services using autoscaled 
Elastic Beanstalk, this means that the application has to be able to 
be initilized and created based on what is in the war because Elastic 
Beanstalk will automatically start new servers as required due to load 
and terminate those instances when not required.


I do seem to have a solution, but I detail it here because it doesn't 
seem quite right and might be useful to others.


Short Answer:
Originally I first tried putting the index files (unzipped) into the 
src/main/resources folder of my maven project, and referred to the 
WEB-INF/classes/index_dir location in my web.xml and tomcat didn't 
start. It didnt seem right for non Java classes to be in that folder 
anyway so I discarded that idea, however Ive just tried it again 
locally and it worked so if it works on EB that is the solution I'm 
going to use for now unless any better suggestions. It does mean that 
the resulting .war file is rather large, far too large to upload from 
my local machine but as I build the code and indexes from another AWS 
EC2 instance I can just dump it into S3, and deploy from S3 to EB, if 
I need to redeploy you dont seem able to redeploy from S3 but Ive 
realised that when I need to redeploy I would do it to a new EB 
configuration and then swap the dns from EB1 to EB2 to mimimize 
downtime so that is not really a problem.
Bother - it doesn't work because of an arbitary limit of 524,288,000 
bytes (1/2 GB) on the size of the war that can be deployed to EB. Don't 
know why Amzon have this limit but because my war now contains the index 
files its larger than that.


Looks to me the only possibility of getting it working properly is to 
use .ebextensions or Docker


Paul

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



Re: Loading Tomcat into an already running JVM

2014-07-02 Thread Mark Thomas
On 02/07/2014 13:23, Todd Little wrote:
 I have an unusual need that I've been unable to find an answer for. I
 would like to load Tomcat into an already running JVM. I have a process
 that performs some work, loads the JVM dynamically, and I would like to
 load and start Tomcat into that JVM. Has anyone done this or can anyone
 provide some guidance on how to go about doing this?   I'm currently
 trying this with Tomcat 7.0.54 on Linux.

You can embed Tomcat in any other Java app and then load it when
required. Look at the unit tests for examples of how to do this. There
is also an embedded distribution that has exactly the same features but
in fewer JARs.

Mark


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



Re: Help with Tomcat 7 clustering using BIO receiver

2014-07-02 Thread João Sávio
?


2014-06-30 18:38 GMT-03:00 João Sávio joaosa...@gmail.com:

 Hello people

 This is my first message on this group! I'm trying to set up a Tomcat
 clustering using BIO receiver but I've been receiving the following error
 when I started two nodes and tried to enter on my application:

 Jun 30, 2014 9:25:12 PM
 org.apache.catalina.tribes.transport.bio.BioReplicationT
 ask run
 SEVERE: Unable to service bio socket
 java.net.SocketTimeoutException: Read timed out
 at java.net.SocketInputStream.socketRead0(Native Method)
 at java.net.SocketInputStream.read(SocketInputStream.java:152)
 at java.net.SocketInputStream.read(SocketInputStream.java:122)
 at java.net.SocketInputStream.read(SocketInputStream.java:108)
 at
 org.apache.catalina.tribes.transport.bio.BioReplicationTask.drainSock
 et(BioReplicationTask.java:146)
 at
 org.apache.catalina.tribes.transport.bio.BioReplicationTask.run(BioRe
 plicationTask.java:64)
 at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
 java:1145)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
 .java:615)
 at java.lang.Thread.run(Thread.java:744)

 Jun 30, 2014 9:25:15 PM org.apache.catalina.ha.session.DeltaManager
 startInternal
 INFO: Register manager localhost#/myApp to cluster element Engine with
 name Catalina
 Jun 30, 2014 9:25:15 PM org.apache.catalina.ha.session.DeltaManager
 startInternal
 INFO: Starting clustering manager at localhost#/myApp
 Jun 30, 2014 9:25:15 PM org.apache.catalina.ha.session.DeltaManager
 getAllClusterSessions
 INFO: Manager [localhost#/myApp], requesting session state from
 org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 212, 191,
 209}:4000,{10, 212, 191, 2
 09},4000, alive=32096, securePort=-1, UDP Port=-1, id={-58 95 -116 89 86
 -12 714 -75 -2 74 -45 -54 -82 40 -114 }, payload={}, command={},
 domain={}, ]. This operation will timeout if no session state has been
 received within 60 seconds.


 Attached are my two server.xml configuration. I've taken the default
 configuration (worked on my computer) and replaced the following things:


 Receiver className=org.apache.catalina.tribes.transport.nio.NioReceiver
 by
 Receiver className=org.apache.catalina.tribes.transport.bio.BioReceiver

 and

 Transport
 className=org.apache.catalina.tribes.transport.nio.PooledParallelSender/
 by
 Transport
 className=org.apache.catalina.tribes.transport.bio.PooledMultiSender/


 I don't know if I'm missing something. I'll be very thankful if someone
 can take a look on my server.xml files or send me an example configuration
 using BIO receiver (I couldn't find anyone).

 Thanks
 João
 --
 http://joaosavio.wordpress.com





-- 
http://joaosavio.wordpress.com


Re: Where can I store data files in a tomcat war

2014-07-02 Thread Mark H. Wood
On Wed, Jul 02, 2014 at 11:49:36AM +0100, Paul Taylor wrote:
 I have a simple WAR based web application that uses Lucene created
 indexes to provide search results in a xml format.
 
 Especially given the following context:
 
 and supplementary question how do I modify my pom file to do this
 with maven
 
 I was under the impression that Paul was building a separate
 application using Lucene during the build stage to create the
 indexes, but then using an application - specific mechanism to use
 those indexes.
 
  That's what I thought, too.
 Yes correct, let me explain it a bit further. I'm trying to deploy an 
 application that serves results from a lucene index in response to user 
 requests. Deploying it manually to my own server is fine, first of all I 
 just copy the index files to a location on the disk, then I deploy my 
 application, and within its web.xml I have a servlet parameter that 
 defines where the indexes are, so within the servlets init() method i 
 initilize the indexes. The problem is that I'm trying to deploy my 
 application to Amazon Web Services using autoscaled Elastic Beanstalk, 
 this means that the application has to be able to be initilized and 
 created based on what is in the war because Elastic Beanstalk will 
 automatically start new servers as required due to load and terminate 
 those instances when not required.

So it sounds like this index is static, produced somewhere else and
only consulted read-only by 1..N instances of your webapp.

Could you not just plop one uncompressed copy of the index into an EBS
snapshot in an S3 bucket, and map the snapshot to each EB instance?
Then just provide environmental information to the webapp as to where
it should find the index.  Your huge index doesn't have to live in the
WAR then.

I have *very* little experience with AWS, so it's quite possible I'm
missing something.

-- 
Mark H. Wood, Lead System Programmer   mw...@iupui.edu
Machines should not be friendly.  Machines should be obedient.


signature.asc
Description: Digital signature


Re: Where can I store data files in a tomcat war

2014-07-02 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Paul,

On 7/2/14, 6:49 AM, Paul Taylor wrote:
 [L]et me explain it a bit further. I'm trying to deploy an 
 application that serves results from a lucene index in response to
 user requests. Deploying it manually to my own server is fine,
 first of all I just copy the index files to a location on the disk,
 then I deploy my application, and within its web.xml I have a
 servlet parameter that defines where the indexes are, so within the
 servlets init() method i initilize the indexes. The problem is that
 I'm trying to deploy my application to Amazon Web Services using
 autoscaled Elastic Beanstalk, this means that the application has
 to be able to be initilized and created based on what is in the war
 because Elastic Beanstalk will automatically start new servers as
 required due to load and terminate those instances when not
 required.
 
 I do seem to have a solution, but I detail it here because it
 doesn't seem quite right and might be useful to others.
 
 Short Answer: Originally I first tried putting the index files
 (unzipped) into the src/main/resources folder of my maven project,
 and referred to the WEB-INF/classes/index_dir location in my
 web.xml and tomcat didn't start. It didnt seem right for non Java
 classes to be in that folder anyway so I discarded that idea,
 however Ive just tried it again locally and it worked so if it
 works on EB that is the solution I'm going to use for now unless
 any better suggestions. It does mean that the resulting .war file
 is rather  large, far too large to upload from my local machine but
 as I build the code and indexes from another AWS EC2 instance I can
 just dump it into S3, and deploy from S3 to EB, if I need to
 redeploy you dont seem able to redeploy from S3 but Ive realised
 that when I need to redeploy I would do it to a new EB
 configuration and then swap the dns from EB1 to EB2 to mimimize
 downtime so that is not really a problem.
 
 A supplementary question: Is there a system property I can use to
 refer to the WEB-INF as a relative directory rather than full path

Don't use paths. Use the ClassLoader if Lucene can really load a file
in that way.

The problem is that you can't rely on EB to expand your WAR file on
the disk. If EB suddenly changes its deployment model to stop
expanding your WAR file, then you are hosed and your application won't
work at all.

Instead, you need to work around the problem. Let me restate the
problem so the solution makes more sense:

1. Amazon Elastic Beanstalk requires a WAR file to deploy to a cluster
2. Lucene can't read an index out of a WAR file

The solution is that the web application, packaged in a WAR file,
needs to unpack the Lucene indexes onto the disk when it starts up.
You can do this with a ServletContextListener.

Since you expand the files, you decide where to put them. The servlet
spec guarantees a temporary directory available using
application.getAttribute(javax.servlet.context.tempdir). This
returns a java.io.File object pointing to the temporary directory for
the application. Dump your files in there (a subdirectory would be a
good idea) and then point Lucene at that place on the disk.

 Long Answer: Since originally  posting this question I have looked
 at a few other possible solutions but none were satisfactory.
 
 1. Deploy war without indexes but in my servlet init() method write
 code to grab the compressed indexes from S3 and unzip to location
 specified in web.xml.

That would work, too, but you'll have to pay for download time for
each member of the cluster. If you pack the indexes in the WAR file,
they are already available when the webapp initializes.

 2. Deploy war without indexes and use AWS .ebextensions files to
 grab and unzip the indexes. This might work but I really dislike
 having to write custom deployment code/configurations as a general
 rule. And because the size of the disk provided by the AWS
 instance is limited, unzipping is not so simple. For example
 instead of creating a tar.gz file , I had to gzip the files first
 and then tar so when untarrred I could decompress one file at a
 time which required less temporaray space, this would make the eb
 code more complex.

Neither tar nor gzip take very much of anything: they are both
block-oriented. What procedure were you using to decompress the
tarballs? Decompressing the entire tarball and then tearing it apart
is a mistake: you should chain the processes together so you read from
the tarball and write individual, uncompressed files to the disk.

 3. Create a custom Amazon Image that can be used by EB, this seems 
 theoretically possible but quickly got very messy and seemed very
 much a hack.

It's a huge amount of work and the point is to give a WAR to AEB and
just do it.

 4. Use Docker, AWS now supports the docker framework. This might be
 a good solution  but having spent far too much time on
 understanding AWS I wasnt keen to spen dmore time on yet another
 

Re: Where can I store data files in a tomcat war

2014-07-02 Thread Hassan Schroeder
On Wed, Jul 2, 2014 at 8:34 AM, Christopher Schultz
ch...@christopherschultz.net wrote:

 Or, you could look into Solr which I believe understands clustering.

Or ElasticSearch, also Lucene-based, which is designed from the
get-go for clustering: http://www.elasticsearch.org/

-- 
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: Help with Tomcat 7 clustering using BIO receiver

2014-07-02 Thread Mark Eggers
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 7/2/2014 6:37 AM, João Sávio wrote:
 ?
 
 
 2014-06-30 18:38 GMT-03:00 João Sávio joaosa...@gmail.com:
 
 Hello people
 
 This is my first message on this group! I'm trying to set up a
 Tomcat clustering using BIO receiver but I've been receiving the
 following error when I started two nodes and tried to enter on my
 application:
 
 Jun 30, 2014 9:25:12 PM 
 org.apache.catalina.tribes.transport.bio.BioReplicationT ask run 
 SEVERE: Unable to service bio socket 
 java.net.SocketTimeoutException: Read timed out at
 java.net.SocketInputStream.socketRead0(Native Method) at
 java.net.SocketInputStream.read(SocketInputStream.java:152) at
 java.net.SocketInputStream.read(SocketInputStream.java:122) at
 java.net.SocketInputStream.read(SocketInputStream.java:108) at 
 org.apache.catalina.tribes.transport.bio.BioReplicationTask.drainSock

 
et(BioReplicationTask.java:146)
 at 
 org.apache.catalina.tribes.transport.bio.BioReplicationTask.run(BioRe

 
plicationTask.java:64)
 at 
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.

 
java:1145)
 at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

 
.java:615)
 at java.lang.Thread.run(Thread.java:744)
 
 Jun 30, 2014 9:25:15 PM
 org.apache.catalina.ha.session.DeltaManager startInternal INFO:
 Register manager localhost#/myApp to cluster element Engine with 
 name Catalina Jun 30, 2014 9:25:15 PM
 org.apache.catalina.ha.session.DeltaManager startInternal INFO:
 Starting clustering manager at localhost#/myApp Jun 30, 2014
 9:25:15 PM org.apache.catalina.ha.session.DeltaManager 
 getAllClusterSessions INFO: Manager [localhost#/myApp],
 requesting session state from 
 org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 212,
 191, 209}:4000,{10, 212, 191, 2 09},4000, alive=32096,
 securePort=-1, UDP Port=-1, id={-58 95 -116 89 86 -12 714 -75 -2
 74 -45 -54 -82 40 -114 }, payload={}, command={}, domain={}, ].
 This operation will timeout if no session state has been received
 within 60 seconds.
 
 
 Attached are my two server.xml configuration. I've taken the
 default configuration (worked on my computer) and replaced the
 following things:
 
 
 Receiver
 className=org.apache.catalina.tribes.transport.nio.NioReceiver 
 by Receiver
 className=org.apache.catalina.tribes.transport.bio.BioReceiver
 
 and
 
 Transport 
 className=org.apache.catalina.tribes.transport.nio.PooledParallelSender/

 
by
 Transport 
 className=org.apache.catalina.tribes.transport.bio.PooledMultiSender/



 
I don't know if I'm missing something. I'll be very thankful if someone
 can take a look on my server.xml files or send me an example
 configuration using BIO receiver (I couldn't find anyone).
 
 Thanks João -- http://joaosavio.wordpress.com

João,

Welcome to the list.

I've only used NIO, and it's been a while since I've used clustering.

A few questions to ask:

1. Is there a firewall blocking port 4000 (if the Tomcats are on
   separate machines)?
2. Multicast enabled and routed?
3. Environment (Tomcat version, java version, platforms)?
4. Why BIO?

What are you trying to accomplish by using the BIO connector rather
than the NIO connector?

You can turn on more logging by adding something like the following to
logging.properties:

# at the end of the handlers line:
,5cluster.org.apache.juli.FileHandler

# in the handler-specific properties section:
5cluster.org.apache.juli.FileHandler.level = FINER
5cluster.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
5cluster.org.apache.juli.FileHandler.prefix = cluster.

# in the facility specific properties section
# be aware of line wrapping
org.apache.catalina.tribes.MESSAGES.level = FINE
org.apache.catalina.tribes.MESSAGES.handlers =
5cluster.org.apache.juli.FileHandler

org.apache.catalina.tribes.level = FINE
org.apache.catalina.tribes.handlers = 5cluster.org.apache.juli.FileHandler

org.apache.catalina.ha.level = FINE
org.apache.catalina.ha.handlers = 5cluster.org.apache.juli.FileHander

org.apache.catalina.ha.deploy.level = INFO
org.apache.catalina.ha.deploy.handlers =
5cluster.org.apache.juli.FileHandler

Last note - we're normally a pretty helpful bunch of folks here, but
we are all volunteers. Things like work impact participation :-p. Also
as noted above, I've only used NIO so I don't know why this would not
work with BIO.

. . . just my two cents
/mde/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.13 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTtDM0AAoJEEFGbsYNeTwtkR8H/3JM2LPJBolSWp6kA2K+HJYK
mOn5LahCs6cQcZEKs6JKZMS5aVz9A8CPc4/e/LDfGJ86SH1kB1KAwPOwNtFjijl/
hpQvQYe8WTIc8Mh6QtbA1jfJD67FBqDxl356+QSrmZJnuJTEz8zAy/6L1/Fvo08c
HLYOjfkPj463TnDXJMUNIk1DSuHIdEnaxdXpM55ADTrkrJC06pM/wuU9znfpP/58
xKbkX05ODgdBLvP7sfs4vI4DoVWO81+w/4W3o7DC4y9UmqQhtTtFvSacGh8IimW2
G/+PVCbYUigKaeegqIVo9eCXeHLO7OBX6njWJKdzYtzPQHZ0AFS2miNC6AVH4co=
=bWHh
-END PGP SIGNATURE-


Re: Error in DBCP Connection Pool with tomcat 6.x

2014-07-02 Thread Phil Steitz
On 7/1/14, 10:48 PM, Vijendra Pachoriya wrote:
 Hi Filip,

 This error comes at some point of time on production, when the server is on 
 load.

 I am using hibernate and not closing any connection manually, its all managed 
 by hibernate and tomcat dbcp connection pool.

Two additional things to check:

1) Check logs to see if abandoned connections are being removed.  If
your code is closing all connections, you should not need this to be
enabled.
2) Make sure that there is no sharing across threads of the
Hibernate objects.

Phil

 For me it seems like DBCP is trying to close the connection which is already 
 closed by the database server.

 Please refer below related links.

 https://issues.apache.org/jira/browse/DBCP-329 

 http://markmail.org/message/c2gx2xuzum4pv743#query:+page:1+mid:ncvixx4ewe7pho2x+state:results
  


 Regards,
 Vijendra

 -Original Message-
 From: Filip Hanik [mailto:fi...@hanik.com] 
 Sent: 01 July 2014 21:06
 To: Tomcat Users List
 Subject: Re: Error in DBCP Connection Pool with tomcat 6.x

 Looks like your code already called java.sql.Connection.close() and then 
 attempts to use the connection again

 Filip



 On Tue, Jul 1, 2014 at 8:09 AM, Propes, Barry L barry.l.pro...@citi.com
 wrote:


 -Original Message-
 From: Vijendra Pachoriya [mailto:vijendra.pachor...@indegene.com]
 Sent: Tuesday, July 01, 2014 2:31 AM
 To: users@tomcat.apache.org
 Cc: Alok Roy
 Subject: Error in DBCP Connection Pool with tomcat 6.x

 Hi Tomcat Team,

 Please help me out in solving below error.

 Below is the details :

 Configuration in my 
 context.xml


 Resource name=jdbc/ABC
 auth=Container
 type=javax.sql.DataSource
 maxActive=50
 maxIdle=10
 maxWait=1
 username=ABC
 password=ABC
 removeAbandoned=true
 logAbandoned=true
 testOnBorrow=true
 testWhileIdle=true
 timeBetweenEvictionRunsMillis=3
 validationQuery=SELECT 1 FROM dual
 driverClassName=oracle.jdbc.driver.OracleDriver
 url=jdbc:oracle:thin:@MY_DB /


 ==Error Message 
 

 at
 org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705)
 at
 org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)
 at
 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
 at java.lang.Thread.run(Thread.java:679)
 Caused by: org.springframework.transaction.TransactionSystemException:
 Could not roll back JPA transaction; nested exception is
 javax.persistence.PersistenceException: unexpected error when rollbacking
 at
 org.springframework.orm.jpa.JpaTransactionManager.doRollback(JpaTransactionManager.java:486)
 at
 org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:800)
 at
 org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:777)
 at
 org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:339)
 at
 org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
 at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 at
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 at sun.proxy.$Proxy185.selectPharmaUser(Unknown Source)
 at
 com.aptilon.axcelrx.server.service.impl.AuthenticationServiceImpl.login(AuthenticationServiceImpl.java:170)
 at
 com.aptilon.axcelrx.server.ws.endpoint.AuthenticationEndpoint.login_aroundBody0(AuthenticationEndpoint.java:110)
 ... 45 more
 Caused by: javax.persistence.PersistenceException: unexpected error 
 when rollbacking
 at
 org.hibernate.ejb.TransactionImpl.rollback(TransactionImpl.java:88)
 at
 org.springframework.orm.jpa.JpaTransactionManager.doRollback(JpaTransactionManager.java:482)
 ... 54 more
 Caused by: org.hibernate.exception.GenericJDBCException: Cannot 
 release connection
 at
 org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
 at
 org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
 at
 org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
 at
 org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
 at
 org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:478)
 at
 org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:429)
 at
 

Re: Where can I store data files in a tomcat war

2014-07-02 Thread Paul Taylor

On 02/07/2014 15:06, Mark H. Wood wrote:

On Wed, Jul 02, 2014 at 11:49:36AM +0100, Paul Taylor wrote:

I have a simple WAR based web application that uses Lucene created
indexes to provide search results in a xml format.

Especially given the following context:

and supplementary question how do I modify my pom file to do this
with maven

I was under the impression that Paul was building a separate
application using Lucene during the build stage to create the
indexes, but then using an application - specific mechanism to use
those indexes.


That's what I thought, too.

Yes correct, let me explain it a bit further. I'm trying to deploy an
application that serves results from a lucene index in response to user
requests. Deploying it manually to my own server is fine, first of all I
just copy the index files to a location on the disk, then I deploy my
application, and within its web.xml I have a servlet parameter that
defines where the indexes are, so within the servlets init() method i
initilize the indexes. The problem is that I'm trying to deploy my
application to Amazon Web Services using autoscaled Elastic Beanstalk,
this means that the application has to be able to be initilized and
created based on what is in the war because Elastic Beanstalk will
automatically start new servers as required due to load and terminate
those instances when not required.

So it sounds like this index is static, produced somewhere else and
only consulted read-only by 1..N instances of your webapp.

Could you not just plop one uncompressed copy of the index into an EBS
snapshot in an S3 bucket, and map the snapshot to each EB instance?
Then just provide environmental information to the webapp as to where
it should find the index.  Your huge index doesn't have to live in the
WAR then.

I have *very* little experience with AWS, so it's quite possible I'm
missing something.
It is read only, but each instance of lucene would need its own copy of 
the index, Lucene does special low level io with the index using memory 
mapping and the files do need to reside locally for acceptable 
performance. So the index doesnot have to exist in the WAR but it does 
need to exist on the EC2 instance (server).





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



Re: Where can I store data files in a tomcat war

2014-07-02 Thread Paul Taylor

On 02/07/2014 16:34, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Paul,

On 7/2/14, 6:49 AM, Paul Taylor wrote:

[L]et me explain it a bit further. I'm trying to deploy an
application that serves results from a lucene index in response to
user requests. Deploying it manually to my own server is fine,
first of all I just copy the index files to a location on the disk,
then I deploy my application, and within its web.xml I have a
servlet parameter that defines where the indexes are, so within the
servlets init() method i initilize the indexes. The problem is that
I'm trying to deploy my application to Amazon Web Services using
autoscaled Elastic Beanstalk, this means that the application has
to be able to be initilized and created based on what is in the war
because Elastic Beanstalk will automatically start new servers as
required due to load and terminate those instances when not
required.

I do seem to have a solution, but I detail it here because it
doesn't seem quite right and might be useful to others.

Short Answer: Originally I first tried putting the index files
(unzipped) into the src/main/resources folder of my maven project,
and referred to the WEB-INF/classes/index_dir location in my
web.xml and tomcat didn't start. It didnt seem right for non Java
classes to be in that folder anyway so I discarded that idea,
however Ive just tried it again locally and it worked so if it
works on EB that is the solution I'm going to use for now unless
any better suggestions. It does mean that the resulting .war file
is rather  large, far too large to upload from my local machine but
as I build the code and indexes from another AWS EC2 instance I can
just dump it into S3, and deploy from S3 to EB, if I need to
redeploy you dont seem able to redeploy from S3 but Ive realised
that when I need to redeploy I would do it to a new EB
configuration and then swap the dns from EB1 to EB2 to mimimize
downtime so that is not really a problem.

A supplementary question: Is there a system property I can use to
refer to the WEB-INF as a relative directory rather than full path

Don't use paths. Use the ClassLoader if Lucene can really load a file
in that way.

The problem is that you can't rely on EB to expand your WAR file on
the disk. If EB suddenly changes its deployment model to stop
expanding your WAR file, then you are hosed and your application won't
work at all.
Lucene works on files and does low level io memory mapping so I do need 
to use paths, but anyway it doesnt matter because as describe din my 
last post EB doesn't allow me to have a war file big enough to hold the 
index files anyway.


Instead, you need to work around the problem. Let me restate the
problem so the solution makes more sense:

1. Amazon Elastic Beanstalk requires a WAR file to deploy to a cluster
2. Lucene can't read an index out of a WAR file

The solution is that the web application, packaged in a WAR file,
needs to unpack the Lucene indexes onto the disk when it starts up.
You can do this with a ServletContextListener.
So I do within init() method of my servlet, but EB doesnt wait for the 
init() method to finish before declaring the application ready, do you 
think it would wait for code using a ServletContextListener or fail in 
the same way it does for init() ?

Since you expand the files, you decide where to put them. The servlet
spec guarantees a temporary directory available using
application.getAttribute(javax.servlet.context.tempdir). This
returns a java.io.File object pointing to the temporary directory for
the application. Dump your files in there (a subdirectory would be a
good idea) and then point Lucene at that place on the disk.


Long Answer: Since originally  posting this question I have looked
at a few other possible solutions but none were satisfactory.

1. Deploy war without indexes but in my servlet init() method write
code to grab the compressed indexes from S3 and unzip to location
specified in web.xml.

That would work, too, but you'll have to pay for download time for
each member of the cluster. If you pack the indexes in the WAR file,
they are already available when the webapp initializes.
See my later posts, it doesn't work because of problem with EB not 
respecting finish of init(), and I cant pack the indexes into WAR 
because breaks Amazons max war size of 1/2 GB





2. Deploy war without indexes and use AWS .ebextensions files to
grab and unzip the indexes. This might work but I really dislike
having to write custom deployment code/configurations as a general
rule. And because the size of the disk provided by the AWS
instance is limited, unzipping is not so simple. For example
instead of creating a tar.gz file , I had to gzip the files first
and then tar so when untarrred I could decompress one file at a
time which required less temporaray space, this would make the eb
code more complex.

Neither tar nor gzip take very much of anything: they are both
block-oriented. What 

Silent failure to deploy or run from configuration descriptor

2014-07-02 Thread Gulliver Smith
Apache Tomcat/7.0.28, Debian

I have two configuration descriptors in /etc/tomcat7/Catalina/localhost/

One, solr.xml deploys correctly and fills catalina.out with lots of
useful messages.


The other fails silently to start (see below).

I see the message INFO: Deploying configuration descriptor in
catalina.out; then there is nothing else in catalina.out.

Is there any way to cause Tomcat to output more debug information? I
haven't been able to narrow an internet search to get useful answers
for this problem.

The most annoying thing is that this has worked fine for at least one
Tomcat 6 installation.

The deployment descriptor is

Context docBase=/opt/myApp/MyApp.war
 crossContext=true 
  Resource
  name=jdbc/LockDB
  auth=Container
  type=javax.sql.DataSource
  maxActive=100
  maxIdle=30
  maxWait=1
  removeAbandoned=true
  testWhileIdle=true
  timeBetweenEvictionRunsMillis=6
  driverClassName=com.mysql.jdbc.Driver
  username=myApp
  password=xx
  url=jdbc:mysql://127.0.0.1/myApp /
   Loader
className=org.apache.catalina.loader.VirtualWebappLoader
virtualClasspath=/opt/myApp/ext/*.jar;/opt/myApp/resources/ /
/Context


Thanks for any guidance

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



Re: [ANN] Apache Tomcat 8.0.9 (stable) available

2014-07-02 Thread Emmanuel Bourg
I'm also pleased to announce that Tomcat 8.0.9 is now available for
Debian 7 (Wheezy) through the backport repository [1].

The repository has to be declared in /etc/apt/sources.list by adding
this line:

deb http://http.debian.net/debian wheezy-backports main

The package can then be installed with:

apt-get update
apt-get install tomcat8

For Ubuntu users the package is also available for Utopic Unicorn [2]
(to be released this fall).

Emmanuel Bourg

[1] http://backports.debian.org
[2] http://packages.ubuntu.com/utopic/tomcat8


Le 26/06/2014 09:00, Mark Thomas a écrit :
 The Apache Tomcat team announces the immediate availability of Apache
 Tomcat 8.0.9, the first stable release of the 8.0.x series.
 
 Apache Tomcat 8 is an open source software implementation of the Java
 Servlet, JavaServer Pages, Java Unified Expression Language and Java
 WebSocket technologies.
 
 Apache Tomcat 8 is aligned with Java EE 7. In addition to supporting
 updated versions of the Java EE specifications, Tomcat 8 includes a
 number of improvements compared to Tomcat 7. The notable changes
 include:
 
 - Support for Java Servlet 3.1, JavaServer Pages 2.3, Java Unified
   Expression Language 3.0 and Java WebSocket 1.0.
 
 - The default connector implementation is now the Java non-blocking
   implementation (NIO) for both HTTP and AJP.
 
 - A new resources implementation that replaces Aliases, VirtualLoader,
   VirtualDirContext, JAR resources and external repositories with a
   single, consistent approach for configuring additional web
   application resources. The new resources implementation can also be
   used to implement overlays (using a master WAR as the basis for
   multiple web applications that each have their own
   customizations).
 
 
 Apache Tomcat 8.0.9 includes numerous fixes for issues identified
 in 8.0.8 as well as a number of other enhancements and changes. The
 notable changes since 8.0.8 include:
 
 - Start to move towards RFC6265 for cookie handling
 
 - Better error handling when the error occurs after the response has
   been committed
 
 - Various Jasper improvements to make it easier for other containers
   (e.g. Jetty) to consume
 
 
 Please refer to the change log for the complete list of changes:
 http://tomcat.apache.org/tomcat-8.0-doc/changelog.html
 
 Note: This version has 4 zip binaries: a generic one and three
   bundled with Tomcat native binaries for Windows operating systems
   running on different CPU architectures.
 
 Downloads:
 http://tomcat.apache.org/download-80.cgi
 
 Migration guides from Apache Tomcat 5.5.x, 6.0.x and 7.0.x:
 http://tomcat.apache.org/migration.html
 
 Enjoy!
 
 - The Apache Tomcat team


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



Interface default methods

2014-07-02 Thread Leo Donahue
I don't want to start a war, but just curious if the Tomcat developers see
any use case for adding default methods to any of the Interfaces in the API?

Leo


Re: [somewhat OT] Apache Tomcat7 service start randomly after the installation of McAfee antivirus.

2014-07-02 Thread Leo Donahue
On Wed, Jul 2, 2014 at 2:33 AM, André Warnier a...@ice-sa.com wrote:

 Blachon, Philippe wrote:

 Good morning,

 We have 4 identical servers with a scheduled task running every night on
 each of them. This task Stop Tomcat - Update some data - Start Tomcat.
 This worked fine for months.
 We have installed a new antivirus McAfee 3 weeks ago. Now the Tomcat7
 service starts randomly. At least 1 of the 4 server needs a manual start of
 the Tomcat7 service every morning.

 Do you know if there is specifics problems between Tomcat and Mc Afee ?
 We have already tried to exclude Tomcat.exe from McAfee scanning. Is
 there other thing we could exclude without compromising the security ?

 Configuration:
 Windows server 2008 R2 Standard - SP1
 Apache Tomcat 7.0.29 Server
 McAffee Agent 4.8.0.1500
 Mcafee VirusScan Enterprise 8.8.04001

 Thanks, have a nice day,
 Philippe Blachon.


 Not a direct answer to your question, but maybe a bit of lateral and
 logical thinking here :

 Why would one run a virus scanner permanently on a Tomcat server ?


Does the OP work in the government?  My former employer had virus scanning
software on every server.  You couldn't get a server image without it.

The answer to that question is really based on policy, if he works in
government.  Eventually, that server has the potential for getting a virus
somehow from something or someone, and someone has to answer the question:
why wasn't there virus scanning software on the server?

Leo