Setting SSL in Tomcat 7.0

2015-07-12 Thread Joby J. Joseph
Hi,

I need a help for setting up the SSL in Tomcat Server 7.0.

I have created keystore and changed the server.xml file. But, I am getting the 
following exception.

Screen for creating the keystore.

[cid:image001.jpg@01D0BC9D.88D0B150]

After this, I did a listing for the keystore values. It shows an error.

keytool -list -keystore .keystore

and it gives..
keytool error: java.lang.Exception: Keystore file does not exist: .keystore

Any suggestion this error.
Where is the keystore file located.


Thanks in advance...



 Joby J. Joseph
 Systems Engineer -  Application Support


**
This message contains confidential information and is intended for the use of 
the addressee only. If you are not the intended recipient of this 
communication, please delete it immediately, do not copy, distribute or 
otherwise share this information, and notify the sender promptly.

Any views or opinions presented in this e-mail are solely those of the author 
and do not necessarily represent those of the Bank. The Bank does not endorse 
or accept responsibility for such views and opinions and accordingly, they are 
not legally binding on the Bank.

WARNING: Although the Bank has taken reasonable precautions to ensure no 
viruses are present in this e-mail, the Bank cannot accept responsibility for 
any loss or damage arising from the use of this e-mail or its attachments and 
shall not be liable for the e-mail content transmitted over the Internet.
*

Re: Setting SSL in Tomcat 7.0

2015-07-12 Thread Sanaullah
Hi Joby,

Where is your keystore file ?

keytool error: java.lang.Exception: Keystore file does not exist:
.keystore

The Error is self explanatory, Keystore file does not exist  could you
share your server.xml file configuration and also let us know the steps,
how did you create the keystore ?

Regards,
Sanaullah

On Sun, Jul 12, 2015 at 2:23 AM, Joby J. Joseph jjos...@bankboubyan.com
wrote:

  Hi,



 I need a help for setting up the SSL in Tomcat Server 7.0.



 I have created keystore and changed the server.xml file. But, I am getting
 the following exception.



 Screen for creating the keystore.





 After this, I did a listing for the keystore values. It shows an error.



 keytool -list -keystore .keystore

 and it gives..
 keytool error: java.lang.Exception: Keystore file does not exist: .keystore



 Any suggestion this error.

 Where is the keystore file located.





 Thanks in advanceā€¦







  Joby J. Joseph

  Systems Engineer -  Application Support




 **
 This message contains confidential information and is intended for the use
 of the addressee only. If you are not the intended recipient of this
 communication, please delete it immediately, do not copy, distribute or
 otherwise share this information, and notify the sender promptly.

 Any views or opinions presented in this e-mail are solely those of the
 author and do not necessarily represent those of the Bank. The Bank does
 not endorse or accept responsibility for such views and opinions and
 accordingly, they are not legally binding on the Bank.

 WARNING: Although the Bank has taken reasonable precautions to ensure no
 viruses are present in this e-mail, the Bank cannot accept responsibility
 for any loss or damage arising from the use of this e-mail or its
 attachments and shall not be liable for the e-mail content transmitted over
 the Internet.
 *



Re: Setting SSL in Tomcat 7.0

2015-07-12 Thread Sanaullah
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA
I don't know whats the output of the above command which run and either its
executed successfully or not

You can follow the below example. I am using linux Machine.

root@ubuntu:/home/sanaullah# keytool -genkey -alias tomcat -keyalg RSA

Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  PK
What is the name of your organizational unit?
  [Unknown]:  test
What is the name of your organization?
  [Unknown]:  test
What is the name of your City or Locality?
  [Unknown]:
What is the name of your State or Province?
  [Unknown]:
What is the two-letter country code for this unit?
  [Unknown]:
Is CN=PK, OU=test, O=test, L=Unknown, ST=Unknown, C=Unknown correct?
  [no]:  yes

