Re: Tomcat 7 Cluster Issue

2012-03-15 Thread Pid
On 12/03/2012 22:14, Bruce Pease wrote:
 I am using a windows 2003 server 32 bit standard edition SP2 with IIS 6.  I
 have an isapi_redirect.dll v.1.2.31 communicating to tomcat via ajp1.3.  JDK
 version was 7.03, and tomcat version is 7.0.26.  Tomcat is installed as a
 service using the service.bat, and I am running two containers in the
 clustered environment.  Session replication is in memory, and communication
 is limited to within the server, i.e. not to any external server. 
 
 I can provide complete configuration files or more detail if needed.
 
 Thanks very much for your help.

Can you add the -Djava.net.preferIPv4Stack=true to your service startup
settings?

See thread: Re: Java 7 + Tomcat 6.0.35 + Win2k3 Problem for more details.


p

 -Original Message-
 From: Pid [mailto:p...@pidster.com] 
 Sent: Monday, March 12, 2012 5:13 PM
 To: Tomcat Users List
 Subject: Re: Tomcat 7 Cluster Issue
 
 On 12/03/2012 17:30, Pid * wrote:
 I will try to reproduce using your config, shortly.
 
 The only warning I get on OSX with JDK 1.7.0 is that FarmWarDeployer only
 works when the Cluster is defined inside a Host.
 
 Can you provide as much detail as possible about your OS  JDK 7 version
 please?
 
 
 p
 
Deployer
 className=org.apache.catalina.ha.deploy.FarmWarDeployer
 tempDir=/tmp/war-temp/ deployDir=/tmp/war-deploy/
 watchDir=/tmp/war-listen/ watchEnabled=false/

ClusterListener 
 className=org.apache.catalina.ha.session.JvmRouteSessionIDBinderLi
 st
 e
 ner/

ClusterListener 
 className=org.apache.catalina.ha.session.ClusterSessionListener/

  /Cluster

  Realm
 className=org.apache.catalina.realm.LockOutRealm

Realm
 className=org.apache.catalina.realm.UserDatabaseRealm
 resourceName=UserDatabase/

  /Realm

  Host name=localhost appBase=webapps
 unpackWARs=true
 autoDeploy=true

Valve
 className=org.apache.catalina.valves.AccessLogValve directory=logs
 prefix=localhost_access_log. suffix=.txt pattern=%h %l %u %t 
 quot;%rquot; %s %b/

  /Host
 
 
 


-- 

[key:62590808]



signature.asc
Description: OpenPGP digital signature


Re: Java 7 + Tomcat 6.0.35 + Win2k3 Problem

2012-03-15 Thread Pid
On 15/03/2012 01:08, pricyber wrote:
 I did nothing in the xml files, but in the embedded tomcat I did this
 instead.
 
 connector = embedded.createConnector((String)null, port,
 Http11NioProtocol.class.getName());

OK.

1. Can you set the address field manually, rather than letting the
defaults run?

Also, can you please log InetAddress.toString() immediately before you
do the above line?  I suspect Inet4 v Inet6 is the culprit.


2. Unless you subsequently modify the connector you are setting the
default value for the socket traffic class for the NIO connector, from:

  org.apache.tomcat.util.net.SocketProperties

which is:

  protected int soTrafficClass = 0x04 | 0x08 | 0x010;


The other thread reports a similar error, in:

 org.apache.catalina.tribes.transport.nio.NioReceiver

where the default is from

  org.apache.catalina.tribes.transport.ReceiverBase

and is also:

 private int soTrafficClass = 0x04 | 0x08 | 0x010;


3. Side note:

The two stacktraces are _not_ identical with regard the internals of the
JVM (note the line numbers):

java.net.SocketException: Invalid argument: no further information
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setSocketOption(Net.java:279)
at sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:175)
at sun.nio.ch.SocketAdaptor.setIntOption(SocketAdaptor.java:296)
at sun.nio.ch.SocketAdaptor.setTrafficClass(SocketAdaptor.java:396)


java.net.SocketException: Invalid argument: no further information
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setSocketOption(Net.java:279)
at sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:175)
at sun.nio.ch.SocketAdaptor.setIntOption(SocketAdaptor.java:300)
at sun.nio.ch.SocketAdaptor.setTrafficClass(SocketAdaptor.java:400)



4. The Tomcat 7 documentation states:

 
http://tomcat.apache.org/tomcat-7.0-doc/config/http.html#Java_TCP_socket_attributes

Note: On some JDK versions, setting soTrafficClass causes a problem. A
work around for this is to add the -Djava.net.preferIPv4Stack=true value
to your JVM options.


p


 --
 View this message in context: 
 http://tomcat.10.n6.nabble.com/Java-7-Tomcat-6-0-35-Win2k3-Problem-tp4566739p4619650.html
 Sent from the Tomcat - User mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 


-- 

[key:62590808]



signature.asc
Description: OpenPGP digital signature


Re: Info on PermSize and MaxPermSize

2012-03-15 Thread André Warnier

Geet Chandra wrote:

Version of Tomcat is 6.0.035 As http://6.0.035.As Tomcat is being shipped
with product developed, we are providing command line utility,using the
same utility users are of product allow to change the configurable
parameters as per application type deployed in tomcat.We are using
utiltity.vbs as mentioned utility implementation file.Also we are
registering tomcat as windows service while product is being installed and
command to start tomcat as cmd.exe /c net start tomcat .Hoping everyone
understood my requirements.

Not really. I think one would need Pid's crystall ball to really understand the first part 
of your message above.  Let me try to dissect it however :


 Version of Tomcat is 6.0.035
Ok, let's say.

As http://6.0.035.As
Huh ?

 Tomcat is being shipped
 with product developed,
I think I got that.

 we are providing command line utility,using the
 same utility users are of product allow to change the configurable
 parameters as per application type deployed in tomcat.We are using
 utiltity.vbs as mentioned utility implementation file.

Not quite sure I understand what you're talking about here.
But I gather that you are somehow shipping Tomcat together with some unspecified 
application and some cutely-named script described in some file.

And that this is under Windows..

 Also we are
 registering tomcat as windows service while product is being installed

Ah. And how exactly are you doing this ?

First, you'd have to tell us /which/ Tomcat package, downloaded from where, you are 
shipping, and how you do this installation.

Then you'd have to tell us which Java JVM you are also installing (presumably).
And then, tell us /how/ you are doing the registration of Tomcat as a Windows 
Service.

 and
 command to start tomcat as cmd.exe /c net start tomcat .


In your answer, please answer each question just below the question, and not everything at 
the top of the message.


In the meantime, you could reflect on this : the people who man this forum are volunteers, 
who generally do their best to answer the questions of fellow Tomcat users.

But they are not obliged to answer questions.
And you stand a much better chance to have your questions answered correctly and quickly, 
if you make at least a little effort to ask them clearly and if you provide sufficient and 
precise information in the first place.
Quite apart from your particular Tomcat issue, this is also generally a good strategy when 
talking to people you don't know, when you want something from them.


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



Datasources in Spring-JPA-Tomcat 6.0.29

2012-03-15 Thread Steven Xiong
I have a Spring/JPA application running on Tomcat 6.0.29 accessing two schemas 
of a single Oracle database. Each schema is configured as a seperate 
datasource. If we config the datasources as spring beans of 
com.mchange.v2.c3p0.ComboPooledDataSource type, the app works correctly. 
However if we use two JNDI datasources configured in META-INF/context.xml, the 
both autowired datasources point to only ONE same schema.

Any thoughts?
Thanks 

Steven


Re: Datasources in Spring-JPA-Tomcat 6.0.29

2012-03-15 Thread Stevo Slavić
Hello Steven,

Just a wild guess, you're probably using same credentials/account in
context.xml for both data sources, while you're using different
credentials/account in each Spring datasource bean.

Kind regards,
Stevo.

On Thu, Mar 15, 2012 at 2:12 PM, Steven Xiong xcste...@yahoo.com wrote:

 I have a Spring/JPA application running on Tomcat 6.0.29 accessing two
 schemas of a single Oracle database. Each schema is configured as a
 seperate datasource. If we config the datasources as spring beans of
 com.mchange.v2.c3p0.ComboPooledDataSource type, the app works correctly.
 However if we use two JNDI datasources configured in META-INF/context.xml,
 the both autowired datasources point to only ONE same schema.

 Any thoughts?
 Thanks

 Steven



Re: Datasources in Spring-JPA-Tomcat 6.0.29

2012-03-15 Thread Konstantin Kolinko
2012/3/15 Steven Xiong xcste...@yahoo.com:
 I have a Spring/JPA application running on Tomcat 6.0.29 accessing two 
 schemas of a single Oracle database. Each schema is configured as a seperate 
 datasource. If we config the datasources as spring beans of 
 com.mchange.v2.c3p0.ComboPooledDataSource type, the app works correctly. 
 However if we use two JNDI datasources configured in META-INF/context.xml, 
 the both autowired datasources point to only ONE same schema.

So autowiring in Spring wired you to the same datasource?

That would be a Spring question. There is nothing for Tomcat to be
concerned here.


There might be dummy errors to check first:
1) Check that you have properly undeployed the previous version of the
webapp, before deploying the new one.  The concern here is having a
stale copy of the webapp's context file (webapp.xml in
conf/Catalina/localhost).

