Re: Tomcat process on windows

2007-03-08 Thread Stefan Baramov
HernĂ¢ni Cerqueira wrote:
 Hello all,

 I have a little curiosity, that may seem trivial for some of you. I
 usually do my work on linux, but sometime I work on a laptop that runs
 windows, and because i do lots of application reloads using tomcat
 manager, i usually ran out of memory, and then it comes the PermGem
 space exception. Then i have to go to task manager and kill the tomcat
 process because it wont even stop using regular ways, and restart
 again. But the strange is that sometimes i got a tomcat5 and a
 tomcat5w process using the memory, and some other times i got a javaw
 process. Can anyone tell me why this happens? It's not a annoying
 problem, is just a bit strange for me...

 Cheer's,
 HernĂ¢ni

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



Well, here is a theory:
Reloading an app leads to creating a new class loader to load all of the
application classes. The old class loader is still there it is just not
used. However, the old class loader takes space. Therefore each app
reload just create more garbage in PermGen space. Now, as far as I know
(I can be mistaken), the garbage collection of PermGen is turned off by
default. Even more, no garbage collection of PermGen is implemented in
JDK 4 and lower. This is no problem in production systems since you
don't reload your app very often. (It is however a problem for platfrom
such as OSGi). However, if you are running on JDK 5 and better you can
do this:

-XX:PermSize=64m
-XX:MaxPermSize=160m
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled


First, you increase your PermGen memory pool to 64m (not sure what is
the default but it is quite small), which will not resolve the problem,
rather postpone it . But second and most important you are enabling the
PermGen garbage collection and that should resolve your problem.

I have discovered these JVM options just recently fighting a very
similar problem with my Eclipse IDE. I think the Exadel CTO blog about
this awhile ago (not sure). These options are really deeply hidden and
not quite well known. I found the example in the NetBeans configuration
file. I am currently not working on web app so I can try it myself. But
give it a try and see what happens

Cheers,
Stefan Baramov


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



Re: Tomcat launch problem

2007-02-05 Thread Stefan Baramov
Steve Vanspall wrote:
 Hi,

 I know this probably doesn't belong here, but a lack of other forums
 is causing an issue.

 I have tomcat 5.5.20 set up and it runs without a hitch in standalone
 mode.

 I use the sydeo tomcat plugin for eclipse, and it doesn't run claiming
 a 'The markup declarations contained or pointed to by the document
 type declaration must be well-formed.' with every web.xml file it
 tries to load (even the ones for apps that come out of the box with
 tomcat ie. ones I did not modify)

 Like i said starting tomcat on windows normally works fine.

 The reason i am posting here is hopefully people can enlighten me on
 the process tomcat goes through on startup.

 I am running Win2k (yes there are still some of us doing this ;))
 Java 1.5.0 update 11
 Eclipse is started up using the same JDK and the plugin is configured
 to start tomcat using the same JDK

 I know that the plugin launches tomcat by starting up the main method
 in 'org.apache.catalina.startup.Bootstrap' with tools.jar in the
 classpath.

 Can't anyone tell me what the difference could between launching
 tomcat in this way and lauching tomcat using the service monitor in
 windows, or even the catalina.bat file.

 Part of me think there's something each web.xml refers to that is
 causing the problem, but not sure where.

 this is one of the stack traces

 ---
 SEVERE: Parse Fatal Error at line 1 column 3: The markup declarations
 contained or pointed to by the document type declaration must be
 well-formed.
 org.xml.sax.SAXParseException: The markup declarations contained or
 pointed to by the document type declaration must be well-formed.
at
 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)

at
 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)

at
 com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)

at
 com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)

at
 com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)

at
 com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDecls(XMLDTDScannerImpl.java:1982)

at
 com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDTDExternalSubset(XMLDTDScannerImpl.java:319)

at
 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(XMLDocumentScannerImpl.java:1030)

at
 com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)

at
 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)

at
 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)

at
 com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)

at
 com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)

at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
at
 org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:351)

at
 org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1041)
at
 org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:260)

at
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

at
 org.apache.catalina.core.StandardContext.start(StandardContext.java:4143)
at
 org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)