Enter key password for tomcat
(RETURN if same as keystore password):
root@ubuntu:/home/sanaullah# ls
root@ubuntu:/home/sanaullah# ls /root/.keystore

As i was running the keytool command using root user so the keystore is
created in /root/.keystore. you must find the file somewhere in windows and
set its path in the connector configuration and also set its password

Connector
   protocol=org.apache.coyote.http11.Http11NioProtocol
   port=8443 maxThreads=200
   scheme=https secure=true SSLEnabled=true
   keystoreFile=${user.home}/.keystore keystorePass=changeit
   clientAuth=false sslProtocol=TLS/

Regards,
Sanaullah





On Sun, Jul 12, 2015 at 2:42 AM, Joby J. Joseph jjos...@bankboubyan.com
wrote:

 Hi,

 Thanks for the reply.
 I have followed the same steps provided by the tomcat documentation.

 https://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration


 First I created the keystore file by executing the command ...

 %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA

 Then I added it in the config file.

 Connector
protocol=org.apache.coyote.http11.Http11NioProtocol
port=8443 maxThreads=200
scheme=https secure=true SSLEnabled=true
keystoreFile=${user.home}/.keystore keystorePass=changeit
clientAuth=false sslProtocol=TLS/

 Here. I got the error as...



 SEVERE: Failed to load keystore type JKS with path
 C:\Windows\system32\config\systemprofile/.keystore due to
 C:\Windows\system32\config\systemprofile\.keystore (The system cannot find
 the file specified)
 java.io.FileNotFoundException:
 C:\Windows\system32\config\systemprofile\.keystore (The system cannot find
 the file specified)
 at java.io.FileInputStream.open(Native Method)
 at java.io.FileInputStream.init(Unknown Source)
 at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFactory.java:400)
 at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocketFactory.java:306)
 at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:565)
 at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:505)
 at
 org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:490)
 at
 org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:566)
 at
 org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:417)
 at
 org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
 at
 org.apache.catalina.connector.Connector.initInternal(Connector.java:956)
 at
 org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
 at
 org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
 at
 org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
 at
 org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
 at
 org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
 at org.apache.catalina.startup.Catalina.load(Catalina.java:624)
 at org.apache.catalina.startup.Catalina.load(Catalina.java:649)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:449)


 So, I did a listing of the keystore file and I got the error as Keystore
 file does not exist.



  Joby J. Joseph
  Systems Engineer -  Application Support



 -Original Message-
 From: Sanaullah [mailto:sanaulla...@gmail.com]
 Sent: 12/07/2015 12:37 PM
 To: Tomcat Users List
 Subject: Re: Setting SSL in Tomcat 7.0

 Hi Joby,

 Where is your keystore file ?

 keytool error: java.lang.Exception: Keystore file does not exist:
 .keystore

 The Error is self explanatory, Keystore 

Re: issue with application finding tomcat jars

2015-07-12 Thread Konstantin Kolinko
2015-07-10 21:39 GMT+03:00 Jason Ricles jgr...@alum.lehigh.edu:
 I have an application that uses the websocket jars from tomcat and
 sometimes get this error,

 java.util.ServiceConfigurationError:
 javax.websocket.ContainerProvider: Provider
 org.apache.tomcat.websocket.WsContainerProvider not found

 Then it gets the error for a while and magically finds the jars and
 runs which is weird. What may be causing this behavior to not find the
 jars then magically find the jars?


Duplicate classes?  Note that the order of jars in WEB-INF/lib is
arbitrary and may change between runs.

Different Thread classloaders (Thread.getContextClassLoader()) ?

What is the full stacktrace of that error?

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



Re: Setting SSL in Tomcat 7.0

2015-07-12 Thread Konstantin Kolinko
2015-07-12 12:42 GMT+03:00 Joby J. Joseph jjos...@bankboubyan.com:
 Hi,

 Thanks for the reply.
 I have followed the same steps provided by the tomcat documentation.

 https://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration


 First I created the keystore file by executing the command ...

 %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA


Read the rules:
http://tomcat.apache.org/lists.html#tomcat-users
- 6. Top-posting is bad.


The manual for keytool is part of JDK documentation
http://docs.oracle.com/javase/7/docs/technotes/tools/index.html
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/keytool.html

If -keystore option is not given (with explicit path to .keystore),
the default is the file named .keystore in the user's home
directory.  That is %USERPROFILE%\.keystore

On Windows 7 %USERPROFILE% is usually C:\Users\username







 Then I added it in the config file.

 Connector
protocol=org.apache.coyote.http11.Http11NioProtocol
port=8443 maxThreads=200
scheme=https secure=true SSLEnabled=true
keystoreFile=${user.home}/.keystore keystorePass=changeit
clientAuth=false sslProtocol=TLS/

 Here. I got the error as...



 SEVERE: Failed to load keystore type JKS with path 
 C:\Windows\system32\config\systemprofile/.keystore due to 
 C:\Windows\system32\config\systemprofile\.keystore (The system cannot find 
 the file specified)
 java.io.FileNotFoundException: 
 C:\Windows\system32\config\systemprofile\.keystore (The system cannot find 
 the file specified)

I guess that you (the user running keytool) and the user running
Tomcat are two different users,  so their %USERPROFILE% is different
-- see the above path.  It looks that you are running Tomcat with a
system service account.



Best regards,
Konstantin Kolinko

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



RE: Setting SSL in Tomcat 7.0

2015-07-12 Thread Joby J. Joseph
Hi,

Thanks for the reply. 
I have followed the same steps provided by the tomcat documentation.

https://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration


First I created the keystore file by executing the command ... 

%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA

Then I added it in the config file.

Connector
   protocol=org.apache.coyote.http11.Http11NioProtocol
   port=8443 maxThreads=200
   scheme=https secure=true SSLEnabled=true
   keystoreFile=${user.home}/.keystore keystorePass=changeit
   clientAuth=false sslProtocol=TLS/

Here. I got the error as...



SEVERE: Failed to load keystore type JKS with path 
C:\Windows\system32\config\systemprofile/.keystore due to 
C:\Windows\system32\config\systemprofile\.keystore (The system cannot find the 
file specified)
java.io.FileNotFoundException: 
C:\Windows\system32\config\systemprofile\.keystore (The system cannot find the 
file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.init(Unknown Source)
at 
org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFactory.java:400)
at 
org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocketFactory.java:306)
at 
org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:565)
at 
org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:505)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:490)
at 
org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:566)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:417)
at 
org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
at 
org.apache.catalina.connector.Connector.initInternal(Connector.java:956)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at 
org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at 
org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.startup.Catalina.load(Catalina.java:624)
at org.apache.catalina.startup.Catalina.load(Catalina.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:449)


So, I did a listing of the keystore file and I got the error as Keystore file 
does not exist.



 Joby J. Joseph
 Systems Engineer -  Application Support



-Original Message-
From: Sanaullah [mailto:sanaulla...@gmail.com] 
Sent: 12/07/2015 12:37 PM
To: Tomcat Users List
Subject: Re: Setting SSL in Tomcat 7.0

Hi Joby,

Where is your keystore file ?

keytool error: java.lang.Exception: Keystore file does not exist:
.keystore

The Error is self explanatory, Keystore file does not exist  could you share 
your server.xml file configuration and also let us know the steps, how did you 
create the keystore ?

Regards,
Sanaullah