2) Write a sample jsp page that performs JNDI lookup (using code
samples from the Tomcat documentation) to make sure that both
datasources are available and have different JNDI names and connect to
different schemas.

Best regards,
Konstantin Kolinko

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



Re: Datasources in Spring-JPA-Tomcat 6.0.29

2012-03-15 Thread Steven Xiong
Hi Stevo,

I checked many times, the users are different in context.xml

Thanks




 From: Stevo Slavić ssla...@gmail.com
To: Tomcat Users List users@tomcat.apache.org; Steven Xiong 
xcste...@yahoo.com 
Sent: Thursday, March 15, 2012 9:21:58 AM
Subject: Re: Datasources in Spring-JPA-Tomcat 6.0.29
 
Hello Steven,

Just a wild guess, you're probably using same credentials/account in
context.xml for both data sources, while you're using different
credentials/account in each Spring datasource bean.

Kind regards,
Stevo.

On Thu, Mar 15, 2012 at 2:12 PM, Steven Xiong xcste...@yahoo.com wrote:

 I have a Spring/JPA application running on Tomcat 6.0.29 accessing two
 schemas of a single Oracle database. Each schema is configured as a
 seperate datasource. If we config the datasources as spring beans of
 com.mchange.v2.c3p0.ComboPooledDataSource type, the app works correctly.
 However if we use two JNDI datasources configured in META-INF/context.xml,
 the both autowired datasources point to only ONE same schema.

 Any thoughts?
 Thanks

 Steven


Re: Datasources in Spring-JPA-Tomcat 6.0.29

2012-03-15 Thread Steven Xiong
Thanks Konstantin,
Option 1) has been checked carefully, it is always clean/deploy. I will try 
option 2). 




 From: Konstantin Kolinko knst.koli...@gmail.com
To: Tomcat Users List users@tomcat.apache.org 
Sent: Thursday, March 15, 2012 9:27:51 AM
Subject: Re: Datasources in Spring-JPA-Tomcat 6.0.29
 
2012/3/15 Steven Xiong xcste...@yahoo.com:
 I have a Spring/JPA application running on Tomcat 6.0.29 accessing two 
 schemas of a single Oracle database. Each schema is configured as a seperate 
 datasource. If we config the datasources as spring beans of 
 com.mchange.v2.c3p0.ComboPooledDataSource type, the app works correctly. 
 However if we use two JNDI datasources configured in META-INF/context.xml, 
 the both autowired datasources point to only ONE same schema.

So autowiring in Spring wired you to the same datasource?

That would be a Spring question. There is nothing for Tomcat to be
concerned here.


There might be dummy errors to check first:
1) Check that you have properly undeployed the previous version of the
webapp, before deploying the new one.  The concern here is having a
stale copy of the webapp's context file (webapp.xml in
conf/Catalina/localhost).

2) Write a sample jsp page that performs JNDI lookup (using code
samples from the Tomcat documentation) to make sure that both
datasources are available and have different JNDI names and connect to
different schemas.

Best regards,
Konstantin Kolinko

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

Re: Datasources in Spring-JPA-Tomcat 6.0.29

2012-03-15 Thread Steven Xiong
Hi Konstandin,

It is due to incomplete cleanup: a stale copy with same user causes the issue.

Thanks a lot
Steven




 From: Konstantin Kolinko knst.koli...@gmail.com
To: Tomcat Users List users@tomcat.apache.org 
Sent: Thursday, March 15, 2012 9:27:51 AM
Subject: Re: Datasources in Spring-JPA-Tomcat 6.0.29
 
2012/3/15 Steven Xiong xcste...@yahoo.com:
 I have a Spring/JPA application running on Tomcat 6.0.29 accessing two 
 schemas of a single Oracle database. Each schema is configured as a seperate 
 datasource. If we config the datasources as spring beans of 
 com.mchange.v2.c3p0.ComboPooledDataSource type, the app works correctly. 
 However if we use two JNDI datasources configured in META-INF/context.xml, 
 the both autowired datasources point to only ONE same schema.

So autowiring in Spring wired you to the same datasource?

That would be a Spring question. There is nothing for Tomcat to be
concerned here.


There might be dummy errors to check first:
1) Check that you have properly undeployed the previous version of the
webapp, before deploying the new one.  The concern here is having a
stale copy of the webapp's context file (webapp.xml in
conf/Catalina/localhost).

2) Write a sample jsp page that performs JNDI lookup (using code
samples from the Tomcat documentation) to make sure that both
datasources are available and have different JNDI names and connect to
different schemas.

Best regards,
Konstantin Kolinko

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

Re: Help with ROOT.xml and vhosting please? (fwd)

2012-03-15 Thread Dave Shevett

On 3/14/12 6:35 PM, Pid wrote:

If it didn't start, that would explain why you can't get it to respond.
What is the stacktrace?


So, just to finish this up, I got everything working Just Peachy.  The 
failed deployment was why the app was not showing up in the end, but 
getting the Host entries in server.xml and getting the ROOT.xml stable 
were big components.  I'll probably write up a blog post on this at some 
point.


My last question is is there a way to bring a vhost live without 
restarting Tomcat?  I want to dynamically create vhosts programmatically 
(with scripts and the like) - I can drop the ROOT.xml all configured, 
and I can probably write a script to modify server.xml, but I can't just 
hup tomcat, can I?  I have to bring it all the way down and back up 
again to make the new vhost live, correct?


Again, thanks to everyone for the help!

-d

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



Re: crash with mod_jk 1.2.33

2012-03-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thad,

On 3/15/12 9:39 AM, Thad Humphries wrote:
 Thanks. I hope I did this right. (Google is my friend, correct?) If
 not, please tell me what I should have done.

Looks great. I'm not the best resource for debugging mod_jk crashes,
but it definitely looks like either a problem directly in mod_jk or a
problem that mod_jk does not detect and crashes anyway:

 Program terminated with signal 11, Segmentation fault. #0
 0xb720288c in jk_map_to_storage () from
 /srv/apache2/modules/mod_jk.so (gdb) backtrace #0  0xb720288c in
 jk_map_to_storage () from /srv/apache2/modules/mod_jk.so #1
 0x08081478 in ap_run_map_to_storage () [...]

Would you mind logging a bug in bugzilla:
https://issues.apache.org/bugzilla/enter_bug.cgi?product=Tomcat%20Connectors

Please attach everything you have here in this post: the httpd log
file, the mod_jk log file, and the text-rendering of the core dump.
Keep the core file around in case someone wants to inspect it, but
don't attach it to the bug just yet -- it's probably useless in its
binary form.

Thanks,
- -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/

iEYEARECAAYFAk9iBtUACgkQ9CaO5/Lv0PDj8ACfaziF6KWkid4nI1Gav8KBallg
09IAn1vdZDDu0caK8jhAaB/eyHmmzZzm
=6PVt
-END PGP SIGNATURE-

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



Document base/ Document root

2012-03-15 Thread Michael Gesundheit
Hi,
I have a problem which assume has to do with my document base.My environmet is 
Jboss.I keep getting the 404 page always saying the the page:AppName/whatever 
is not found.AppName is my servlet context.
I'm unable to determine my document base.Question: Is the a way in which I can 
find what does the internal TomCat sees as document base?Or is there a way to 
force TomCat to use a specific directory as the doc root?
Any advice will be appreciated.
Thanks,-Michael 

RE: Tomcat, JSP and LDAP

