Find the effective classpath in a spring webapp's Controller

2022-08-22 Thread anjan bacchu
Hi there,

  I have a Controller in a spring webapp deployed to tomcat as a .war
file(this is not a boot app).

I have this code in the Controller

this.getClass().getClassLoader().getResourceAsStream(licenseFile)


The licenseFile is a 3rd party license file in our artifactory repository
and gets deployed by the gradle build to the WEB-INF\lib directory.

As expected, this licenseFile is not accessible to the Controller and this
fails.

2 Questions

1) How do I find the effective classpath for this webapp at runtime ?  (I
read the howto at
https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html )

2) Is there a way to read this licenseFile in the WEB-INF\lib directory
from the Controller ?

Thank you,

BR,
~A


Re: Tomcat Thread Dump

2015-12-10 Thread Anjan Bacchu
hi yogesh,

  depending on how you launch tomcat,
   a) through tomcat.exe -- tomcat will show as tomcat in process
explorer/task manager
   b) startup.bat/sh -- tomcat will show up as java.exe.

If you have a JDK, then you can run jps and from the output list, you can
determine which of the processes is tomcat.

BR,
~A


On Wed, Dec 9, 2015 at 12:39 PM, Yogesh Patel 
wrote:

> *Tomcat version* : 7.0.53
> *OS *: Windows 7
>
> We are using tomcat as standalone application not as service, In task
> manager it does not showing PID for Tomcat. How to get PID of that tomcat
> in order to take tomcat thread dump.
>
> What are the best practice  to take thread dump and what are the commands
> for windows7 system.
>
>
> --
> *Thanks & Regards,*
>
> * Yogesh Patel*
>


Http 2 support in Tomcat

2015-05-15 Thread anjan bacchu
  wondering what the plans are for supporting HTTP 2 support in tomcat ?
When is it planned ? Which version(s) are likely to get support ?


Fix for java.lang.VerifyError in tomcat 7.0.19 all the way thru tomcat 7.0.27!!

2012-05-31 Thread Anjan Bacchu
Hi all,

  I've been a tomcat user for about 10 years -- starting with 3.x. So
thanks the user and dev community for all the help.

I recently tried moving our appserver from 5.5 to 7. as soon as I deployed
our webapp to tomcat 7.0.27 and tried the app, I got a
java.lang.VerifyError.
down below is the stack Trace. this happens after I have entered the
credentials to the login page and POSTing it to another jsp (ChLogin.jsp).

I noticed that this error doesn't happen in tomcat 7.0.16 but happens in
tomcat 7.0.19 and all the way to 7.0.27.

Should I stay back with tomcat 7.0.16 OR can tomcat dev fix the bug so we
get the latest /nicest version ?

P.S : I downloaded the tar.gz version of tomcat and deployed it on RHEL 5.3
on tomcat 1.6.0_26 all thru 1.6.0_31.

Thank you very much,

BR,
~A


javax.servlet.ServletException: java.lang.VerifyError: (class:
org/apache/jsp/ChLogin_jsp, method: _jspService signature:
(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V)
Inconsistent stack height 0 != 1

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:342)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
web.AuthFilter.doFiltering(AuthFilter.java:74)
web.AuthFilter.doFilter(AuthFilter.java:58)

*root cause*