at
 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at
 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at
 org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)

at
 org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535)

at
 org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at
 org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)

at
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at
 org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at
 org.apache.catalina.core.StandardService.start(StandardService.java:450)
at
 org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
 

Re: Tomcat randomly hangs

2007-01-25 Thread Stefan Baramov
Since you all are using Java 5 why do you try to enable JMX. JConsole
could give you a good insight on threads. It could even provide thread
dump or possibly detect deadlock.

- Stefan

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



Re: System requirements

2006-09-21 Thread Stefan Baramov
DEMESY Nicolas wrote:
 Hi,

 I would like to know what are the system requirements for using Tomcat
 in a production server, with 50-100 users, on a Red Hat Advanced
 Server 3.
 Where can I find benchmarks ?

 Thank you for your advices,
 Nicolas DEMESY


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



I would recommend to load test your application and runtime environment,
first. I would get two or more production like servers, and write a load
test specifically geared toward your application. Number of tools are
available for this. From the open source world, I would try JMeter,
Grinder, Solex (eclipse plugin) or even HttpUnit. Once you have your
load test, I would play with different Tomcat configurations. Do not
forget that sometimes the garbage collection settings are quite
important. I would try with at least two or three gc algorithms.

So, finding system requirements is quite a project. Of course, if you
application is not mission critical, I would not bother. Just get a
regular AMD64/Pentium Server with at least 2MB, install a tomcat with
512mb heap, put a decent load balancer at front of it and you are done.

- Stefan

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



APR extensinos for Tocmat 5.5.17 cause a JVM crash on Windows OS

2006-06-02 Thread Stefan Baramov

Hi everyone:

Tomcat 5.5.17 for Windows (distribution apache-tomcat-5.5.17.exe) comes 
with a DLL file called tcnative-1.dll. According to the Tomcat 
documentation this is a native extension based on the APR and Open SSL 
projects. However,  the extension causes the JVM to crashes qutie often.


The application is a image intense web app running on
- Windows 2003 Server + SP1
- JDK 1.5.0_06

I've tried both server and client JVM's and both fails. I've tried to 
disable the AJP connector and still the problem was there. The problem 
disappears only if I remove the tcnative-1.dll from the system path.


The attachment shows one of the crashes. It obviously points to the 
tcnative-1.dll. So can someone shed some light on this extension and 
problem it is causing.


Thanks,
Stefan
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc005) at pc=0x100043a4, pid=192, tid=1448
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode, sharing)
# Problematic frame:
# C  [tcnative-1.dll+0x43a4]
#

---  T H R E A D  ---

Current thread (0x003cfe60):  JavaThread Finalizer daemon [_thread_in_native, 
id=1448]

siginfo: ExceptionCode=0xc005, reading address 0x0014

Registers:
EAX=0x006f, EBX=0x006f, ECX=0x02a12f10, EDX=0x26cd7df8
ESP=0x028ff6cc, EBP=0x028ff6d8, ESI=0x, EDI=0x
EIP=0x100043a4, EFLAGS=0x0206

Top of Stack: (sp=0x028ff6cc)
0x028ff6cc:   003cfe60 26cd7340 26cd7340 028ff714
0x028ff6dc:   0083826f 003cff20 028ff71c 
0x028ff6ec:     006f 028ff6f8
0x028ff6fc:    028ff730 26cd7df8 
0x028ff70c:   26cd7340 028ff724 028ff750 008329cf
0x028ff71c:   26cd7da0 00836449 006f 
0x028ff72c:     028ff734 270fc72e
0x028ff73c:   028ff758 270fca40  270fc760 

Instructions: (pc=0x100043a4)
0x10004394:   8b 5d 1c 56 33 f6 85 db 57 76 32 8b 7d 10 8b c3
0x100043a4:   8b 4f 14 2b c6 8d 55 1c 89 45 1c 8b 47 0c 52 8b 