2012-03-15 Thread Nick Williams
Just a thought ... Spring Security
(http://static.springsource.org/spring-security/site/) is a fabulous
framework for LDAP authentication AND authorization (we're using it
currently with our Windows domain), doesn't require any changes to the app
server or web server, and is relatively easy to get set up and working.

And it's okay if your project is mainly JSPs, because SS can do security
restrictions based on URL patterns, class names, method names, etc.

Just an idea. Beyond Spring Security, I have pretty much no LDAP experience
or knowledge at all. But I was able to get SS up and running in less than a
day.

N

-- 
Nick Williams | Senior Software Developer
UL PureSafety
Health  Safety Software Solutions
Toll Free: 888.202.3016 x 177  |  Direct: 615.277.3177  |  Fax: 615.367.3887
730 Cool Springs Blvd, Suite 400  |  Franklin, TN 37067  |
www.puresafety.com  |  www.ul.com

UL acquired PureSafety on December 6, 2011. Learn More.

-Original Message-
From: Neil Munro [mailto:neilmu...@gmail.com]
Sent: Thursday, March 15, 2012 11:22 AM
To: users@tomcat.apache.org
Subject: Tomcat, JSP and LDAP

Hi all,
 I am trying to implement a means to authenticate a user on a web
app via ldap, I have been trying for some time and am now intimately
familiar with the files I need to edit, but not exactly how.

I know that much of the ldap stuff goes into the server.xml file inside of
the tomcat conf directory, it is here I have been trying to configure an
ldap realm. I have attached the files I have been working with, the basic
idea is that a user must first log on before they can access any area of the
site, also all users can log in, and access all areas of the site.

A user is presented with the login page, and if they cannot be authenticated
they are alerted and are given the option to redirect back to the login
page. Which I have working, thought I think that's simply because I cannot
get the logging in bit work.

I do not have access to the LDAP server or schema and cannot implement
changes to that, I can however alter the tomcat server, jsp files etc.
I am trying to write a company wide web app, and have free reign, but it's
historically been written in jsp so we want to keep as much of that as we
can.

Software and versions: Tomcat 6.0.35, Java 1.4 through to 1.7 (I am required
to have all installed) and Windows 7 64.

Any help would be fantastic as I have read lots of resources but there's no
definitive tutorial to set such a thing up.

Thanks,
Neil Munro

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



Re: Document base/ Document root

2012-03-15 Thread Pid *
On 15 Mar 2012, at 15:40, Michael Gesundheit mi...@rocketmail.com wrote:

 Hi,
 I have a problem which assume has to do with my document base.My environmet 
 is Jboss.I keep getting the 404 page always saying the the 
 page:AppName/whatever is not found.AppName is my servlet context.
 I'm unable to determine my document base.Question: Is the a way in which I 
 can find what does the internal TomCat sees as document base?Or is there a 
 way to force TomCat to use a specific directory as the doc root?
 Any advice will be appreciated.
 Thanks,-Michael


Probably a JBoss config problem, no?


p

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



Re: Tomcat, JSP and LDAP

2012-03-15 Thread Daniel Mikusa
Neil,

I think the instructions here are a pretty good start.  I've used them a few 
times to setup LDAP authentication and they have been helpful.

  https://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#JNDIRealm

In my opinion, the hardest part is to figure out the correct LDAP options and 
searches to use.  Each LDAP system can be organized in a different manner, so 
you have to tweak these depending on how your organization has setup LDAP.  
What I've found helps with this is to use the Apache Directory Studio.  It 
makes testing connection options and search queries easy, plus it give a good 
way to browse the LDAP tree.

If you want to go another route, I would also recommend Spring Security.  It 
has excellent support for LDAP.

Dan



- Original Message -
From: Neil Munro neilmu...@gmail.com
To: users@tomcat.apache.org
Sent: Thursday, March 15, 2012 12:22:18 PM
Subject: Tomcat, JSP and LDAP

Hi all,
 I am trying to implement a means to authenticate a user on a
web app via ldap, I have been trying for some time and am now
intimately familiar with the files I need to edit, but not exactly
how.

I know that much of the ldap stuff goes into the server.xml file
inside of the tomcat conf directory, it is here I have been trying to
configure an ldap realm. I have attached the files I have been working
with, the basic idea is that a user must first log on before they can
access any area of the site, also all users can log in, and access all
areas of the site.

A user is presented with the login page, and if they cannot be
authenticated they are alerted and are given the option to redirect
back to the login page. Which I have working, thought I think that's
simply because I cannot get the logging in bit work.

I do not have access to the LDAP server or schema and cannot implement
changes to that, I can however alter the tomcat server, jsp files etc.
I am trying to write a company wide web app, and have free reign, but
it's historically been written in jsp so we want to keep as much of
that as we can.

Software and versions: Tomcat 6.0.35, Java 1.4 through to 1.7 (I am
required to have all installed) and Windows 7 64.

Any help would be fantastic as I have read lots of resources but
there's no definitive tutorial to set such a thing up.

Thanks,
Neil Munro


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

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



Re: Tomcat, JSP and LDAP

2012-03-15 Thread Pid *
On 15 Mar 2012, at 16:23, Neil Munro neilmu...@gmail.com wrote:

 Hi all,
 I am trying to implement a means to authenticate a user on a
 web app via ldap, I have been trying for some time and am now
 intimately familiar with the files I need to edit, but not exactly
 how.

 I know that much of the ldap stuff goes into the server.xml file
 inside of the tomcat conf directory, it is here I have been trying to
 configure an ldap realm.

OK. Can you post that bit of config, inline in your reply? Passwords
etc redacted in necessary.


 I have attached the files I have been working
 with, the basic idea is that a user must first log on before they can
 access any area of the site, also all users can log in, and access all
 areas of the site.

Can you explain how you are configuring the auth, please? Are you
using the container FORM authentication, for example?

If so, can you post that bit of config inline in your reply?


p


 A user is presented with the login page, and if they cannot be
 authenticated they are alerted and are given the option to redirect
 back to the login page. Which I have working, thought I think that's
 simply because I cannot get the logging in bit work.

 I do not have access to the LDAP server or schema and cannot implement
 changes to that, I can however alter the tomcat server, jsp files etc.
 I am trying to write a company wide web app, and have free reign, but
 it's historically been written in jsp so we want to keep as much of
 that as we can.

 Software and versions: Tomcat 6.0.35, Java 1.4 through to 1.7 (I am
 required to have all installed) and Windows 7 64.

 Any help would be fantastic as I have read lots of resources but
 there's no definitive tutorial to set such a thing up.

 Thanks,
 Neil Munro
 files.zip

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

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



Re: Help with ROOT.xml and vhosting please? (fwd)

2012-03-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dave,

On 3/15/12 11:05 AM, Dave Shevett wrote:
 On 3/14/12 6:35 PM, Pid wrote:
 If it didn't start, that would explain why you can't get it to
 respond. What is the stacktrace?
 
 So, just to finish this up, I got everything working Just Peachy.
 The failed deployment was why the app was not showing up in the
 end

That'll do it.

 My last question is is there a way to bring a vhost live without 
 restarting Tomcat?

You can use the host manager webapp to do things like that. The
problem is that the host manager does not persist the changes
anywhere, so you'd have to either write them somewhere (like
server.xml) yourself at the same time you hot-deployed them, or you'd
need to re-hot-deploy every vhost every time you restart Tomcat.

 I want to dynamically create vhosts programmatically (with scripts
 and the like) - I can drop the ROOT.xml all configured, and I can
 probably write a script to modify server.xml, but I can't just hup
 tomcat, can I?  I have to bring it all the way down and back up 
 again to make the new vhost live, correct?

If you modify server.xml, yes: you have to shut down Tomcat and bring
it back up.

Is there a way you could get away with using the hostname for
self-configuration at request-time? If you could do that, you would
only need a single Host and a single deployment of the webapp. The
only things that would need to change when you wanted to support a new
vhost would be to shove some configuration somewhere that you can
key-off the hostname (db, for instance).

- -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/

iEYEARECAAYFAk9iITIACgkQ9CaO5/Lv0PA4kwCfZACKXTI+pBb2xfkxu1RAUhPm
3LcAnRJngtQ1ODxoYeMdWF0TYl6iksFp
=ybk1
-END PGP SIGNATURE-

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



Re: Help with ROOT.xml and vhosting please? (fwd)

2012-03-15 Thread Pid *
On 15 Mar 2012, at 15:05, Dave Shevett shev...@homeport.org wrote:

 On 3/14/12 6:35 PM, Pid wrote:
 If it didn't start, that would explain why you can't get it to respond.
 What is the stacktrace?

 So, just to finish this up, I got everything working Just Peachy.  The failed 
 deployment was why the app was not showing up in the end, but getting the 
 Host entries in server.xml and getting the ROOT.xml stable were big 
 components.  I'll probably write up a blog post on this at some point.

 My last question is is there a way to bring a vhost live without restarting 
 Tomcat?  I want to dynamically create vhosts programmatically (with scripts 
 and the like) - I can drop the ROOT.xml all configured, and I can probably 
 write a script to modify server.xml, but I can't just hup tomcat, can I?  I 
 have to bring it all the way down and back up again to make the new vhost 
 live, correct?

You can create Hosts programmatically via the JMX API, but YMMV. This
will not automatically persist to the file based config.


p



 Again, thanks to everyone for the help!

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



Re: Tomcat, JSP and LDAP

2012-03-15 Thread Neil Munro
On 15 March 2012 17:01, Pid * p...@pidster.com wrote:
 On 15 Mar 2012, at 16:23, Neil Munro neilmu...@gmail.com wrote:

 Hi all,
         I am trying to implement a means to authenticate a user on a
 web app via ldap, I have been trying for some time and am now
 intimately familiar with the files I need to edit, but not exactly
 how.

 I know that much of the ldap stuff goes into the server.xml file
 inside of the tomcat conf directory, it is here I have been trying to
 configure an ldap realm.

 OK. Can you post that bit of config, inline in your reply? Passwords
 etc redacted in necessary.

Sure, here you are:
!--Realm className=org.apache.catalina.realm.JNDIRealm 
debug=99
connectionName=uid={0},ou=my company 
users,dc=mycompany,dc=com 
connectionPassword=userPassword
connectionURL=ldap://my.ldap.server.com;
alternateURL=ldap://my.ldap.server.com;
roleBase=ou=my company users,dc=mycompany,dc=com
roleName=cn
roleSearch=(uniqueMember={0})
roleSubtree=false
userSearch=(uid={0})
userPassword=userPassword
userPattern=uid={0},ou=my company 
users,dc=mycompany,dc=com
/--
Realm className=org.apache.catalina.realm.JNDIRealm 
debug=99
connectionURL=ldap://my.ldap.server.com;
alternateURL=ldap://my.ldap.server.com;
userPattern=uid={0},ou=my company 
users,dc=mycompany,dc=com /


 I have attached the files I have been working
 with, the basic idea is that a user must first log on before they can
 access any area of the site, also all users can log in, and access all
 areas of the site.

 Can you explain how you are configuring the auth, please? Are you
 using the container FORM authentication, for example?

 If so, can you post that bit of config inline in your reply?