On Sun, Jul 12, 2015 at 2:23 AM, Joby J. Joseph jjos...@bankboubyan.com
wrote:

  Hi,



 I need a help for setting up the SSL in Tomcat Server 7.0.



 I have created keystore and changed the server.xml file. But, I am 
 getting the following exception.



 Screen for creating the keystore.





 After this, I did a listing for the keystore values. It shows an error.



 keytool -list -keystore .keystore

 and it gives..
 keytool error: java.lang.Exception: Keystore file does not exist: 
 .keystore



 Any suggestion this error.

 Where is the keystore file located.





 Thanks in advanceā€¦







  Joby J. Joseph

  Systems Engineer -  Application Support




 **
  This message contains confidential information and is 
 intended for the use of the addressee only. If you are not the 
 intended recipient of this communication, please delete it 
 immediately, do not copy, distribute or otherwise share this 
 information, and notify the sender promptly.

 Any views or opinions presented in this e-mail are solely those of the 
 author and do not necessarily represent those of the Bank. The Bank 
 does not endorse or accept responsibility for such views and opinions 
 and accordingly, they are not legally binding on the Bank.

 WARNING: Although the Bank has taken reasonable precautions to ensure 
 no viruses are present 

RE: Setting SSL in Tomcat 7.0

2015-07-12 Thread Joby J. Joseph
Hi Sanaullah,

When I run the command, it creates the keystore successfulle. I saw all the 
steps that u mentioned and I am not able to find the created keystore file. I 
am not getting the location of the file created. That is my problem.


Joby J. Joseph


-Original Message-
From: Sanaullah [mailto:sanaulla...@gmail.com] 
Sent: 12/07/2015 1:55 PM
To: Tomcat Users List
Subject: Re: Setting SSL in Tomcat 7.0

%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA
I don't know whats the output of the above command which run and either its 
executed successfully or not

You can follow the below example. I am using linux Machine.

root@ubuntu:/home/sanaullah# keytool -genkey -alias tomcat -keyalg RSA

Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  PK
What is the name of your organizational unit?
  [Unknown]:  test
What is the name of your organization?
  [Unknown]:  test
What is the name of your City or Locality?
  [Unknown]:
What is the name of your State or Province?
  [Unknown]:
What is the two-letter country code for this unit?
  [Unknown]:
Is CN=PK, OU=test, O=test, L=Unknown, ST=Unknown, C=Unknown correct?
  [no]:  yes

Enter key password for tomcat
(RETURN if same as keystore password):
root@ubuntu:/home/sanaullah# ls
root@ubuntu:/home/sanaullah# ls /root/.keystore

As i was running the keytool command using root user so the keystore is created 
in /root/.keystore. you must find the file somewhere in windows and set its 
path in the connector configuration and also set its password

Connector
   protocol=org.apache.coyote.http11.Http11NioProtocol
   port=8443 maxThreads=200
   scheme=https secure=true SSLEnabled=true
   keystoreFile=${user.home}/.keystore keystorePass=changeit
   clientAuth=false sslProtocol=TLS/

Regards,
Sanaullah





On Sun, Jul 12, 2015 at 2:42 AM, Joby J. Joseph jjos...@bankboubyan.com
wrote:

 Hi,

 Thanks for the reply.
 I have followed the same steps provided by the tomcat documentation.

 https://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration


 First I created the keystore file by executing the command ...

 %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA

 Then I added it in the config file.

 Connector
protocol=org.apache.coyote.http11.Http11NioProtocol
port=8443 maxThreads=200
scheme=https secure=true SSLEnabled=true
keystoreFile=${user.home}/.keystore keystorePass=changeit
clientAuth=false sslProtocol=TLS/

 Here. I got the error as...



 SEVERE: Failed to load keystore type JKS with path 
 C:\Windows\system32\config\systemprofile/.keystore due to 
 C:\Windows\system32\config\systemprofile\.keystore (The system cannot 
 find the file specified)
 java.io.FileNotFoundException:
 C:\Windows\system32\config\systemprofile\.keystore (The system cannot 
 find the file specified)
 at java.io.FileInputStream.open(Native Method)
 at java.io.FileInputStream.init(Unknown Source)
 at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFactory.java:400)
 at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocketFactory.java:306)
 at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:565)
 at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:505)
 at
 org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:490)
 at
 org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:566)
 at
 org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:417)
 at
 org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
 at
 org.apache.catalina.connector.Connector.initInternal(Connector.java:956)
 at
 org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
 at
 org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
 at
 org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
 at
 org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
 at
 org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
 at org.apache.catalina.startup.Catalina.load(Catalina.java:624)
 at org.apache.catalina.startup.Catalina.load(Catalina.java:649)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
 at 
 org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:449)


 So, I did a listing of the keystore file and I got the error as 
 