java.lang.VerifyError: (class: org/apache/jsp/ChLogin_jsp, method:
_jspService signature:
(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V)
Inconsistent stack height 0 != 1
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
java.lang.Class.getConstructor0(Class.java:2699)
java.lang.Class.newInstance0(Class.java:326)
java.lang.Class.newInstance(Class.java:308)

org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
web.AuthFilter.doFiltering(AuthFilter.java:74)
web.AuthFilter.doFilter(AuthFilter.java:58


BR,
~A


Re: Fix for java.lang.VerifyError in tomcat 7.0.19 all the way thru tomcat 7.0.27!!

2012-05-31 Thread Anjan Bacchu
Hi Konstatin,

  Thanks very much for the quick response.

  ChLogin.jsp : It is our own code -- mostly does some simple java
scriptlet which do jsp:forwarding to other JSPs. -- about 150 lines of code.
No, we don't precompile the JSPs.
We deployed other apps to this same tomcat and they work just fine.
example webapps : didn't try them yet.
I replaced the eclipse compiler in tomcat 7.0.27 with the eclipse compiler
from tomcat 7.0.16 and the application has started working just fine!!

do you suggest that the tomcat developers be told about this bug so they
revert to the older version of the eclipse compiler ?

Do you suggest that the Eclipse compiler developers be told about this bug
so they can fix it in the next release ?

Thank you very much,

BR,
~A
BR,
~A


On Thu, May 31, 2012 at 7:08 PM, Konstantin Kolinko
knst.koli...@gmail.comwrote:

 2012/5/31 Anjan Bacchu anjan@gmail.com:
  Hi all,
 
   I've been a tomcat user for about 10 years -- starting with 3.x. So
  thanks the user and dev community for all the help.
 
  I recently tried moving our appserver from 5.5 to 7. as soon as I
 deployed
  our webapp to tomcat 7.0.27 and tried the app, I got a
  java.lang.VerifyError.
  down below is the stack Trace. this happens after I have entered the
  credentials to the login page and POSTing it to another jsp
 (ChLogin.jsp).
 
  I noticed that this error doesn't happen in tomcat 7.0.16 but happens in
  tomcat 7.0.19 and all the way to 7.0.27.
 
  Should I stay back with tomcat 7.0.16 OR can tomcat dev fix the bug so we
  get the latest /nicest version ?
 
  P.S : I downloaded the tar.gz version of tomcat and deployed it on RHEL
 5.3
  on tomcat 1.6.0_26 all thru 1.6.0_31.
 

 Where the code for ChLogin_jsp comes from?
 Is it compiled by Tomcat when you first access it, or it is
 precompiled in your web application?

 Overall the error is odd.
 If you tried different versions of Java or Tomcat, try to clear the
 work directory so that the page is recompiled.

 Does the examples webapp that comes with Tomcat work for you?

 I wonder what the source code for ChLogin.jsp is, but it looks like a
 compiler error.

 Tomcat 7.0.27 uses Eclipse JDT Compiler 3.7.2.

 You may try different versions of ecj-x.y.z.jar from older releases of
 Tomcat, or directly from eclipse.org.

 Best regards,
 Konstantin Kolinko

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




Re: Fix for java.lang.VerifyError in tomcat 7.0.19 all the way thru tomcat 7.0.27!!

2012-05-31 Thread Anjan Bacchu
Hi Chris,

  Thank you.

Do you/they need any additional info to help fix the bug ?

Thanks again,

BR,
~A


On Thu, May 31, 2012 at 11:42 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Anjan,

 On 5/31/12 12:28 PM, Anjan Bacchu wrote:
  Do you suggest that the Eclipse compiler developers be told about
  this bug so they can fix it in the next release ?

 You're talking to them already ;)

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAk/HtI4ACgkQ9CaO5/Lv0PCj1ACgk5FscxrpchRPkzE5d7tjkwWp
 wkkAmgOnsj9Hanq1P8cx9FtWZx99BlWu
 =MT68
 -END PGP SIGNATURE-

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




Re: Peak load of Tomcat-powered server(s)?

2006-12-27 Thread anjan bacchu

On 12/27/06, Rainer Jung [EMAIL PROTECTED] wrote:


Hi,

Li Ma schrieb:
 1. I was told Tomcat can only run max 3 nodes in cluster smoothly.
What's
 your milage?

Cluster in the sense of horizontal scaling (load-balancing): no
limitations.

Cluster with state replication of sessions (assuming TC 5.5): you break
down your cluster into groups of 2 to 4 nodes, and replucation is
any-to-any inside a group and no replication between groups. Technically
spoken a group is a cluster of nodes and your whole farm consists if
many small clusters. mod_jk load-balancing can be configured to respect
those clusters during fail-over by defining domains in mod_jk.

Be careful: state replication is complicated and expensive. If your
session doesn't have a lot of value and it's cheap for your costumers to
relogin after node failure, you don't want to use state replication.
Horizontal scaling and a good load-balancing suffices in this case. Only
if sessions are valuable, you might want to protect them against failure
by real clustering.



Just to note that  Terracotta sessions clustering  is now open source(
http://terracotta.org/confluence/display/orgsite/Download)
See some benchmark info here :
http://www.kodewerk.com/terracotta_sessions_benchmark.htm

I know that terracotta can help you cluster with sessions for upwards of 100
nodes!

BR,
~A



2. This is not related to Tomcat, but if a site has N registered users,
 what
 is the average percentage of concurrent user should I expect? I ask this
 because my client wants 1million registered users. But he wants me to
 support 20% concurrent users, which I believe is way impossible! But I
need
 to have some number to give him the right sense. This is also important
for
 me to setup the target.

This really depends mostly on the business.

Concurrent Users = Number of sessions ~ Memory constraints
Concurrent Requests = Concurrent Users * Click Rate of User * Response
duration of request ~ CPU and Thread constraints

Concurrent Users and Click rates very much depend on the business the
app provides. Some Aps are used as Login in the morning, keep session
open all day and expire during night, others are Login, do something
and log out/expire.

Click rates can be very high (Ajax, static requests, fine grained user
interfaces or low transaction type system, long prepartion times
locally in browser for complex forms.

Regards,

Rainer

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
BR,
Anjan Bacchu
Summit Information Systems


Re: Memory leaks on webapp redeploy

2006-11-27 Thread anjan bacchu

Hi Mark,

 Does anyone on the tomcat dev list use Netbeans profiler at all ? OR do
you guys
exclusively use YourKit ?

Thank you,

BR,
~A

On 11/27/06, Mark Thomas [EMAIL PROTECTED] wrote:


Jon Miller wrote:
 Hi all,

 Is anyone running into issues with memory leaks occuring whenever a
 webapp is redeployed?

Tomcat version? There have been issues with older releases.

 I think I read in a FAQ that even using a singleton in your app will
 cause memory leaks? Does anyone know if this is true?

It depends on how careful you are using it. There are lots of ways to
write code that leaks memory.

Rather than try guessing where the leak is, get yourself a profiler
and find it.

Mark

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
BR,
Anjan Bacchu
Summit Information Systems


Re: max memory..

2006-09-05 Thread anjan bacchu

can I move to 2048mb without any problem ? SURE, YES

4 GB RAM -- did you tune the BOOT.INI setting to use the /3GB setting so
that the
user process address space goes to 3 GB(from 2 GB default) ?

related things for performance :
are you using the APR extension ?

how about tweaking the server.xml threads, max settings ?

does your server use virtual memory ? I have seen better memory when no
virtual memory is used.

BR,
~A



On 9/5/06, Asensio, Rodrigo [EMAIL PROTECTED] wrote:


Hello guys

tomcat 5517
java 1508
win 2003 server

I have available 4 gb of ram memory into the server. My tomcat is
running with 1024 mb right now.
Before start to optimize my functions :D , can I move to 2048mb without
any problem ?
memory settings has always to be pow of 2 ?

thanks
Rodrigo

---
Rodrigo Asensio
Fuel Management Services
Gilbarco Veeder Root
phone: +1 336 547 5023
email: [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]



This message (including any attachments) contains confidential
and/or proprietary information intended only for the addressee.
Any unauthorized disclosure, copying, distribution or reliance on
the contents of this information is strictly prohibited and may
constitute a violation of law.  If you are not the intended
recipient, please notify the sender immediately by responding to
this e-mail, and delete the message from your system.  If you
have any questions about this e-mail please notify the sender
immediately.





--
BR,
Anjan Bacchu
Summit Information Systems


Re: Handling huge amount data

2006-08-29 Thread anjan bacchu

Hi Jose,

 Are you using Java 5.x(1.5.x) ?   If so, you can watch your JVM's runtime
behavior using the JConsole( in the JAVA_HOME/bin directory) ? It has helped
me earlier on to debug OOM situations.

You need to restart your tomcat so that you can add the required parameters
in your startup.bat/startup.sh script.

Here's what I did to change my tomcat(5.5.17 but also works in any 5.x) to
allow JMX monitoring (from JConsole). I just added the line after the label
doneSetArgs


:doneSetArgs
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote
rem Execute Java with the applicable properties


JConsole will let you monitor your memory usage and also track heap and
non-heap memory. You can also force a gc on your tomcat JVM from JConsole.
It lets you monitor various pools like Eden Space, Survivor, Tenured, Perm,
Code Cache, Perm Gen rw, Perm Gen RO, etc. That should give you some insight
into what is happening within Tomcat.

for more info on JConsole, see
http://www.onjava.com/pub/a/onjava/2004/09/29/tigerjmx.html

BR,
~A



On 8/28/06, José Renato [EMAIL PROTECTED] wrote:


Hi,

I am loading the data to be displayed with display-tag component. The
data lists has been saved as request attributes. I will look for
profilers to check this situation better.

Thank a lot, Bye.

David Smith escreveu:
 If you are sure the sessions are where your memory is going, is there
 any way to reduce the session size?  I would think a query for a large
 amount of data should be a request scoped item or maybe even put on
 the presentation layer with a taglib.

 You could also be hanging onto object references in other parts of
 your code.  Invalidating the session won't clean that up.

 Also there are profilers around that will give you an idea of memory
 useage.  Google is your friend.

 --David

 José Renato wrote:

 Hi All,

 I have an web application deployed with Tomcat 5.0.28. In some cases
 my queries can bring back huge amounts of data. Looking Windows Task
 Manager I perceived the natural memory increase. I noticed that when
 I call my logout method (It calls session.invalidate()) or my user
 session expieres the memory is still in use, in other words, the
 memory is not cleaned. This process will cause OutOfMemoryException
 soon. I would like to undertand how can I discover why this happens
 and how can I fix it.

 Best regards,
 José Renato.

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
BR,
Anjan Bacchu
Summit Information Systems


Re: Tomcat's scalability

2006-06-21 Thread anjan bacchu

hi GB,

 From catalina.bat

rem   CATALINA_HOME   May point at your Catalina build directory.
rem
rem   CATALINA_BASE   (Optional) Base directory for resolving dynamic
portions
rem   of a Catalina installation.  If not present, resolves
to
rem   the same directory that CATALINA_HOME points to.
rem

you can have multiple instances of tomcat with multiple directories for
CATALINA_BASE.

I'm not sure if there's any easy mechanism to predict if multiple
CATALINA_BASE will work better than multiple independent JVMs each pointing
to separate tomcat directories.

As an earlier user mentioned, run top to figure out how much CPU is being
sucked by Tomcat. BTW, which version of Tomcat and JVM are you using ? We
found Tomcat 5.5 to be much better(40% - 120%)  than 4.x or even 5.0x series
when used with JAVA 1.5.X.

Can you add some logging around your JDBC calls to SQL Server -- that way
you can find out the time consumed by the DB at 100 users versuse the
timings at 300 users.

BR,
~A

On 6/19/06, GB Developer [EMAIL PROTECTED] wrote:


How do you propose to add a 'separate instance of Tomcat' without 'adding
a
separate JVM'?

Or do you/others mean by 'instance of tomcat' = 'a separate physical
server
with single instance of JVM/Tomcat' ?


 So far it sounds that the approach of adding separate
 instance of Tomcat and using round robin is better than
 adding a separate JVM.



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
BR,
Anjan Bacchu
Summit Information Systems


Concise way of closing DB resources code sample

2006-05-17 Thread anjan bacchu

Hi All,

 I was looking at the   DataSource HOWTO
pagehttp://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.htmland
noticed that the recommended way of closing (BELOW)

finally {
   // Always make sure result sets and statements are closed,
   // and the connection is returned to the pool
   if (rs != null) {
 try { rs.close(); } catch (SQLException e) { ; }
 rs = null;
   }
   if (stmt != null) {
 try { stmt.close(); } catch (SQLException e) { ; }
 stmt = null;
   }
   if (conn != null) {
 try { conn.close(); } catch (SQLException e) { ; }
 conn = null;
   }
}

can be condensed to

   finally {
   try {
   if (null != rs) {
   rs.close();
   }
   }
   finally {
   try {
   if (null != stmt) {
   stmt.close();
   }
   }
   finally {
   if (null != conn) {
   conn.close();
   }
   }
   }
   }

This is one (among other) places where it makes sense to use the try/finally
block rather than
the try/catch block.

Just wanted to share this -- if the developers think it makes sense, then
the updated sample would be
useful to all the tomcat users, especially noobs.

Thank you,
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html--

BR,
Anjan Bacchu
Summit Information Systems