Yes I am using, or rather trying to use a html form to get the
information to pass to ldap to authenticate.

!--  uses form-based authentication --
login-config
auth-methodFORM/auth-method
form-login-config
form-login-page/login.jsp/form-login-page
form-error-page/fail_login.jsp/form-error-page
/form-login-config
/login-config

Thank's,
Neil


 p


 A user is presented with the login page, and if they cannot be
 authenticated they are alerted and are given the option to redirect
 back to the login page. Which I have working, thought I think that's
 simply because I cannot get the logging in bit work.

 I do not have access to the LDAP server or schema and cannot implement
 changes to that, I can however alter the tomcat server, jsp files etc.
 I am trying to write a company wide web app, and have free reign, but
 it's historically been written in jsp so we want to keep as much of
 that as we can.

 Software and versions: Tomcat 6.0.35, Java 1.4 through to 1.7 (I am
 required to have all installed) and Windows 7 64.

 Any help would be fantastic as I have read lots of resources but
 there's no definitive tutorial to set such a thing up.

 Thanks,
 Neil Munro
 files.zip

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

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


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



RE: Precompile JSPs, avoid thousands of servlets?

2012-03-15 Thread Nick Williams
 Hmm... do you have complete control over the version of Tomcat that your
 clients use?

Unfortunately, we do not have complete control over this.

 The JSP compiler uses Tomcat-specific classes and they are not part of any
 public API...

Yea, I just looked at the sources for the compiled JSPs and see that they're
full of references to proprietary Tomcat classes. Looks like this is the
case no matter which App Server I compile the JSPs with ... they end up full
of classes from that App Server. I guess that makes sense, what with Tag
Pooling and everything else.

 ...though switching content-generation frameworks isn't a task I would
 wish on a bitter enemy.

Agreed. I wouldn't either.

At this point, it looks like we're going to have to stick to shipping the
raw JSP files in the application and having them be compiled by the
container (either at startup or runtime ... one way or another).

 My recommendation would be to stick with a single monolithic web.xml...

Thanks for the recommendation, but I guess it's moot now.

Y'all have all been a lot of help. Thanks!

Nick


-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net]
Sent: Monday, March 12, 2012 9:48 PM
To: Tomcat Users List
Subject: Re: Precompile JSPs, avoid thousands of servlets?

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nick,

On 3/12/12 4:43 PM, Nick Williams wrote:
 We maintain a very large application, with somewhere around 2,000 JSP
 files (in addition to ~250,000 lines of pure Java). We have decided it
 is about time we ship our application with precompiled JSP files.

Hmm... do you have complete control over the version of Tomcat that your
clients use?

 Our first challenge is that we support Tomcat, GlassFish, WebLogic and
 WebSphere, so our JSPs have to be precompiled in such a way that they
 will run in any of those web containers. We’ll overcome that challenge
 I’m sure; if we have to include some extra libraries, we’ll make it
 work.

You are toast, as far as Tomcat's precompiler is concerned. The JSP compiler
uses Tomcat-specific classes and they are not part of any public API (that
is, not stable) so they are very sensitive to the exact version of Tomcat --
sometimes down to the point release (like
7.0.22 and 7.0.23 might be incompatible).

My recommendation would be to allow your webapp to be precompiled at (or,
rather, immediately before) deploy-time by providing different procedures
(maybe ant tasks?) for each container.

 Our second  challenge is the 11,500-line web.xml file that results
 from this process. I understand that Ant does a lot of the hard work
 for me, but a web.xml file this large bothers me, even if I don’t have
 to look at it during every day development. What’s more, we’re
 actually trying to *move away* from having a web.xml file (of any real
 substance) and using new Servlet 3.0 features.

Note that there are glaring problems with web-fragments including questions
about precedence in the face of conflicts for things like overlapping
url-patterns, etc. My recommendation would be to stick with a single
monolithic web.xml except in cases where you have a definite isolated chunk
of features that can be encapsulated into a separate JAR file.

 I could swear I saw an example a while ago (while searching Google, of
 course) of a web.xml file with a single servlet that responded to
 requests for ALL JSPs that had be precompiled, but I can’t find it
 anywhere anymore. I’m sure I *could* write my own servlet to
 accomplish this, but I’d sure like to use something existing that
 already has common usage.

Maybe the invoker servlet? I'm not entirely sure if I'm kidding, actually.

 Does anyone have any ideas?

Perhaps JSP isn't the best solution for you... how much dynamic-ness do you
need in all these content-generating files? Maybe another technology
(Freemarker? I don't think Velocity has a precompiler...) would meet you
needs better than JSP, though switching content-generation frameworks isn't
a task I would wish on a bitter enemy).

- -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/

iEYEARECAAYFAk9etWwACgkQ9CaO5/Lv0PBFMwCgoiB1f1TERHAwtEaLm+zgBq2X
MQEAniSMx+hMCqTUuuIev1Ruehn0DK3x
=AbQf
-END PGP SIGNATURE-

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

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



RE: Precompile JSPs, avoid thousands of servlets?

2012-03-15 Thread Nick Williams
Terence,

In addition to my previous reply to Chris, most of our JSPs are not SUPPOSED
to be accessed as web pages, although some are meant to be. Also,
unfortunately, all of them ARE accessible as web pages due to bad design
(something I intend to change).

Nick


-Original Message-
From: Terence M. Bandoian [mailto:tere...@tmbsw.com]
Sent: Tuesday, March 13, 2012 1:46 PM
To: Tomcat Users List
Subject: Re: Precompile JSPs, avoid thousands of servlets?

  On 1:59 PM, Nick Williams wrote:
 We maintain a very large application, with somewhere around 2,000 JSP
 files (in addition to ~250,000 lines of pure Java). We have decided it
 is about time we ship our application with precompiled JSP files.



 The Ant tasks from Tomcat to support this effort have been extremely
 helpful, and I have no serious complaints about them. We can even use
 our own package name for the JSPs. Great!



 Our first challenge is that we support Tomcat, GlassFish, WebLogic and
 WebSphere, so our JSPs have to be precompiled in such a way that they
 will run in any of those web containers. We’ll overcome that challenge
 I’m sure; if we have to include some extra libraries, we’ll make it work.



 Our second  challenge is the 11,500-line web.xml file that results
 from this process. I understand that Ant does a lot of the hard work
 for me, but a web.xml file this large bothers me, even if I don’t have
 to look at it during every day development. What’s more, we’re
 actually trying to *move
 away* from having a web.xml file (of any real substance) and using new
 Servlet 3.0 features.



 I could swear I saw an example a while ago (while searching Google, of
 course) of a web.xml file with a single servlet that responded to
 requests for ALL JSPs that had be precompiled, but I can’t find it
 anywhere anymore.
 I’m sure I *could* write my own servlet to accomplish this, but I’d
 sure like to use something existing that already has common usage.



 Does anyone have any ideas?



At least web.xml is auto-generated.  Are all of the JSPs accessible as web
pages?  What I've seen uses annotations and then you have to live with the
startup time.

-Terence Bandoian

P.S. Sorry about the direct e-mail.

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

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



Re: Document base/ Document root

2012-03-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Michael,

On 3/15/12 11:40 AM, Michael Gesundheit wrote:
 I have a problem which assume has to do with my document base.My 
 environmet is Jboss.I keep getting the 404 page always saying the
 the page:AppName/whatever is not found.AppName is my servlet
 context.

So you are getting 404 errors? What resource are you trying to access?
Is it static or dynamic? If dynamic, is it properly mapped in
WEB-INF/web.xml?

Do you have a web server in front of JBoss? If so, what does the
configuration look like?

 I'm unable to determine my document base.Question: Is the a way in 
 which I can find what does the internal TomCat sees as document 
 base?Or is there a way to force TomCat to use a specific directory
 as the doc root?

You might be confused by what web servers (like httpd) typically call
a DocumentRoot. In Tomcat, there are two relevant directories that
could be what you are talking about:

1. appBase - this is an attribute of Host that specifies where
   webapps are usually placed on the file system. In a default
   configuration, webapps placed there (in a directory or as a WAR
   file) are automatically deployed on startup.

2. docBase - this is an attribute of Context that may only be
   specified when you are placing a context.xml file (named
   appname.xml) into Tomcat's conf/ directory structure. The docbase
   points to the directory or WAR file that contains the webapp.
   This is the closest thing to DocumentRoot you can get in Tomcat.

If you are talking about docBase, then there's no reason you should be
setting it to anything at all: everything is auto-detected if you
deploy your webapp in any standard way.

As long as your URI looks like this:

/context/resource

then you ought to be able to find 'resource' here:

/path/to/webapp/resource

Note that the 'context' is part of the URI but doesn't get added to
your webapp's docBase (since the context prefix and the docBase are
usually the same).

Hope that helps,
- -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/

iEYEARECAAYFAk9iMA8ACgkQ9CaO5/Lv0PCFxACZASl5jVVcVCgC8Qh2HfChvqtS
nIwAn2Q8ZCV65g23DLLC2j8KwFGoZ9xc
=LXAk
-END PGP SIGNATURE-

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