Re: Tomcat 8 - Manager Deploy

2015-07-12 Thread Konstantin Kolinko
2015-07-10 14:21 GMT+03:00  theo.swe...@avios.com:
 Hello - currently I'm running a multi instance Tomcat 8 server and wish to
 use Manager to deploy war files via its HTTP API command line interface.

 When attempting to deploy there is a continuous issue with the context
 path not being recognised.

 Here is an example of the command -

 curl -v -X PUT
 http://user:password@localhost:10080/manager/text/deploy?path=/address-information-ds-1.0war=file:/usr/share/tomcat/deployments/20150706/address-information-ds-1.0
 FAIL - Deployed application at context path /address-information-ds-1.0
 but context failed to start


So your deployment (upload) was successful,  but the application
itself is broken and failed to start.

 Now check the list of installed webapps -

 $ curl -X GET http://tcsct:cbiw2PXB@localhost:10080/manager/text/list
 OK - Listed applications for virtual host localhost
 /manager:running:0:manager
 /:running:0:ROOT
 /address-information-ds-1.0:stopped:0:address-information-ds-1.0.war
 /host-manager:running:0:host-manager

Deployed, but not running. It is consistent with the above failed to
start message.

 Catanlina.log
 10-Jul-2015 11:20:54.572 SEVERE [localhost-startStop-1]
 org.apache.catalina.startup.HostConfig.deployWAR Error deploying web
 application archive /opt/tomcat/webapps/address-information-ds-1.0.war
  java.lang.IllegalStateException: ContainerBase.addChild: start:
 org.apache.catalina.LifecycleException: Failed to start component
 [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/address-information-ds-1.0]]

Web application errors (logged via ServletContext.log() API or
similar)  go into different log file: localhost.$date.log. You should
look there.

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



Re: Tomcat - OOM Perm gen

2015-07-12 Thread Kiran Badi
Hi Chris,

Here is link for Dump files,

https://drive.google.com/folderview?id=0BxOQjvXCnkSifjZEcEYzUTNTbUFoUWdrdmMyT18wdkZDS0hEOEgwRnl6RTBWN0V6UlA1YU0usp=sharing

I tried using eclipse MAT Analyser and I see most of the threads on related
to tomcat web context loader. I still need to spend some time on that.

I think my apps still needs some cleanup.

After a day or 2 , it often dies a slow death with message,

Exception in thread ajp-bio-17703-exec-11
Exception: java.lang.OutOfMemoryError thrown from the
UncaughtExceptionHandler in thread ajp-bio-17703-exec-11

I am going to upload a new war today and see if it resolves the issue.

I will need some help with from this group in managing bots which are
spanning 100's of sessions in my case.I will initiate a new thread on that.

Sorry for delayed replies from my end.

- Kiran