Stack: [0x028c,0x0290),  sp=0x028ff6cc,  free space=253k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [tcnative-1.dll+0x43a4]
j  org.apache.tomcat.jni.Socket.sendbb(JII)I+0
j  org.apache.coyote.http11.InternalAprOutputBuffer.flushBuffer()V+22
j  org.apache.coyote.http11.InternalAprOutputBuffer.flush()V+19
j  
org.apache.coyote.http11.Http11AprProcessor.action(Lorg/apache/coyote/ActionCode;Ljava/lang/Object;)V+104
j  
org.apache.coyote.Response.action(Lorg/apache/coyote/ActionCode;Ljava/lang/Object;)V+31
j  org.apache.catalina.connector.OutputBuffer.doFlush(Z)V+95
j  org.apache.catalina.connector.OutputBuffer.flush()V+2
j  org.apache.catalina.connector.CoyoteOutputStream.flush()V+4
j  javax.imageio.stream.FileCacheImageOutputStream.close()V+50
j  javax.imageio.stream.ImageInputStreamImpl.finalize()V+8
v  ~StubRoutines::call_stub
V  [jvm.dll+0x845a9]
V  [jvm.dll+0xd9317]
V  [jvm.dll+0x8447a]
V  [jvm.dll+0x897cb]
C  [java.dll+0x2006]
j  java.lang.ref.Finalizer.runFinalizer()V+45
j  java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1
j  java.lang.ref.Finalizer$FinalizerThread.run()V+11
v  ~StubRoutines::call_stub
V  [jvm.dll+0x845a9]
V  [jvm.dll+0xd9317]
V  [jvm.dll+0x8447a]
V  [jvm.dll+0x841d7]
V  [jvm.dll+0x9ed69]
V  [jvm.dll+0x109fe3]
V  [jvm.dll+0x109fb1]
C  [msvcrt.dll+0x2b530]
C  [kernel32.dll+0x26063]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.apache.tomcat.jni.Socket.sendbb(JII)I+0
j  org.apache.coyote.http11.InternalAprOutputBuffer.flushBuffer()V+22
j  org.apache.coyote.http11.InternalAprOutputBuffer.flush()V+19
j  
org.apache.coyote.http11.Http11AprProcessor.action(Lorg/apache/coyote/ActionCode;Ljava/lang/Object;)V+104
j  
org.apache.coyote.Response.action(Lorg/apache/coyote/ActionCode;Ljava/lang/Object;)V+31
j  org.apache.catalina.connector.OutputBuffer.doFlush(Z)V+95
j  org.apache.catalina.connector.OutputBuffer.flush()V+2
j  org.apache.catalina.connector.CoyoteOutputStream.flush()V+4
j  javax.imageio.stream.FileCacheImageOutputStream.close()V+50
j  javax.imageio.stream.ImageInputStreamImpl.finalize()V+8
v  ~StubRoutines::call_stub
j  java.lang.ref.Finalizer.invokeFinalizeMethod(Ljava/lang/Object;)V+0
j  java.lang.ref.Finalizer.runFinalizer()V+45
j  java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1
j  java.lang.ref.Finalizer$FinalizerThread.run()V+11
v  ~StubRoutines::call_stub

---  P R O C E S S  ---

Java Threads: ( = current thread )
  0x007db5e8 JavaThread http-8080-10 daemon [_thread_in_native, id=592]
  0x03396f48 JavaThread http-8080-9 daemon [_thread_in_native, id=2580]
  0x02b78780 JavaThread http-8080-8 daemon [_thread_in_native, id=3076]
  0x02cca350 JavaThread http-8080-7 daemon [_thread_in_native, id=2548]
  0x02aa4008 JavaThread http-8080-6 daemon [_thread_in_native, id=3244]
  0x02fa9a90 JavaThread http-8080-5 daemon [_thread_in_native, id=3940]
  0x02c739c0 JavaThread 

JAASRealm and LoginContext reuse

2006-02-14 Thread Stefan Baramov
I found that the JAASRealm implementation
(org.apache.catalina.realm.JAASRealm) does not reuse the LoginContext
(javax.security.auth.login.LoginContext) instance. Every time the
authenticate(String,String) method is called a new LoginContext instance
is created. Creating a new instance of the LoginContext will result in
creating a new instance of all LoginModule's configured for this
application. In other words, for each login a new instance of the
LoginModule is created. However, in my case the initialization of the
login module is an expensive operation. 