Re: crash with mod_jk 1.2.33

2012-03-15 Thread Thad Humphries
On Thu, Mar 15, 2012 at 11:12 AM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Thad,

 On 3/15/12 9:39 AM, Thad Humphries wrote:
  Thanks. I hope I did this right. (Google is my friend, correct?) If
  not, please tell me what I should have done.

 Looks great. I'm not the best resource for debugging mod_jk crashes,
 but it definitely looks like either a problem directly in mod_jk or a
 problem that mod_jk does not detect and crashes anyway:

  Program terminated with signal 11, Segmentation fault. #0
  0xb720288c in jk_map_to_storage () from
  /srv/apache2/modules/mod_jk.so (gdb) backtrace #0  0xb720288c in
  jk_map_to_storage () from /srv/apache2/modules/mod_jk.so #1
  0x08081478 in ap_run_map_to_storage () [...]

 Would you mind logging a bug in bugzilla:

 https://issues.apache.org/bugzilla/enter_bug.cgi?product=Tomcat%20Connectors

 Please attach everything you have here in this post: the httpd log
 file, the mod_jk log file, and the text-rendering of the core dump.
 Keep the core file around in case someone wants to inspect it, but
 don't attach it to the bug just yet -- it's probably useless in its
 binary form.

 Thanks,
 - -chris


Thanks. I've submitted Bug
52921https://issues.apache.org/bugzilla/show_bug.cgi?id=52921.
(The version is marked as unspecified because Bugzilla did not yet have an
option for 1.2.33.)

-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: Precompile JSPs, avoid thousands of servlets?

2012-03-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nick,

On 3/15/12 1:21 PM, Nick Williams wrote:
 Hmm... do you have complete control over the version of Tomcat
 that your clients use?
 
 Unfortunately, we do not have complete control over this.

This doesn't look good for you :(

 The JSP compiler uses Tomcat-specific classes and they are not
 part of any public API...
 
 Yea, I just looked at the sources for the compiled JSPs and see
 that they're full of references to proprietary Tomcat classes.
 Looks like this is the case no matter which App Server I compile
 the JSPs with ... they end up full of classes from that App Server.
 I guess that makes sense, what with Tag Pooling and everything
 else.

Exactly: compiled JSPs are more than just raw scriptlets and
tag-source placed into a .java file and compiled. Since the JSP API
defines mostly interfaces and leaves it up to the containers to
implement, this is necessarily the case. There isn't even a standard
API for launching a JSP (other than calling service), though I'm
sure everyone's implementation looks basically the same. The fact is
that each JSP is going to need a bunch of support code that simply
must come from the container.

There is another possibility: tear-out Jasper from Tomcat and write
your own JSPServlet that you map to *.jsp in your own webapp. It will
probably be a bunch of work, and you'll either have to keep it in sync
with the Tomcat sources or risk getting stale as bugs are fixed and
improvements are made.

The advantage, though, is that you could package it with your webapp
and the it doesn't matter what container the client uses: the JSPs
will run Jasper no matter what.

I don't know how hard that would be -- I've never tried it :)

It seems reasonable that Jasper could be separated from the core of
Tomcat. I wonder if anyone else would be interested in such a clean
separation.

 ...though switching content-generation frameworks isn't a task I
 would wish on a bitter enemy.
 
 Agreed. I wouldn't either.
 
 At this point, it looks like we're going to have to stick to
 shipping the raw JSP files in the application and having them be
 compiled by the container (either at startup or runtime ... one way
 or another).

There are several ways to trigger compilation at start up (or
immediately thereafter). Are you simply trying to reduce the
first-access time of each JSP? Or is this a solution looking for a
real-world problem?

- -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/

iEYEARECAAYFAk9iMYIACgkQ9CaO5/Lv0PAXOwCeP9hcYtRyOjM2HvCy9KqetMOG
NBcAoKCPHBlNwovMEOw/o4ejU/s+SpML
=arEm
-END PGP SIGNATURE-

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



Re: Tomcat, JSP and LDAP

2012-03-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Neil,

On 3/15/12 1:05 PM, Neil Munro wrote:
 Realm className=org.apache.catalina.realm.JNDIRealm debug=99 
 connectionURL=ldap://my.ldap.server.com; 
 alternateURL=ldap://my.ldap.server.com; userPattern=uid={0},ou=my
 company users,dc=mycompany,dc=com /
 

The debug attribute does not exist any more. Were you following some
kind of old example?

I think you may need roleBase, roleName, and roleSearch attributes to
have a prayer of making this work. Also, with no userSearch parameter,
you are instructing the realm to connect in bind mode where the
user's credentials are used directly to bind to the LDAP server. Is
this appropriate?

You might want to re-read this section of the realm-howto:

http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#JNDIRealm

Can you run any queries against the LDAP server outside of Tomcat that
give you results that you might expect? For instance, can you do a
search of the LDAP tree for a particular user? What does that query
look like? When you do that search, are you using anonymous bind or
are you using user bind? If user, which user? Some administrative user
or the user whose credentials should be checked?

 login-config auth-methodFORM/auth-method form-login-config 
 form-login-page/login.jsp/form-login-page 
 form-error-page/fail_login.jsp/form-error-page 
 /form-login-config /login-config

That looks just fine: configuring the credential-gathering system is
usually trivial. It's configuring the authentication system that is
usually the problem.

- -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/

iEYEARECAAYFAk9iM+sACgkQ9CaO5/Lv0PBhjQCePnWAoRuPgmLUnVt1p3sR/SBt
8vwAnib22g8tvT/PpyN2FfUE5Gs7+OVP
=9g6k
-END PGP SIGNATURE-

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



RE: Precompile JSPs, avoid thousands of servlets?

2012-03-15 Thread Nick Williams
 It seems reasonable that Jasper could be separated from the core of
 Tomcat.

We may consider attempting integrating Jasper into our product at a later
date to see if that works. Not in this version of the product, however.

 Are you simply trying to reduce the first-access time of each JSP?

The performance improvement is always nice, but irrelevant. That can be
achieved with startup compilation. The bigger issue is making sure that all
of our JSPs compile. We can compile them at build time, but that only
guarantees they'll compile for that particular version of that particular
server. At one point, we had two JSPs that would compile in Tomcat
5.5.26-5.5.33 and Tomcat 6.0.20-6.0.32, but not Tomcat 5.5  5.5.26, not
Tomcat 6  6.0.32, and not Tomcat 7. We have since fixed this issue and are
trying to bring our JSPs to a more stable state.

(We didn't build this product from the ground up, by the way, just in case
you were wondering. We acquired it from a single developer who had written
all 1.1 million lines of code by himself, never shared the details of the
code with anyone else, never used any 3rd-party frameworks, never used any
design patterns, and had ported (read: not re-written) the project from
Pascal to C++/MFC to Java/Java EE over the course of 20 years.)

N

-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net]
Sent: Thursday, March 15, 2012 1:14 PM
To: Tomcat Users List
Subject: Re: Precompile JSPs, avoid thousands of servlets?

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nick,

On 3/15/12 1:21 PM, Nick Williams wrote:
 Hmm... do you have complete control over the version of Tomcat that
 your clients use?

 Unfortunately, we do not have complete control over this.

This doesn't look good for you :(

 The JSP compiler uses Tomcat-specific classes and they are not part
 of any public API...

 Yea, I just looked at the sources for the compiled JSPs and see that
 they're full of references to proprietary Tomcat classes.
 Looks like this is the case no matter which App Server I compile the
 JSPs with ... they end up full of classes from that App Server.
 I guess that makes sense, what with Tag Pooling and everything else.

Exactly: compiled JSPs are more than just raw scriptlets and tag-source
placed into a .java file and compiled. Since the JSP API defines mostly
interfaces and leaves it up to the containers to implement, this is
necessarily the case. There isn't even a standard API for launching a JSP
(other than calling service), though I'm sure everyone's implementation
looks basically the same. The fact is that each JSP is going to need a bunch
of support code that simply must come from the container.

There is another possibility: tear-out Jasper from Tomcat and write your own
JSPServlet that you map to *.jsp in your own webapp. It will probably be a
bunch of work, and you'll either have to keep it in sync with the Tomcat
sources or risk getting stale as bugs are fixed and improvements are made.

The advantage, though, is that you could package it with your webapp and the
it doesn't matter what container the client uses: the JSPs will run Jasper
no matter what.

I don't know how hard that would be -- I've never tried it :)

It seems reasonable that Jasper could be separated from the core of Tomcat.
I wonder if anyone else would be interested in such a clean separation.

 ...though switching content-generation frameworks isn't a task I
 would wish on a bitter enemy.

 Agreed. I wouldn't either.

 At this point, it looks like we're going to have to stick to shipping
 the raw JSP files in the application and having them be compiled by
 the container (either at startup or runtime ... one way or another).

There are several ways to trigger compilation at start up (or immediately
thereafter). Are you simply trying to reduce the first-access time of each
JSP? Or is this a solution looking for a real-world problem?

- -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/

iEYEARECAAYFAk9iMYIACgkQ9CaO5/Lv0PAXOwCeP9hcYtRyOjM2HvCy9KqetMOG
NBcAoKCPHBlNwovMEOw/o4ejU/s+SpML
=arEm
-END PGP SIGNATURE-

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

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