On Mon, Jul 6, 2015 at 4:38 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Kiran,

 On 7/5/15 10:24 AM, Kiran Badi wrote:
  Sorry for taking time to reply Chris.
 
  Christopher Schultz wrote: Are you periodically hot-re-deploying
  your application in production? If so, you may want to stop doing
  that, as it appears that you have a ClassLoader-pinning leak in
  your application or some dependent library
 
  I do not do hot deployment in production. But somehow I feel its
  leaking memory.

 What makes you think that?

  There are some threads which for some reasons remains hanging.

 Threads related to Tomcat, or threads that are started by your
 application?

  But I think I will focus on it later on. I do have copy of your
  presentation. I will go through it and may be post couple of
  question if I have.

 The presentation is markt's, not mine.

  You should be able to run a reasonable service in half a gig of
  heap space. Just be aware that caching information in your
  application is going to significantly increase the amount of heap
  space required by your application in a steady-state.
 
  Yup I am aware of this limitation. I know cache is often stored in
  local heap and probably that's reason it consumes heap space.

 Well... there are many ways to cache data, but if you are caching it
 in your application (and not in an out-of-process-cache like ehcache,
 memcached, etc.) then by definition it's in your application's heap spac
 e.

  Currently I am checking if ehcache or jcs meets my need. Ehcache
  for some reasons fills my heap very fast.I tried storing some 100
  json strings and retrieving them. My OOM's started once I
  integrated this library in my web inf /lib folder.After I removed
  it, frequency of OOM has substantially decreased.Probably I am not
  using it correctly somewhere.

 You may also be using in-memory caching as opposed to on-disk caching.

  Do you know what open source caching people frequently use for java
  web apps ?

 Honestly, I would spend your time by disabling any caching and making
 sure that the application doesn't leak memory *before* you add any
 caching before you start introducing any kind of caching.

  Fetching a lot of data isn't usually a big deal. Just make sure
  that your fetch size is set to something reasonable. There are
  some JDBC drivers (MySQL Connector/J in particular) that will
  load the entire ResultSet into memory before allowing you to
  traverse it unless you make arrangements to limit that memory
  usage.
 
  But bringing-back thousands of records from a db isn't a problem
  -- unless you don't *have to* in which case you might want to
  optimize your queries to avoid pulling data you don't actually
  need.
 
  But too-many-records would be a performance problem, not a
  memory problem.
 
  haha.Its fetch size which my autocomplete was missing...I am not
  sure how I missed it but it was missing.

 I would remove all the caching and make sure that the application
 works properly without leaking any memory before moving on to improve
 performance.

 To do otherwise would be considered premature optimization. Nobody
 likes an application that falls-over, even if it does so with
 high-performance. Users will tolerate a slow application if it's the
 only thing wrong with it.

 - -chris
 -BEGIN PGP SIGNATURE-
 Comment: GPGTools - http://gpgtools.org

 iQIcBAEBCAAGBQJVmuc6AAoJEBzwKT+lPKRYBHEP/2qtLy1IuPM5JKsMregtLaBX
 L9Hhg5YbazVzO2V7sajZJuCtYkDSOLkz6rI3Q7YgV+o3Pgl9YvPAyTmH2YGp59Ho
 CzwP7rhkN0tx6QFBU3rpxj2Xcr6FZMzZrINg6+vi8/FBFbN93kjW8tBd5OjqZSi8
 hd5P4pvkKEWM2UHkCtdqWDLACi2oldLYNHeaVcVNUCcbYJodCek9OEIHK5OeRV27
 VrhTngQvcRu7LivbjPp2yl4w4APDuctSX3YkVyHmCbNFdE2WzogKbWOfaG2ylIbx
 F/wvBIgLocVIaOL2G2TJkvRYS7oxK7Fsh4JtCdMPZs0Wpkznz+BkBQy4aCy2oWQ2
 FBB9dPxrs0o+8RXKPP7wre8MutcZ2bOgieFdSq9JRe0NrEmhvaVgYKQNT+lVjMmC
 8+m1W8/Z1z3Rhkc0lnH0U+S2KoPN/FToEIMKNZgrkg/EoAotBYxp8kV06d5+DvP1
 cXqp/Q5HDjZTt9+elaMOvmYzFIZR9TLu8U7uH3tnaKtqtPGzqP7TOJd9mwzqescW
 Be71awY/r+WQiWga6yLHPKD8hrTKjmZjaewm7WOwxNrVcjdi/IN8YUR6j6/Gq8dh