The only way to resolve this is to write a custom JAASRealm
implementation. However, before doing this I would like to know whether
there is any rational of not caching the LoginContext instance. I looked
in the JAAS spec and could find anything against caching the
LoginContext. I've also looked at LoginContext source code in JDK 1.4
and it appears to be written to cache the LoginModule instances. So I
would assume it is correct to write a custom version of the JAASRealm to
operate on a single instance of the LoginContext. Am I right? 

I would appreciate any thoughts. 

Thanks
Stefan Baramov 
Software Developer 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Callback (JAAS)

2006-02-03 Thread Stefan Baramov
According to the Tomcat User Guide, only two callbacks are supported:
NameCallback and PasswordCallback. I have an app that has to have
another call back: ClientCallback. In other words my login window looks
like this: 

Clietn : ||
User:||
Password:||

I am hoping to use CMA and JAAS with my own custom LoginModule. 

Can I configure Tomcat to support a thrid callback and still use CMA? 

Stefan Baramov 
Software Developer 
TRX 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Custom Authenticator

2006-02-03 Thread Stefan Baramov
You can also implement custom LoginModule according to the JAAS
specification. JAAS tutorial and LoginModule example is included in the
JDK documentation.

| -Original Message-
| From: Arash Bijanzadeh [mailto:[EMAIL PROTECTED] 
| Sent: Thursday, February 02, 2006 7:21 AM
| To: users@tomcat.apache.org
| Subject: Custom Authenticator
| 
| 
| Hi,
| I need to implement my custom authenticator to do some extra 
| comfig i user session beside the authentication. How can I 
| achive this? Is there a way to do authentication besides 
| rigid j_check_security?
| 
| --
| from debian manifesto:
| Debian Linux is a brand-new kind of Linux distribution.
| Rather than being developed by one isolated individual or 
| group, as other distributions of Linux have been developed in 
| the past, Debian is being developed openly in the spirit of 
| Linux and GNU.
| 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JAAS and Realms configuration

2006-02-01 Thread Stefan Baramov
Is it possible to confiugrat a LoginModule (according to JAAS
guidelines) which will apply different authorization strategies
according to the application requesting the JAAS service.

My initial thoughts were around configuring two separeta JAAS Realms in
this way: 

conf/server.xml

Realm 
appName=FooLoginModule 
className=org.apache.catalina.realm.JAASRealm 
roleClassNames=test.jaas.web.TrxRolePrincipal 
userClassNames=test.jaas.web.TrxUserPrincipal/

Realm 
appName=BarLoginModule 
className=org.apache.catalina.realm.JAASRealm 
roleClassNames=test.jaas.web.TrxRolePrincipal 
userClassNames=test.jaas.web.TrxUserPrincipal/
...

Then, the JAAS configuration file will look like this: 

conf/jaas.config

FooLoginModule {
   test.jaas.web.TrxLoginModule required debug=true app=Foo;
};

BarLoginModule {
   test.jaas.web.TrxLoginModule required debug=true app=Bar;
};


The web.xml for both application should be able to specify which Realm
should be used: 

webapps/Foo/WEB-INF/web.xml
...
login-config
auth-methodFORM/auth-method
realm-nameFooLoginModule/realm-name
form-login-config
form-login-page/login.jsp/form-login-page
form-error-page/error.jsp/form-error-page
/form-login-config
/login-config


webapps/Bar/WEB-INF/web.xml

login-config
auth-methodFORM/auth-method
realm-nameBarLoginModule/realm-name
form-login-config
form-login-page/login.jsp/form-login-page
form-error-page/error.jsp/form-error-page
/form-login-config
/login-config


Using the realm-name/ tag I was hoping to link the login configuration
for each application to a particular JAAS Realm. However this is not
happening. Both application will use the second JAAS Realm and it seems
that realm-name tag is completely ignored. 

Finally, I have to say I tried this configuration on Tomcat 5.5.9 and
5.0.30 with no success. What am I missing? Is there another tag in the
web.xml that will connect me to the right JAAS Realm ?


Stefan Baramov 
Software Developer 
TRX 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]