Re: Precompile JSPs, avoid thousands of servlets?

2012-03-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nick,

On 3/15/12 2:29 PM, Nick Williams wrote:
 It seems reasonable that Jasper could be separated from the core
 of Tomcat.
 
 We may consider attempting integrating Jasper into our product at a
 later date to see if that works. Not in this version of the
 product, however.
 
 Are you simply trying to reduce the first-access time of each
 JSP?
 
 The performance improvement is always nice, but irrelevant. That
 can be achieved with startup compilation. The bigger issue is
 making sure that all of our JSPs compile. We can compile them at
 build time, but that only guarantees they'll compile for that
 particular version of that particular server. At one point, we had
 two JSPs that would compile in Tomcat 5.5.26-5.5.33 and Tomcat
 6.0.20-6.0.32, but not Tomcat 5.5  5.5.26, not Tomcat 6  6.0.32,
 and not Tomcat 7. We have since fixed this issue and are trying to
 bring our JSPs to a more stable state.

Gotcha. Please tell me you are using the Tomcat precompiler and not
just deploying the webapp and trying to hit all of the URLs. Tomcat
has a precompiler for (I believe) all currently-supported versions.

 (We didn't build this product from the ground up, by the way, just
 in case you were wondering. We acquired it from a single developer
 who had written all 1.1 million lines of code by himself, never
 shared the details of the code with anyone else, never used any
 3rd-party frameworks, never used any design patterns, and had
 ported (read: not re-written) the project from Pascal to C++/MFC to
 Java/Java EE over the course of 20 years.)

I've been there. I was on a consulting gig once where we replaced
about 70% of the code of the product with 3rd-party OSS libraries that
had been written after the inception of the project, but the original
developers never had the inclination to switch. Things like logging
frameworks, O-R mappers, and even a rudimentary XSLT engine (but it
wasn't called that at the time).

It's amazing what people will write all by themselves.

- -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/

iEYEARECAAYFAk9iRe0ACgkQ9CaO5/Lv0PCvrgCfes0V1ej1G1vuZkV+y+wqnuwH
rBQAn20yt4RZWIhLQBgGbHIC/+aX3rMl
=MGxB
-END PGP SIGNATURE-

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



Re: Precompile JSPs, avoid thousands of servlets?

2012-03-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim,

On 3/15/12 3:41 PM, Christopher Schultz wrote:
 Gotcha. Please tell me you are using the Tomcat precompiler and
 not just deploying the webapp and trying to hit all of the URLs.
 Tomcat has a precompiler for (I believe) all currently-supported
 versions.

I should add that the precompiler is command-line based, and so it
could be scripted. That way, you could line-up all the supported
versions of Tomcat next to each other and just do a sanity-check JSP
compile. It would take a while to compile 2000 JSPs under every
point-release of Tomcat between 5.5.x and 7.0.x but it's better than
doing it by hand (or just praying).

- -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/

iEYEARECAAYFAk9iR1IACgkQ9CaO5/Lv0PA4sQCePne5hpB3oW4bZb/yLq8HdpRb
w6gAnjzmIG2YV+eFtUKasDzo5MUuDpA4
=4wii
-END PGP SIGNATURE-

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



RE: Precompile JSPs, avoid thousands of servlets?

2012-03-15 Thread Nick Williams
 Please tell me you are using the Tomcat precompiler

We didn't used to be doing ANY JSP precompilation, but now we are
precompiling during our continuous integration build using JspC and ANT.
We're still shipping uncompiled JSPs, but at least we're verifying
everything at build time now. We didn't even used to do that...

No, we are not trying to hit all of the URLs. Hah! 2,491 JSPs...

 It's amazing what people will write all by themselves.

Yes, indeed it is.

Nick


-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net]
Sent: Thursday, March 15, 2012 2:42 PM
To: Tomcat Users List
Subject: Re: Precompile JSPs, avoid thousands of servlets?

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nick,

On 3/15/12 2:29 PM, Nick Williams wrote:
 It seems reasonable that Jasper could be separated from the core of
 Tomcat.

 We may consider attempting integrating Jasper into our product at a
 later date to see if that works. Not in this version of the product,
 however.

 Are you simply trying to reduce the first-access time of each JSP?

 The performance improvement is always nice, but irrelevant. That can
 be achieved with startup compilation. The bigger issue is making sure
 that all of our JSPs compile. We can compile them at build time, but
 that only guarantees they'll compile for that particular version of
 that particular server. At one point, we had two JSPs that would
 compile in Tomcat 5.5.26-5.5.33 and Tomcat 6.0.20-6.0.32, but not
 Tomcat 5.5  5.5.26, not Tomcat 6  6.0.32, and not Tomcat 7. We have
 since fixed this issue and are trying to bring our JSPs to a more
 stable state.

Gotcha. Please tell me you are using the Tomcat precompiler and not just
deploying the webapp and trying to hit all of the URLs. Tomcat has a
precompiler for (I believe) all currently-supported versions.

 (We didn't build this product from the ground up, by the way, just in
 case you were wondering. We acquired it from a single developer who
 had written all 1.1 million lines of code by himself, never shared the
 details of the code with anyone else, never used any 3rd-party
 frameworks, never used any design patterns, and had ported (read: not
 re-written) the project from Pascal to C++/MFC to Java/Java EE over
 the course of 20 years.)

I've been there. I was on a consulting gig once where we replaced about 70%
of the code of the product with 3rd-party OSS libraries that had been
written after the inception of the project, but the original developers
never had the inclination to switch. Things like logging frameworks, O-R
mappers, and even a rudimentary XSLT engine (but it wasn't called that at
the time).

It's amazing what people will write all by themselves.

- -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/

iEYEARECAAYFAk9iRe0ACgkQ9CaO5/Lv0PCvrgCfes0V1ej1G1vuZkV+y+wqnuwH
rBQAn20yt4RZWIhLQBgGbHIC/+aX3rMl
=MGxB
-END PGP SIGNATURE-

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

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



Re: Tomcat, JSP and LDAP

2012-03-15 Thread Pid *
On 15 Mar 2012, at 17:06, Neil Munro neilmu...@gmail.com wrote:

 On 15 March 2012 17:01, Pid * p...@pidster.com wrote:
 On 15 Mar 2012, at 16:23, Neil Munro neilmu...@gmail.com wrote:

 Hi all,
 I am trying to implement a means to authenticate a user on a
 web app via ldap, I have been trying for some time and am now
 intimately familiar with the files I need to edit, but not exactly
 how.

 I know that much of the ldap stuff goes into the server.xml file
 inside of the tomcat conf directory, it is here I have been trying to
 configure an ldap realm.

 OK. Can you post that bit of config, inline in your reply? Passwords
 etc redacted in necessary.

 Sure, here you are:
   !--Realm className=org.apache.catalina.realm.JNDIRealm debug=99
connectionName=uid={0},ou=my company users,dc=mycompany,dc=com 
connectionPassword=userPassword
connectionURL=ldap://my.ldap.server.com;
alternateURL=ldap://my.ldap.server.com;
roleBase=ou=my company users,dc=mycompany,dc=com
roleName=cn
roleSearch=(uniqueMember={0})
roleSubtree=false
userSearch=(uid={0})
userPassword=userPassword
userPattern=uid={0},ou=my company users,dc=mycompany,dc=com
/--
Realm className=org.apache.catalina.realm.JNDIRealm debug=99
connectionURL=ldap://my.ldap.server.com;
alternateURL=ldap://my.ldap.server.com;
userPattern=uid={0},ou=my company users,dc=mycompany,dc=com 
 /


 I have attached the files I have been working
 with, the basic idea is that a user must first log on before they can
 access any area of the site, also all users can log in, and access all
 areas of the site.

 Can you explain how you are configuring the auth, please? Are you
 using the container FORM authentication, for example?

 If so, can you post that bit of config inline in your reply?

 Yes I am using, or rather trying to use a html form to get the
 information to pass to ldap to authenticate.

!--  uses form-based authentication --
login-config
auth-methodFORM/auth-method
form-login-config
form-login-page/login.jsp/form-login-page
form-error-page/fail_login.jsp/form-error-page
/form-login-config
/login-config


And for completeness, the security-constraint block?


s



 Thank's,
 Neil


 p


 A user is presented with the login page, and if they cannot be
 authenticated they are alerted and are given the option to redirect
 back to the login page. Which I have working, thought I think that's
 simply because I cannot get the logging in bit work.

 I do not have access to the LDAP server or schema and cannot implement
 changes to that, I can however alter the tomcat server, jsp files etc.
 I am trying to write a company wide web app, and have free reign, but
 it's historically been written in jsp so we want to keep as much of
 that as we can.

 Software and versions: Tomcat 6.0.35, Java 1.4 through to 1.7 (I am
 required to have all installed) and Windows 7 64.

 Any help would be fantastic as I have read lots of resources but
 there's no definitive tutorial to set such a thing up.

 Thanks,
 Neil Munro
 files.zip

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

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


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


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



Re: Socket Error in tomcat, white screen in browser

2012-03-15 Thread morciuch
I had similar problem on Windows Server 2008. After some research, I added
the following JVM option to make it work:

-Djava.net.preferIPv4Stack=true  

--
View this message in context: 
http://tomcat.10.n6.nabble.com/Socket-Error-in-tomcat-white-screen-in-browser-tp2053737p4622960.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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



Writing a custom resource factory

2012-03-15 Thread Michael-O

Hi folks,

I'd like to write a custom ldap resource factory as same as a data 
source factory. The getObjectInstance method shall return 
InitialDirContext object. I have written a mock factory and noticed that 
the output is cached by Tomcat. So the object is created only once (same 
id in Eclipse debugger).


Now I need to verify that the InitialDirContext is still valid (conn 
timeout, etc.), same as testOnBorrow with DataSource. I won't have any 
reference to it after its creation. This means that I would need to wrap 
that object somehow and perform the operation myself?

This is how Tomcat JDBC Pool does.

Is my assumption correct? If yes, I would need to wrap every sing method 
defined in DirContext and InitialDirContext.


Thanks,

Mike

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



How to specify not using a keystoreFile in server.xml when using a custom keystore?

2012-03-15 Thread Newel, David
Hi,

 

I'm experiencing a problem with creating an SSL Connector in Tomcat
7.0.26. We intend to use a database-based keystore, which means that we
are using a custom-made Provider which does not use the 'keystoreFile'
tag. To try to prevent Tomcat from trying to open a file we specify the
Connector in this way:

 

Connector SSLEnabled=true URIEncoding=UTF-8
clientAuth=false

keyAlias=TestCert keystoreFile= keystoreType=Custom
port=443

protocol=HTTP/1.1 scheme=https secure=true
sslProtocol=TLS/

 

This used to work in Tomcat 6.0.32, but when we upgraded to Tomcat 7.0,
this exception gets thrown in the error stream :

 

SEVERE: Failed to load keystore type Custom with path E:\Program
Files\Application\configuration\services\tomcat\ due to E:\Program
Files\Application\configuration\services\tomcat (Access is denied)

java.io.FileNotFoundException: E:\Program
Files\Application\configuration\services\tomcat (Access is denied)

   at java.io.FileInputStream.open(Native Method)

   at java.io.FileInputStream.init(Unknown Source)

   at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFac
tory.java:400)

   at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocket
Factory.java:306)

   at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESoc
ketFactory.java:565)

   at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESoc
ketFactory.java:505)

   at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.init(JSSESocketFactory
.java:449)

   at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(JSSESocke
tFactory.java:158)

   at
org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:378)

   at
org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:5
54)

   at
org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:409)

   at
org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11J
sseProtocol.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.ja
va:559)

   at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)

   at
org.apache.catalina.core.StandardServer.initInternal(StandardServer.java
:815)

   at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)

   at
org.apache.catalina.startup.Catalina.load(Catalina.java:594)

   at
org.apache.catalina.startup.Catalina.load(Catalina.java:619)

   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)

 

Is this a bug in Tomcat 7.0 or is there an alternative method we're
supposed to use in order to prevent it from loading a keystoreFile from
the file system?

 

I took a look at the source through a debugger and found the area in
JSSESocketFactory where it reads this file, and it seems as though
specifying  doesn't work correctly anymore because it tries to map a
relative path to catalina.base

 

 



Re: Socket Error in tomcat, white screen in browser

2012-03-15 Thread Pid *
On 15 Mar 2012, at 20:23, morciuch mark_orci...@ngsltd.com wrote:

 I had similar problem on Windows Server 2008. After some research, I added
 the following JVM option to make it work:

 -Djava.net.preferIPv4Stack=true

A thread that's been dormant for 2 whole years lurches back into life...


p

 --
 View this message in context: 
 http://tomcat.10.n6.nabble.com/Socket-Error-in-tomcat-white-screen-in-browser-tp2053737p4622960.html
 Sent from the Tomcat - User mailing list archive at Nabble.com.

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


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



Re: How to specify not using a keystoreFile in server.xml when using a custom keystore?

2012-03-15 Thread Konstantin Kolinko
2012/3/16 Newel, David david.ne...@pearson.com:
 Hi,



 I'm experiencing a problem with creating an SSL Connector in Tomcat
 7.0.26. We intend to use a database-based keystore, which means that we
 are using a custom-made Provider which does not use the 'keystoreFile'
 tag. To try to prevent Tomcat from trying to open a file we specify the
 Connector in this way:



        Connector SSLEnabled=true URIEncoding=UTF-8
 clientAuth=false

            keyAlias=TestCert keystoreFile= keystoreType=Custom
 port=443

            protocol=HTTP/1.1 scheme=https secure=true
 sslProtocol=TLS/



 This used to work in Tomcat 6.0.32, but when we upgraded to Tomcat 7.0,
 this exception gets thrown in the error stream :



 SEVERE: Failed to load keystore type Custom with path E:\Program
 Files\Application\configuration\services\tomcat\ due to E:\Program
 Files\Application\configuration\services\tomcat (Access is denied)

 java.io.FileNotFoundException: E:\Program
 Files\Application\configuration\services\tomcat (Access is denied)

               at java.io.FileInputStream.open(Native Method)

               at java.io.FileInputStream.init(Unknown Source)

               at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFac
 tory.java:400)

               at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocket
 Factory.java:306)

               at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESoc
 ketFactory.java:565)

               at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESoc
 ketFactory.java:505)

               at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.init(JSSESocketFactory
 .java:449)

               at
 org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(JSSESocke
 tFactory.java:158)

               at
 org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:378)

               at
 org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:5
 54)

               at
 org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:409)

               at
 org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11J
 sseProtocol.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.ja
 va:559)

               at
 org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)

               at
 org.apache.catalina.core.StandardServer.initInternal(StandardServer.java
 :815)

               at
 org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)

               at
 org.apache.catalina.startup.Catalina.load(Catalina.java:594)

               at
 org.apache.catalina.startup.Catalina.load(Catalina.java:619)

               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)



 Is this a bug in Tomcat 7.0 or is there an alternative method we're
 supposed to use in order to prevent it from loading a keystoreFile from
 the file system?



 I took a look at the source through a debugger and found the area in
 JSSESocketFactory where it reads this file, and it seems as though
 specifying  doesn't work correctly anymore because it tries to map a
 relative path to catalina.base


I agree that this is an issue. Please file a bug in Bugzilla.

Looking at the code,
java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java#getStore(...)

if(!(PKCS11.equalsIgnoreCase(type) ||
.equalsIgnoreCase(path))) {

and that happens before appending it to CATALINA_BASE.
But in AbstractEndpoint#setKeystoreFile(String) the path is always
converted to absolute and thus the above check for  value fails to
work.


BTW, I wonder what will happen if you specify NUL (the Windows
equivalent to /dev/null) as the value.

Best regards,
Konstantin Kolinko

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



Custom WebappLoader, Jasper and custom JSP tags

2012-03-15 Thread Johannes Ernst
I've implemented my own org.apache.catalina.loader.WebappLoader. It consults a 
bunch of JARs held in the file system outside of the WAR.

One of those outside JARs contains a custom JSP tag.

When attempting to compile the JSP, Jasper fails to find it. I'm getting this:
javax.servlet.ServletException: org.apache.jasper.JasperException: Unable to 
compile class for JSP: 

An error occurred at line: 13 in the jsp file: /foobar.jsp
com.example.MyCustomTag cannot be resolved to a type
My guess is that I somehow need to tell Jasper that it should use my custom 
WebappLoader when looking for custom tags.

How would I do that? A few hours worth of poking around in the source code 
hasn't helped …

This is Tomcat 6.0.28 but any answer for any version is appreciated.

Thanks,


Johannes.


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



Re: Custom WebappLoader, Jasper and custom JSP tags

2012-03-15 Thread Konstantin Kolinko
2012/3/16 Johannes Ernst jer...@netmesh.us:
 I've implemented my own org.apache.catalina.loader.WebappLoader. It consults 
 a bunch of JARs held in the file system outside of the WAR.

 One of those outside JARs contains a custom JSP tag.

 When attempting to compile the JSP, Jasper fails to find it. I'm getting this:
 javax.servlet.ServletException: org.apache.jasper.JasperException: Unable to 
 compile class for JSP:

 An error occurred at line: 13 in the jsp file: /foobar.jsp
 com.example.MyCustomTag cannot be resolved to a type


 My guess is that I somehow need to tell Jasper that it should use my custom 
 WebappLoader when looking for custom tags.

You cannot.  Jasper is independent from Catalina.

Moreover Jasper has to pass a classpath to an external Java compiler
(ecj or javac). The classpath is constructed and passed to Jasper as
String.


 How would I do that? A few hours worth of poking around in the source code 
 hasn't helped …

 This is Tomcat 6.0.28 but any answer for any version is appreciated.


Have you looked at VirtualWebappLoader class? I would think it already
does what you are trying to do.

I think there were also several fixes to WebappClassLoader in versions
later than your 6.0.28.

Best regards,
Konstantin Kolinko

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



Re: Custom WebappLoader, Jasper and custom JSP tags

2012-03-15 Thread Johannes Ernst

On Mar 15, 2012, at 16:50, Konstantin Kolinko wrote:

 2012/3/16 Johannes Ernst jer...@netmesh.us:
 I've implemented my own org.apache.catalina.loader.WebappLoader. It consults 
 a bunch of JARs held in the file system outside of the WAR.
 
 One of those outside JARs contains a custom JSP tag.
 
 When attempting to compile the JSP, Jasper fails to find it. I'm getting 
 this:
 javax.servlet.ServletException: org.apache.jasper.JasperException: Unable to 
 compile class for JSP:
 
 An error occurred at line: 13 in the jsp file: /foobar.jsp
 com.example.MyCustomTag cannot be resolved to a type
 
 
 My guess is that I somehow need to tell Jasper that it should use my custom 
 WebappLoader when looking for custom tags.
 
 You cannot.  Jasper is independent from Catalina.

Darn …

 Moreover Jasper has to pass a classpath to an external Java compiler
 (ecj or javac). The classpath is constructed and passed to Jasper as
 String.

Could you point me to where in the code it does this? I was looking for 
invocations of something like
WebappLoader.getRepositories()
but came up empty.

 How would I do that? A few hours worth of poking around in the source code 
 hasn't helped …
 
 This is Tomcat 6.0.28 but any answer for any version is appreciated.
 
 
 Have you looked at VirtualWebappLoader class? I would think it already
 does what you are trying to do.

Does it work with custom JSP tags? If so, I fail to see where it accomplishes 
that ...

 I think there were also several fixes to WebappClassLoader in versions
 later than your 6.0.28.

Good to know, thanks.

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


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



Re: Custom WebappLoader, Jasper and custom JSP tags

2012-03-15 Thread Konstantin Kolinko
2012/3/16 Johannes Ernst jer...@netmesh.us:

 On Mar 15, 2012, at 16:50, Konstantin Kolinko wrote:

 2012/3/16 Johannes Ernst jer...@netmesh.us:
 I've implemented my own org.apache.catalina.loader.WebappLoader. It 
 consults a bunch of JARs held in the file system outside of the WAR.

 One of those outside JARs contains a custom JSP tag.

 When attempting to compile the JSP, Jasper fails to find it. I'm getting 
 this:
 javax.servlet.ServletException: org.apache.jasper.JasperException: Unable 
 to compile class for JSP:

 An error occurred at line: 13 in the jsp file: /foobar.jsp
 com.example.MyCustomTag cannot be resolved to a type


 My guess is that I somehow need to tell Jasper that it should use my custom 
 WebappLoader when looking for custom tags.

 You cannot.  Jasper is independent from Catalina.

 Darn …

 Moreover Jasper has to pass a classpath to an external Java compiler
 (ecj or javac). The classpath is constructed and passed to Jasper as
 String.

 Could you point me to where in the code it does this? I was looking for 
 invocations of something like
        WebappLoader.getRepositories()
 but came up empty.


WebappLoader is not a class loader per se. It is just a Tomcat
component that configures a class loader.  The class loader is
WebappClassLoader class.

The method is WebappClassLoader#getURLs() that returns URL[]

In Tomcat 6.0.x the following places of interest call it:

- in WebappLoader:
WebappLoader#setClassPath()

- in Jasper:
 JspRuntimeContext#initClassPath()\
 JspRuntimeContext#initSecurity()
 TldLocationsCache#scanJars()


 How would I do that? A few hours worth of poking around in the source code 
 hasn't helped …

 This is Tomcat 6.0.28 but any answer for any version is appreciated.


 Have you looked at VirtualWebappLoader class? I would think it already
 does what you are trying to do.

 Does it work with custom JSP tags? If so, I fail to see where it accomplishes 
 that ...

Yes.

Best regards,
Konstantin Kolinko

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



Re: Custom WebappLoader, Jasper and custom JSP tags

2012-03-15 Thread Johannes Ernst

On Mar 15, 2012, at 17:38, Konstantin Kolinko wrote:

 Moreover Jasper has to pass a classpath to an external Java compiler
 (ecj or javac). The classpath is constructed and passed to Jasper as
 String.
 
 Could you point me to where in the code it does this? I was looking for 
 invocations of something like
WebappLoader.getRepositories()
 but came up empty.
 
 ...
 The method is WebappClassLoader#getURLs() that returns URL[]

Is that array cached somewhere or called every time before Jasper / javac run 
again? Do I need to do something when it changes?

This list is very helpful.

 In Tomcat 6.0.x the following places of interest call it:
 
 - in WebappLoader:
 WebappLoader#setClassPath()
 
 - in Jasper:
 JspRuntimeContext#initClassPath()\
 JspRuntimeContext#initSecurity()
 TldLocationsCache#scanJars()

Where is a good breakpoint or debug switch that I could set to see with which 
class path values Jasper and javac are being invoked?

Thank you!


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



Re: Info on PermSize and MaxPermSize

2012-03-15 Thread Geet Chandra
On Thu, Mar 15, 2012 at 6:05 PM, André Warnier a...@ice-sa.com wrote:

 Geet Chandra wrote:

 Version of Tomcat is 6.0.035 As http://6.0.035.As Tomcat is being
 shipped

 with product developed, we are providing command line utility,using the
 same utility users are of product allow to change the configurable
 parameters as per application type deployed in tomcat.We are using
 utiltity.vbs as mentioned utility implementation file.Also we are
 registering tomcat as windows service while product is being installed and
 command to start tomcat as cmd.exe /c net start tomcat .Hoping everyone
 understood my requirements.

  Not really. I think one would need Pid's crystall ball to really
 understand the first part of your message above.  Let me try to dissect it
 however :


  Version of Tomcat is 6.0.035
 Ok, let's say.

 As http://6.0.035.As
 Huh ?


  Tomcat is being shipped
  with product developed,
 I think I got that.


  we are providing command line utility,using the
  same utility users are of product allow to change the configurable
  parameters as per application type deployed in tomcat.We are using
  utiltity.vbs as mentioned utility implementation file.

 Not quite sure I understand what you're talking about here.
 But I gather that you are somehow shipping Tomcat together with some
 unspecified application and some cutely-named script described in some file.
 And that this is under Windows..
 -Yes...you have guessed it correctly I am using company owned tool to
 generate separate*.msi packages   one for tomcat bits and another for bits
 for unspecified application.

  Also we are
  registering tomcat as windows service while product is being installed

 Ah. And how exactly are you doing this ?
 - As we are providing our application and tomcat as *.msi packages, we do
 include custom script to register tomcat6.exe in *.msi as postinstall task.



 First, you'd have to tell us /which/ Tomcat package, downloaded from
 where, you are shipping, and how you do this installation.
 Then you'd have to tell us which Java JVM you are also installing
 (presumably).
 And then, tell us /how/ you are doing the registration of Tomcat as a
 Windows Service.
 - I downloaded tomcat bits from  http://tomcat.apache.org/download-60.cgi,
 using Oracle Java.

   Here is code snippet for registering as Windows service
%EXECUTABLE% //IS//%SERVICE_NAME% --Install=C:\Program
Files\ProductName\nonProduct\tomcat\b\bin\tomcat6.exe --Jvm=auto
--StartMode=jvm --StopMode=jvm
--StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start
--StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop
The above code snippet is run as *.bat and being invoked from *.msi


  and
  command to start tomcat as cmd.exe /c net start tomcat .
 - As utility.vbs is being included in tomcat package(*.msi) , once tomcat
  is installed on system, this utility.vbs is placed in
 C:\Program Files\ProductName\nonProduct\tomcat\b\bin\ folder.

   Here is snippet for utility.vbs as
  - WSH_Shell.Run(cmd.exe /c net   stop  
chr(34)Servicenamechr(34),0,True)

 So my question is there way to configure mentioned parameters before
starting tomcat as Windows service.


 In your answer, please answer each question just below the question, and
 not everything at the top of the message.

 In the meantime, you could reflect on this : the people who man this forum
 are volunteers, who generally do their best to answer the questions of
 fellow Tomcat users.
 But they are not obliged to answer questions.
 And you stand a much better chance to have your questions answered
 correctly and quickly, if you make at least a little effort to ask them
 clearly and if you provide sufficient and precise information in the first
 place.
 Quite apart from your particular Tomcat issue, this is also generally a
 good strategy when talking to people you don't know, when you want
 something from them.


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




-- 
Thanks  Regards
Geet


info regarding automatic restart of webapps when modifying $CATALINA_HOME/conf/web.xml

2012-03-15 Thread Mark DeSpain
Greetings!

Just trying to do some research regarding a behavior my team observed
today.  We're using some revision of Tomcat 7.0... I don't recall the
specific version, but I can look it up if it is relevant.

Apparently when someone modifies $CATALINA_HOME/conf/web.xml, Tomcat will
reload all web applications in the container.  Unfortunately for us, this
wreaks havoc on our set of web applications since we've allowed them to
express initialization dependencies between each other that are honored on
startup (and other scenarios) but not this scenario.

So, I'm looking for more information on how one might either disable this
particular reload behavior or hook into that behavior so that we can ensure
that dependencies are reinitialized accordingly.  Can someone point me in
the right direction?  Either approach will work for us, but I'd be
interested in knowing if there is indeed a hook we can tap into.  Any input
is greatly appreciated.

Thanks!

~Mark