Re: heap memory issues

2012-06-18 Thread Miguel González Castaños



On 18/06/2012 02:45, Perry, Andrew wrote:

Try setting -XX:MaxPermSize=256m it helps with our applications, it might do 
the trick here.

What is the effect of this?

Miguel

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



Re: Apache tomcat (7.0.27) is not loading the user and role class for JAASRealm

2012-06-18 Thread javed ansari
Hi,

Thanks for the help so far.
Now my login implementation is working. I added a context.xml file in the
META-INF folder and now those two classes are being loaded. good so far.

Now I want to implement LOGOUT. For this I have a hyperlink named logout
on every page. By clicking on that I suppose logout of the LoginModule
should be called. But I do not have a handle to LoginModule class or the
LoginContext class as I am using Form Based Authentication.
below are the entry from my web.config file..

security-constraint
web-resource-collection
web-resource-nameA Protected Page/web-resource-name
url-pattern/SMARTSUI.html/url-pattern
 url-pattern/res/protected/img/*/url-pattern
/web-resource-collection

auth-constraint
role-nametomcat/role-name
/auth-constraint
/security-constraint
security-role
role-nametomcat/role-name
/security-role

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

Here j_securit_check is the owner and it routes the authentication and
authorization. It itself creates the LoginContext class and plugins into
our LoginModule class through jaas.config file.
So my question is how to call LoginModule.logout() and clear the subject
(user and role principals)?

Regards,
Javed

- Original Message -

 From: Daniel Mikusa dmik...@vmware.com
 To: Tomcat Users List users@tomcat.apache.org
 Cc:
 Sent: Wednesday, June 13, 2012 6:25 AM
 Subject: Re: Apache tomcat (7.0.27) is not loading the user and role
class for JAASRealm

 - Original Message -
  I am creating a website and implement security. For this I am using
  Form
  based authentication and JAASRealm. I have implemented the login
  module and
  able to authenticate but while authorizing tomcat is not able to load
  the
  user and role classes once I start the tomcat server.

  It gives the following error on startup (in the
  tomcat7-stderr.2012-06-13.log)
  Jun 13, 2012 4:11:47 PM org.apache.catalina.realm.
JAASRealm
  parseClassNames
  SEVERE: Class com.cogent3M.SMARTS.Core.General.SMARTSUserPrincipal
  not
  found! Class not added.
  Jun 13, 2012 4:11:47 PM org.apache.catalina.realm.JAASRealm
  parseClassNames
  SEVERE: Class com.cogent3M.SMARTS.Core.General.SMARTSRolePrincipal
  not
  found! Class not added.

 The classes mentioned above cannot be found.

 1.) What are they classes?  They are not part of Tomcat.

 2.) Have you placed the classes on the classpath somewhere?  If so, where?

 Dan




  I have taken help from
  http://blog.frankel.ch/custom-loginmodule-in-tomcat

  I tried even the sample one on the above website but gives the same
  error.
  Please let me know what am I missing.
  --
  Regards,
  Javed


WARNING
===


The following is based on Tomcat's documentation. I have not written my own
JAAS Realm, so your mileage may vary.

WARNING
===

The documentation that I'm basing this on can be found here:

http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#JAASRealm
http://tomcat.apache.org/tomcat-7.0-doc/config/realm.html

There are a few things to note from the blog post.

The place the blog tells you to put the Realm configuration is confusing at
best.

As mentioned in the blog post, you can place your Realm definition in the
Engine, Host, or Context elements. Unfortunately, the notes for the context
element is a bit misleading.

If you place your Realm definition in the Context element, it should be in
one of two places.

1. application's META-INF/context.xml
2. CATALINA_BASE/conf/Catalina/[hostname]/appname.xml.
   [hostname] is typically localhost
   appname.xml is the name of your application.xml.

I suppose you could also place the Realm definition in
CATALINA_BASE/conf/Catalina/[hostname]/context.xml.default.

Placing your classes (LoginModule and Principal) within Tomcat combined
with the above information probably follows the logic below. Again, I've
not tried this. I'm just reading the documentation.

1. If you define your JAASRealm in your application's context.xml

a. Place the LoginModule and Principle classes in WEB-INF/classes or
   WEB-INF/lib of your application
b. No special attribute needs to be set

2. If you define your JAASRealm in Engine or Host (server.xml)

a. Place the LoginModule and Principle classes in CATALINA_HOME/lib as a
jar file
b. Add the following attribute to the JAASRealm definition

   useContextClassLoader=true

This tells Tomcat to use the container classloader rather than the
application's classloader to find the classes.

An advantage of doing things the first way is that you can easily change
your JAAS implementation and just reload the web application.

An advantage of doing things the second way is that you 

Re: iis not looking for jsp in tomcat webapps folder

2012-06-18 Thread André Warnier

Vijaya wrote:
Thanks for the reply again Andre Warner. We reformatted our server and 
installed a windows, IIS, and Tomcat all over. The problem still persists.


This is what my setting is.

Our portal URL is www.eservicebazaar.com. The class, and jsp files are 
under the folder tomcat...\webapps\AtYourservice.

Under  inetpub/wwwroot all html files are copied.

When I log in to the portal using the URL 
www.eservicebazaar.com/AtYourService, the portal works fine. But if I 
move the index.html to the inetpub/wwwroot folder, and log in to the 
portal as www.eservicebazaar.com, I get the 404 error as the IIS is not 
looking at the JSP files in tomcat../AtYourservice folder through ISAPI 
redirector.


What is the content of the index.html file ? (copy and paste it here)

What is the content of the uriworkermap.properties files ? (copy and paste here)




The only thing that was the problem BEFORE IIS FAILED was our router 
link SUDDENLY WENT down and when I brought back the link, IIS stopped 
talking to ISAPI filter.


Can a bad router create this problem ?


In principle, no.  But again, we do not have direct access to your system, so we cannot 
look at what happened.





Thanks,
Vijaya

-Original Message- From: André Warnier
Sent: Wednesday, June 13, 2012 1:49 PM
To: Tomcat Users List
Subject: Re: iis not looking for jsp in tomcat webapps folder

Hi.

Quoting you :

Vijaya wrote:
Thanks for the reply Andre Warnier. It is not virus. It happened over 
the week end while the download of signatures failed. It is that IIS 
is not looking at the tomcat' webapps folder for the jsps through 
ISAPI filter. When I try to delete isapi_redirector dll, I keep 
getting the error the file is in use by another program. I'll try to 
install the latest version of tomcat and see what happens.




[...]

After a long time I am having a problem that I cannot explain why is 
it happening. Help will be very much appreciated.


Our portal www.eservicebazaar.com was working okay till last week. 
Suddenly we had the anti virus software, and link problem and after 
that the portal is not working okay.


The current setting is
In IIS 6, I have the jakarta isapi filter set  and the default 
document only as and nothing else; All the portal related files are 
moved under inetpub/wwwroot except the jspfiles. jspfiles are located 
under tomcat../webapps/esb folder.
The index.html that is located in wwwroot folder has nothing other 
than calling index.jsp from webapps directory.
Till last friday, the portal was working okay and all of us could 
login to the portal from remote machines. last saturday, our link 
went down and when I connected the link back, I am not able to login 
to the portal both locally and remotely.
the url  invokes the index.html (means the name server, iis is 
working fine) but the index.jsp gives a 404 error.
I tried all possible things like deleting the jakarta virtual 
directory, recreating the reg entries, and deleting the 
isap_redirector2.dll and copying back from the backup version. 
Nothing is working.

Can any body help me what I need to do (reinstall IIS)?




Unquote

Vijaya,
there is not much that can be done with the explanation above.
In summary :
- it was working last week, and is not working this week.
- something happened in-between, which may or may not involve a virus
- since then you have been modifying Registry entries, 
deleting/recreating files and/or

moving them around
- and still nothing is working

In normal circumstances, and to take a shortcut, I would probably tell 
you to
1) verify that Tomcat itself is working, by accessing your Tomcat 
application directly,

through Tomcat's own HTTP port
2) if Tomcat is working, then stop IIS, de-install isapi_redirector, and 
re-install it

properly according to the relevant on-line documentation.
3) and if you still have a problem then, turn on the logging feature of 
isapi_redirector,

check the logs and try to determine exactly what happens.

But, considering that you have already been making changes all over, 
including in the
Registry, it is not even certain that the isapi_redirector 
de-installation procedure can

work properly and will really clean up.

We do not have a crystal ball here, and we cannot see your real system 
setup nor what
happens to make it not work. So unless you come back here with a 
really precise and
technical description of what you are doing, what happens, including a 
copy of the

relevant log messages, there is not more we could do.

Otherwise, my recommendation would still be the same : re-install this 
machine completely.
Or use another machine, where Windows and IIS and Tomcat are a clean 
install, add
isapi_redirector, and try it out. If it works, then compare with the 
machine that does not

work.

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


Re: IP-based virtual hosting with useIPVHosts=true always goes to default host

2012-06-18 Thread Assaf Urieli
Hi all,

I solved this issue following a parallel discussion on another forum:
http://forum.linode.com/viewtopic.php?f=19t=8991

Basically, I had IPTables firewall rules rerouting port 443 traffic to port
8443, and port 80 traffic to port 8080.
This is because the tomcat6 user cannot access ports  1024 (only root can).
However, this rerouting was always rerouting to my default IP.

To solve this, I changed my iptables.conf file from:
 -A PREROUTING -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8443
 -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
 -A OUTPUT -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8443
 -A OUTPUT -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

to:
-A PREROUTING -p tcp -m tcp --dst 178.79.152.69 --dport 443 -j DNAT
--to-destination 178.79.152.69:8443
-A PREROUTING -p tcp -m tcp --dst 176.58.107.88 --dport 443 -j DNAT
--to-destination 176.58.107.88:8443
-A PREROUTING -p tcp -m tcp --dst 178.79.152.69 --dport 80 -j DNAT
--to-destination 178.79.152.69:8080
-A PREROUTING -p tcp -m tcp --dst 176.58.107.88 --dport 80 -j DNAT
--to-destination 176.58.107.88:8080
-A OUTPUT -p tcp -m tcp --src 178.79.152.69 --dport 443 -j REDIRECT
--to-ports 8443
-A OUTPUT -p tcp -m tcp --src 176.58.107.88 --dport 443 -j REDIRECT
--to-ports 8443
-A OUTPUT -p tcp -m tcp --src 178.79.152.69 --dport 80 -j REDIRECT
--to-ports 8080
-A OUTPUT -p tcp -m tcp --src 176.58.107.88 --dport 80 -j REDIRECT
--to-ports 8080


  Comment 

 And here's your first problem. You need to specifically state
 NM_CONTROLLED=no.

 Also, you need to add ONPARENT=yes to the eth0:0 interface file.

 I've included copies of the interface files in a previous message

  Comment 


Mark - unfortunately the NM_CONTROLLED and ONPARENT options don't exist in
Ubuntu, but I've solved this by rewriting my IPTables rules (see above).
Thanks for your suggestions  time taken to answer in detail.

Anyway, I've now got each of my websites serving its own SSL certificate
correctly.
When you go to:
https://www.moyshele.com/test.jsp
https://www.joli-ciel.com/test.jsp
You can see that the local IP and local name are now correct.

Thanks all for your help!
Best regards,
Assaf


RE: iis not looking for jsp in tomcat webapps folder

2012-06-18 Thread Vijaya
This is what I get in the IIS log file if I login to 
www.eservicebazaar.com/AtYourService URL

08:57:43 220.181.124.181 GET /index.html 304
08:59:08 59.92.208.214 GET /jakarta/isapi_redirector2.dll 500

This is what I get in the logfile if I log in as www.eservicebazaar.com

09:01:56 59.92.208.214 GET /usertpl/1vg104-home/stylesheet.css 404
09:01:56 59.92.208.214 GET /index.jsp 404
09:01:56 59.92.208.214 GET /favicon.ico 404
09:01:56 59.92.208.214 GET /favicon.ico 404

It looks like if I go through IIS, IIS is not recognizing ISAPI at all.

I do not have I do not uriworkermap.properties. Everything is code in 
worker2.properties.
# setup the windows application logging for the ISAPI filter
[logger.win32]
level=INFO
# Communication Channel Settings
[channel.socket:localhost:8009]
host=localhost
port=8009
# Shared memeory File Settings
[shm]
file=c:/tomcat-5.5.16/conf/jk2.shm
size=10
# Declare a tomcat worker and assign it the above declared communication channel
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# URI Mappings for atYourService web application context
# Requests for any web component (indicated by the wild card *)are despatched
# to Tomcat
[uri:/AtYourService/*]
worker=ajp13:localhost:8009
info=Mapping for AtYourService context of tomcat

index.html code is a simple code that when invoked it calls index.jsp
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 
Transitional//ENHTMLHEADTITLEeServiceBazaar.com/TITLE
META http-equiv=Content-Type content=text/html; charset=iso-8859-1
META content=Evrsoft First Page name=GENERATORLINK 
href=../../usertpl/1vg104-home/stylesheet.css type=text/css 
rel=stylesheet/HEAD
BODY bgColor=#cc
form name=loginform
   script type=text/javascript language=Javascript!--
 document.loginform.action = index.jsp;
 document.loginform.submit();
 //--/script
/form
/BODY
/HTML

Once again thanks very much for the help.

Vijaya

 

-Original Message-
From: André Warnier [mailto:a...@ice-sa.com] 
Sent: Monday, June 18, 2012 1:28 PM
To: Tomcat Users List
Subject: Re: iis not looking for jsp in tomcat webapps folder

Vijaya wrote:
 Thanks for the reply again Andre Warner. We reformatted our server and 
 installed a windows, IIS, and Tomcat all over. The problem still persists.
 
 This is what my setting is.
 
 Our portal URL is www.eservicebazaar.com. The class, and jsp files are 
 under the folder tomcat...\webapps\AtYourservice.
 Under  inetpub/wwwroot all html files are copied.
 
 When I log in to the portal using the URL 
 www.eservicebazaar.com/AtYourService, the portal works fine. But if I 
 move the index.html to the inetpub/wwwroot folder, and log in to the 
 portal as www.eservicebazaar.com, I get the 404 error as the IIS is not 
 looking at the JSP files in tomcat../AtYourservice folder through ISAPI 
 redirector.

What is the content of the index.html file ? (copy and paste it here)

What is the content of the uriworkermap.properties files ? (copy and paste here)


 
 The only thing that was the problem BEFORE IIS FAILED was our router 
 link SUDDENLY WENT down and when I brought back the link, IIS stopped 
 talking to ISAPI filter.
 
 Can a bad router create this problem ?

In principle, no.  But again, we do not have direct access to your system, so 
we cannot 
look at what happened.


 
 Thanks,
 Vijaya
 
 -Original Message- From: André Warnier
 Sent: Wednesday, June 13, 2012 1:49 PM
 To: Tomcat Users List
 Subject: Re: iis not looking for jsp in tomcat webapps folder
 
 Hi.
 
 Quoting you :
 
 Vijaya wrote:
 Thanks for the reply Andre Warnier. It is not virus. It happened over 
 the week end while the download of signatures failed. It is that IIS 
 is not looking at the tomcat' webapps folder for the jsps through 
 ISAPI filter. When I try to delete isapi_redirector dll, I keep 
 getting the error the file is in use by another program. I'll try to 
 install the latest version of tomcat and see what happens.

 
 [...]
 
 After a long time I am having a problem that I cannot explain why is 
 it happening. Help will be very much appreciated.

 Our portal www.eservicebazaar.com was working okay till last week. 
 Suddenly we had the anti virus software, and link problem and after 
 that the portal is not working okay.

 The current setting is
 In IIS 6, I have the jakarta isapi filter set  and the default 
 document only as and nothing else; All the portal related files are 
 moved under inetpub/wwwroot except the jspfiles. jspfiles are located 
 under tomcat../webapps/esb folder.
 The index.html that is located in wwwroot folder has nothing other 
 than calling index.jsp from webapps directory.
 Till last friday, the portal was working okay and all of us could 
 login to the portal from remote machines. last saturday, our link 
 went down and when I connected the link back, I am not able to login 
 to the portal both locally and remotely.
 the url  invokes the index.html (means the name server, iis is 

Re: IP-based virtual hosting with useIPVHosts=true always goes to default host

2012-06-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Assaf,

On 6/15/12 6:33 AM, Assaf Urieli wrote:
 So, the addresses to test are: http://www.joli-ciel.com/test.jsp 
 http://www.moyshele.com/test.jsp http://178.79.152.69/test.jsp 
 http://176.58.107.88/test.jsp
 
 And exactly the same four, but with HTTPS: 
 https://www.joli-ciel.com/test.jsp 
 https://www.moyshele.com/test.jsp https://178.79.152.69/test.jsp 
 https://176.58.107.88/test.jsp
 
 Now, every single one of these gives the exact same values for 
 request.getLocalName() and request.getLocalAddr(). 
 request.getLocalName(): www.joli-ciel.com request.getLocalAddr():
 178.79.152.69 And this is why, even when useIPVHosts=true, I always
 get the HTTPS Connector corresponding to 178.79.152.69, which gives
 the wrong SSL certificate for https://www.moyshele.com

 Note (in case it's relevent) that /etc/iptables.conf is mapping
 port 8080 to port 80 and port 8443 to port 443  - relevent portions
 below:  *nat 
 :PREROUTING ACCEPT [11:3512] :POSTROUTING ACCEPT [13:844] :OUTPUT
 ACCEPT [13:844] -A PREROUTING -p tcp -m tcp --dport 443 -j REDIRECT
 --to-ports 8443 -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT
 --to-ports 8080 -A OUTPUT -p tcp -m tcp --dport 443 -j REDIRECT
 --to-ports 8443 -A OUTPUT -p tcp -m tcp --dport 80 -j REDIRECT
 --to-ports 8080 COMMIT 
 

You are routing *all* traffic destined to 8080/8443-80/443 without
regard for the incoming interface. I'm not sure what iptables does
with that -- it's possible that you are re-routing everything to the
same interface which is why all your addresses look the same.

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

iEYEARECAAYFAk/fMzIACgkQ9CaO5/Lv0PAlsACgtKjLhHrCn009MPZLPXBdrvbq
wWoAoLEvyGVqw0zLJ/jRbs1PywY6hDWR
=JlkA
-END PGP SIGNATURE-

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



Re: IP-based virtual hosting with useIPVHosts=true always goes to default host

2012-06-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Assaf,

On 6/18/12 4:46 AM, Assaf Urieli wrote:
 Hi all,
 
 I solved this issue following a parallel discussion on another
 forum: http://forum.linode.com/viewtopic.php?f=19t=8991
 
 Basically, I had IPTables firewall rules rerouting port 443 traffic
 to port 8443, and port 80 traffic to port 8080. This is because the
 tomcat6 user cannot access ports  1024 (only root can). However,
 this rerouting was always rerouting to my default IP.

Aah, too late. I just made that comment elsewhere in this thread.
Sorry I didn't get back to you sooner.

Note that you can use jsvc to get Tomcat to bind to ports 1024, and
it also lets you rotate catalina.out if you need to.

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

iEYEARECAAYFAk/fM54ACgkQ9CaO5/Lv0PDD/gCfYmHnHObyQ7OdF4p4iyP5F+HU
x5gAn3uweQ1cNcFMxkYiipzKvDGO6e3F
=IfRl
-END PGP SIGNATURE-

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



Re: iis not looking for jsp in tomcat webapps folder

2012-06-18 Thread André Warnier

Vijaya,

I am not the great specialist regarding isapi_redirector for Windows, but the 
configuration that you list below looks very strange to me.  It does not seem to match the 
configuration format for isapi_redirector, which is described here :


http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html
and here :
http://tomcat.apache.org/connectors-doc/reference/iis.html

So what are you exactly using as an IIS/Tomcat Connector ?



Vijaya wrote:

This is what I get in the IIS log file if I login to 
www.eservicebazaar.com/AtYourService URL

08:57:43 220.181.124.181 GET /index.html 304
08:59:08 59.92.208.214 GET /jakarta/isapi_redirector2.dll 500

This is what I get in the logfile if I log in as www.eservicebazaar.com

09:01:56 59.92.208.214 GET /usertpl/1vg104-home/stylesheet.css 404
09:01:56 59.92.208.214 GET /index.jsp 404
09:01:56 59.92.208.214 GET /favicon.ico 404
09:01:56 59.92.208.214 GET /favicon.ico 404

It looks like if I go through IIS, IIS is not recognizing ISAPI at all.

I do not have I do not uriworkermap.properties. Everything is code in 
worker2.properties.
# setup the windows application logging for the ISAPI filter
[logger.win32]
level=INFO
# Communication Channel Settings
[channel.socket:localhost:8009]
host=localhost
port=8009
# Shared memeory File Settings
[shm]
file=c:/tomcat-5.5.16/conf/jk2.shm
size=10
# Declare a tomcat worker and assign it the above declared communication channel
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# URI Mappings for atYourService web application context
# Requests for any web component (indicated by the wild card *)are despatched
# to Tomcat
[uri:/AtYourService/*]
worker=ajp13:localhost:8009
info=Mapping for AtYourService context of tomcat

index.html code is a simple code that when invoked it calls index.jsp
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 
Transitional//ENHTMLHEADTITLEeServiceBazaar.com/TITLE
META http-equiv=Content-Type content=text/html; charset=iso-8859-1
META content=Evrsoft First Page name=GENERATORLINK 
href=../../usertpl/1vg104-home/stylesheet.css type=text/css 
rel=stylesheet/HEAD

BODY bgColor=#cc
form name=loginform
   script type=text/javascript language=Javascript!--
 document.loginform.action = index.jsp;
 document.loginform.submit();
 //--/script
/form

/BODY

/HTML

Once again thanks very much for the help.

Vijaya

 


-Original Message-
From: André Warnier [mailto:a...@ice-sa.com] 
Sent: Monday, June 18, 2012 1:28 PM

To: Tomcat Users List
Subject: Re: iis not looking for jsp in tomcat webapps folder

Vijaya wrote:
Thanks for the reply again Andre Warner. We reformatted our server and 
installed a windows, IIS, and Tomcat all over. The problem still persists.


This is what my setting is.

Our portal URL is www.eservicebazaar.com. The class, and jsp files are 
under the folder tomcat...\webapps\AtYourservice.

Under  inetpub/wwwroot all html files are copied.

When I log in to the portal using the URL 
www.eservicebazaar.com/AtYourService, the portal works fine. But if I 
move the index.html to the inetpub/wwwroot folder, and log in to the 
portal as www.eservicebazaar.com, I get the 404 error as the IIS is not 
looking at the JSP files in tomcat../AtYourservice folder through ISAPI 
redirector.


What is the content of the index.html file ? (copy and paste it here)

What is the content of the uriworkermap.properties files ? (copy and paste here)


The only thing that was the problem BEFORE IIS FAILED was our router 
link SUDDENLY WENT down and when I brought back the link, IIS stopped 
talking to ISAPI filter.


Can a bad router create this problem ?


In principle, no.  But again, we do not have direct access to your system, so we cannot 
look at what happened.




Thanks,
Vijaya

-Original Message- From: André Warnier
Sent: Wednesday, June 13, 2012 1:49 PM
To: Tomcat Users List
Subject: Re: iis not looking for jsp in tomcat webapps folder

Hi.

Quoting you :

Vijaya wrote:
Thanks for the reply Andre Warnier. It is not virus. It happened over 
the week end while the download of signatures failed. It is that IIS 
is not looking at the tomcat' webapps folder for the jsps through 
ISAPI filter. When I try to delete isapi_redirector dll, I keep 
getting the error the file is in use by another program. I'll try to 
install the latest version of tomcat and see what happens.



[...]

After a long time I am having a problem that I cannot explain why is 
it happening. Help will be very much appreciated.


Our portal www.eservicebazaar.com was working okay till last week. 
Suddenly we had the anti virus software, and link problem and after 
that the portal is not working okay.


The current setting is
In IIS 6, I have the jakarta isapi filter set  and the default 
document only as and nothing else; All the portal related files are 
moved under inetpub/wwwroot except the jspfiles. jspfiles are located 
under tomcat../webapps/esb folder.
The 

RE: iis not looking for jsp in tomcat webapps folder

2012-06-18 Thread Leo Donahue - PLANDEVX
 -Original Message-
 From: Vijaya [mailto:svij...@solutionscraft.com]
 Subject: iis not looking for jsp in tomcat webapps folder
 
 The current setting is
 In IIS 6, I have the jakarta isapi filter set  and the default document
 only as and nothing else; 

Do you have a web service extension for Jarkata that is set to allowed?

Leo

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



Running Tomcat in a jvm with an EJB container...

2012-06-18 Thread Tony Anecito
Hi All,
 
Is it possible to run Tomcat in the same jvm as JBoss and if so how to do that? 
I am using the latest versions of both and usually run in separate jvms but 
want to see if it can they can run together in the same jvm so I can compare 
response times for both configurations. Since JBoss is usually several minor 
versions behind on it's embedded Tomcat server I usually run them in different 
jvms so I can use the latest versions of each.
 
Thanks!
-Tony

Re: Running Tomcat in a jvm with an EJB container...

2012-06-18 Thread Jose María Zaragoza
2012/6/18 Tony Anecito adanec...@yahoo.com:
 Hi All,

 Since JBoss is usually several minor versions behind on it's embedded Tomcat 
 server I usually run them in different jvms so I can use the latest versions 
 of each.


Are you interested on any particular feature in latest releases of
Tomcat and you cannot find it at JBoss ?

Regards

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



Tomcat not starting properly on a customer's AS/400, and I have no idea why. Help?

2012-06-18 Thread James Lampert
We're attempting to bring up apache-tomcat-7.0.25.zip on a customer's 
AS/400, the same as we've done on several other AS/400s (including our 
own), and it's not working.


In catalina.out, I'm seeing this:

Jun 18, 2012 11:36:23 AM org.apache.catalina.core.AprLifecycleListener init 
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /QSYS.LIB/QSHELL.LIB:/QSYS.LIB/LTL38.LIB:/QSYS.LIB/ERBLIB.LIB:/QSYS.LIB/ERBQGPL.LIB:/QSYS.LIB/SEQUEL.LIB:/QSYS.LIB/SEQUELWI.LIB:/QSYS.LIB/SEQUELEX.LIB:/QSYS.LIB/ESEND.LIB:/QSYS.LIB/QTEMP.LIB:/QSYS.LIB/QGPL.LIB:/QSYS.LIB/QRPG.LIB:/QSYS.LIB/QIDU.LIB:/QSYS.LIB/TAATOOL.LIB:/QSYS.LIB/ALKWIN.LIB:/QSYS.LIB/OMNISITE.LIB:/QSYS.LIB/OMNIFIXES.LIB:/QSYS.LIB/OMNITRACS.LIB:/QSYS.LIB/OMNIDATA.LIB:/QSYS.LIB/OMNINATL.LIB:/QSYS.LIB/LIBEXPAT.LIB:/QSYS.LIB/LIBFTP.LIB:/QSYS.LIB/ACCLIB.LIB
Jun 18, 2012 11:36:26 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [http-bio-1093]
Jun 18, 2012 11:36:26 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [ajp-bio-8009] 
Jun 18, 2012 11:36:26 AM org.apache.catalina.startup.Catalina load  
INFO: Initialization processed in 3280 ms   
Jun 18, 2012 11:36:26 AM org.apache.catalina.core.StandardService startInternal 
INFO: Starting service Catalina 
Jun 18, 2012 11:36:26 AM org.apache.catalina.core.StandardEngine startInternal  
INFO: Starting Servlet Engine: Apache Tomcat/7.0.25 
Jun 18, 2012 11:36:26 AM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory /wintouch/tomcat/webapps/ROOT 
Jun 18, 2012 11:36:27 AM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:  
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at java.lang.Throwable.init(Throwable.java:218)  
at java.lang.Throwable.init(Throwable.java:218) 
at java.lang.Exception.init(Exception.java:59)  
at org.apache.catalina.LifecycleException.init(LifecycleException.java:74)  
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)   
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)  
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)   
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)   
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
at java.util.concurrent.FutureTask.run(FutureTask.java:138)   
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)  
Caused by: java.lang.ArrayStoreException   
at java.lang.Throwable.init(Throwable.java:181) 
at java.lang.Exception.init(Exception.java:29)  
at java.lang.RuntimeException.init(RuntimeException.java:32)
at java.lang.ArrayStoreException.init(ArrayStoreException.java:29)   
at java.util.Arrays.copyOf(Arrays.java:2883)   
at java.lang.StringCoding.encode(StringCoding.java:277)

Re: Tomcat not starting properly on a customer's AS/400, and I have no idea why. Help?

2012-06-18 Thread Konstantin Kolinko
2012/6/18 James Lampert jam...@touchtonecorp.com:
 We're attempting to bring up apache-tomcat-7.0.25.zip on a customer's
 AS/400, the same as we've done on several other AS/400s (including our own),
 and it's not working.

 In catalina.out, I'm seeing this:

 Jun 18, 2012 11:36:23 AM org.apache.catalina.core.AprLifecycleListener
 init                                                         INFO: The APR
 based Apache Tomcat Native library which allows optimal performance in
 production environments was not found on the java.library.path:
 /QSYS.LIB/QSHELL.LIB:/QSYS.LIB/LTL38.LIB:/QSYS.LIB/ERBLIB.LIB:/QSYS.LIB/ERBQGPL.LIB:/QSYS.LIB/SEQUEL.LIB:/QSYS.LIB/SEQUELWI.LIB:/QSYS.LIB/SEQUELEX.LIB:/QSYS.LIB/ESEND.LIB:/QSYS.LIB/QTEMP.LIB:/QSYS.LIB/QGPL.LIB:/QSYS.LIB/QRPG.LIB:/QSYS.LIB/QIDU.LIB:/QSYS.LIB/TAATOOL.LIB:/QSYS.LIB/ALKWIN.LIB:/QSYS.LIB/OMNISITE.LIB:/QSYS.LIB/OMNIFIXES.LIB:/QSYS.LIB/OMNITRACS.LIB:/QSYS.LIB/OMNIDATA.LIB:/QSYS.LIB/OMNINATL.LIB:/QSYS.LIB/LIBEXPAT.LIB:/QSYS.LIB/LIBFTP.LIB:/QSYS.LIB/ACCLIB.LIB

[[[
 Caused by: java.lang.ArrayStoreException
 at java.lang.Throwable.init(Throwable.java:181)
 at java.lang.Exception.init(Exception.java:29)
 at java.lang.RuntimeException.init(RuntimeException.java:32)
 at java.lang.RuntimeException.init(RuntimeException.java:32)
 at java.lang.ArrayStoreException.init(ArrayStoreException.java:29)
 at java.util.Arrays.copyOf(Arrays.java:2883)
 at java.lang.StringCoding.encode(StringCoding.java:277)
 at java.lang.String.getBytes(String.java:1691)
 at org.apache.catalina.util.RequestUtil.URLDecode(RequestUtil.java:254)
 at org.apache.catalina.util.RequestUtil.URLDecode(RequestUtil.java:231)
 at org.apache.catalina.util.RequestUtil.URLDecode(RequestUtil.java:216)
 at 
 org.apache.catalina.deploy.SecurityCollection.addPattern(SecurityCollection.java:229)
   ]]]

The exception that I cited from your log fragment is just crazy.
The code in RequestUtil.URLDecode(RequestUtil.java:254) in 7.0.25 is:

   bytes = str.getBytes(Charset.defaultCharset());

The String.getBytes(Charset) call, where all parameters are standard
classes, provided by JRE.  Yet this standard method fails in a crazy
way (java.lang.ArrayStoreException. It means types mismatch
encountered when putting a new element into array).

Your JRE is broken.

Try running a simple java program that calls the above method and see
what happens.

Just guessing at straws: you may try to simplify your environment (do
you need all that libraries as mentioned in  java.library.path?  what
is your default charset?)

I wonder whether you have several copies of JRE classes loaded by
different classloaders.

Best regards,
Konstantin Kolinko

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



Re: Running Tomcat in a jvm with an EJB container...

2012-06-18 Thread Tony Anecito
Actually I am trying to keep the same exact tomcat builds so I eliminate that 
as a cause for differences in my test results.
 
Thanks!
-Tony

--- On Mon, 6/18/12, Jose María Zaragoza demablo...@gmail.com wrote:


From: Jose María Zaragoza demablo...@gmail.com
Subject: Re: Running Tomcat in a jvm with an EJB container...
To: Tomcat Users List users@tomcat.apache.org
Date: Monday, June 18, 2012, 10:07 AM


2012/6/18 Tony Anecito adanec...@yahoo.com:
 Hi All,

 Since JBoss is usually several minor versions behind on it's embedded Tomcat 
 server I usually run them in different jvms so I can use the latest versions 
 of each.


Are you interested on any particular feature in latest releases of
Tomcat and you cannot find it at JBoss ?

Regards

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



Re: Tomcat pausing and no java process

2012-06-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Miguel,

(Bringing this back onto the list)

On 6/17/12 5:11 AM, Miguel González Castaños wrote:
 This weekend I made a test to upgrade from 1.5 32 bits jdk to a 1.7
 64 bits jdk. Unfortunately even I increase the heap memory to 1gb,
 the system gets an outofmemory error after 10-15 minutes of being
 idle

Going from a 32-bit JVM to a 64-bit JVM is likely to *increase* your
webapp's memory needs even with the same heap size. The reason is that
all pointers (both native and Java references) will be double-wide
with respect to a 32-bit JVM. You can run with compressed OOPs but
that doesn't cover the JVM itself: you will necessarily require more
memory to run a 64-bit JVM.

If your webapp runs out of memory after 15 minutes of idle time, then
something is terribly wrong. I would take the following steps:

1. Except for -Xmx (and maybe -Xms), remove *all* heap-related settings
   from your JVM launch command. Your existing settings look like
   failed attempts to solve a memory leak within the webapp.

2. Launch your webapp in a safe environment (you *do* have an
   environment identical to production where you can to testing like
   this, right?) and let it sit idle. Take a thread dump and see
   if any threads exist that you aren't expecting: that is, something
   other than a bunch of idle request-processor threads. Maybe your
   webapp performs some kind of background operation periodically,
   and that's okay too. Anything you don't recognize: investigate.

3. Take heap dumps at intervals or maybe 5 minutes (that should give
   you 3 heap dumps before your idle webapp fails and the JVM
   dies). Load-up those heap-dumps in a heap-analysis tool and
   look for differences. Maybe you'll find out that you have a million
   foo.bar.Cache objects being created every minute or something.
   Obviously investigate those.

4. Once you can get your webapp to be stable during /idle/ time, run a
   load-test against it (you *do* have a load-test for your webapp,
   right?) and repeat step #3 above.

Using these steps, you ought to be able to identify and fix 90% of
memory leaks with very little trouble.

 Now I have installed a 1.7 32 bits jdk and leave the heap memory to
 what it was with 1.5 32 bits jdk:  Xms128m and Xmx512m. It seems to
 be stable.
 
 Unfortunately this heap size proofed last week not being enough. I 
 analyzed the heap dumps and I have realized there is a process that
 eats up 200-300 mb. This thread what it does is to load a 5k-10k
 objects in memory that represent an email and other info that is
 used to send emails to our clients. From my perspective of an old
 coder that tried to use memory as less as I could loading such big
 number of objects to send 200-300 emails an hour doesn't scale.
 Specially if this company expects to grow in the future and send
 more emails.

Agreed. You might want to separate this email thing into a separate
process, so that if/when it takes up a lot of memory and dies, it
doesn't bring-down your webapp at the same time.

 As I see it, increasing the heap is not the solution, but it can be
 a patch until we get another programmer on board and can refactor
 the code. Also the owners want to have the impression that the
 webapp is stable again and feel secure to perform next steps: get a
 bigger dedicated server (not a virtual one) and get a new
 programmer/company to do things more professionally.

Good plan. Otherwise, you will not have a stable product. Investing in
identifying and fixing whatever is wrong is money well-spent.

 So the question is, how can I increase the heap? Any log that give
 me any clue? I have separated gc.log to see how the young, perm and
 old generations numbers evolve.

You want to increase the heap? You just need to use -Xmx. You can use
jconsole or even jmap to ask the JVM what the effective heap size is
once it has been launched.

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

iEYEARECAAYFAk/faF0ACgkQ9CaO5/Lv0PCM/wCgmYWZb47/twSvlgPn6d2y4Dlq
rs0AoK7ouint5uVkx3kaFsRZ8W68uBeK
=qSCj
-END PGP SIGNATURE-

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



Re: Tomcat not starting properly on a customer's AS/400, and I have no idea why. Help?

2012-06-18 Thread James Lampert

/QSYS.LIB/QSHELL.LIB:/QSYS.LIB/LTL38.LIB:/QSYS.LIB/ERBLIB.LIB:/QSYS.LIB/ERBQGPL.LIB:/QSYS.LIB/SEQUEL.LIB:/QSYS.LIB/SEQUELWI.LIB:/QSYS.LIB/SEQUELEX.LIB:/QSYS.LIB/ESEND.LIB:/QSYS.LIB/QTEMP.LIB:/QSYS.LIB/QGPL.LIB:/QSYS.LIB/QRPG.LIB:/QSYS.LIB/QIDU.LIB:/QSYS.LIB/TAATOOL.LIB:/QSYS.LIB/ALKWIN.LIB:/QSYS.LIB/OMNISITE.LIB:/QSYS.LIB/OMNIFIXES.LIB:/QSYS.LIB/OMNITRACS.LIB:/QSYS.LIB/OMNIDATA.LIB:/QSYS.LIB/OMNINATL.LIB:/QSYS.LIB/LIBEXPAT.LIB:/QSYS.LIB/LIBFTP.LIB:/QSYS.LIB/ACCLIB.LIB


Konstantin Kolinko wrote:

Just guessing at straws: you may try to simplify your environment (do
you need all that libraries as mentioned in  java.library.path?  what
is your default charset?)


Hmm. This is interesting. The value shown for java.library.path seems to 
be the product and user portions of the job's library list (an 
AS/400-specific concept analogous to the path in DOS, WinDoze, or 
Linux, or to a Java classpath) at the time the job was launched.


Comparing the same message on our own AS/400, I see

QSYS.LIB:/QSYS.LIB/QSYS2.LIB:/QSYS.LIB/QHLPSYS.LIB:/QSYS.LIB/QUSRSYS.LIB:/QSYS.LIB/QSHELL.LIB:/QSYS.LIB/WTI1###.LIB:/QSYS.LIB/WINTOUCH.LIB:/QSYS.LIB/QGPL.LIB:/QSYS.LIB/QTEMP.LIB:/QSYS.LIB/AQUESTVIEW.LIB:/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/jre/lib/ppc:/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/jre/lib/ppc/classic:/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/jre/lib/ppc/default


which is the system, product, and user portions of the job's 
library list, followed by three Java-related directories in the 
integrated file system.


I just tried shutting down Tomcat, removing most of the contents of the 
library list, and restarting it. No change, and I did a bit of digging: 
it seems that a system setting on the problem box appears to be causing 
jobs to be submitted with the default user portion of the library 
list, rather than that of the submitting job. Interesting. This calls 
for further study.


--
JHHL

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



Re: Running Tomcat in a jvm with an EJB container...

2012-06-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tony,

On 6/18/12 11:55 AM, Tony Anecito wrote:
 Is it possible to run Tomcat in the same jvm as JBoss and if so
 how to do that? I am using the latest versions of both and usually
 run in separate jvms but want to see if it can they can run
 together in the same jvm so I can compare response times for both
 configurations. Since JBoss is usually several minor versions
 behind on it's embedded Tomcat server I usually run them in
 different jvms so I can use the latest versions of each.

You don't need to run them in the same JVM to compare response times
between them. Why do you want to run them in the same JVM?

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

iEYEARECAAYFAk/febYACgkQ9CaO5/Lv0PAl6wCcCHRJ31hTvCnU7BwSdrJs4uni
Iv0AoJyxtqngGA4p8W8yjFPAWNqxyDsZ
=1oso
-END PGP SIGNATURE-

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



Re: heap memory issues

2012-06-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andrew,

On 6/17/12 8:45 PM, Perry, Andrew wrote:
 Try setting -XX:MaxPermSize=256m it helps with our applications,
 it might do the trick here.

Please don't just make random suggestions. This almost certainly has
nothing to do with PermGem exhaustion. From the OP, they are loading
100% of their emails to send into memory all at once, which is obviously
foolish. They are running out of heap, not PermGen.

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

iEYEARECAAYFAk/fejUACgkQ9CaO5/Lv0PD8dQCfePofYBSlOaalCf6pvOkBsPSa
fV0AoK4v2j3Z98xcezuYbiEDHJMyiTJR
=DxsB
-END PGP SIGNATURE-

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



RE: Running Tomcat in a jvm with an EJB container...

2012-06-18 Thread Martin Gainty

Tony-

JBOSS v5.1 is implementing a catalina connector whose servlet-spec is at 
*LEAST* 1 full version older than the servlet-spec of that TC 7 support for 
Specification-Version: 3.0

Servlet spec version for the JBOSS 5.1 connector

org.jboss.mx.server.ServerConstants interface
/*** The specification version of the implementation. This value can be 
retrieved from the MBean server delegate. */
   final static String SPECIFICATION_VERSION  = 1.2 Maintenance 
Release;

Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.


 From: demablo...@gmail.com
 Date: Mon, 18 Jun 2012 18:07:28 +0200
 Subject: Re: Running Tomcat in a jvm with an EJB container...
 To: users@tomcat.apache.org
 
 2012/6/18 Tony Anecito adanec...@yahoo.com:
  Hi All,
 
  Since JBoss is usually several minor versions behind on it's embedded 
  Tomcat server I usually run them in different jvms so I can use the latest 
  versions of each.
 
 
 Are you interested on any particular feature in latest releases of
 Tomcat and you cannot find it at JBoss ?
 
 Regards
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
  

RE: Running Tomcat in a jvm with an EJB container...

2012-06-18 Thread Tony Anecito
Thanks Martin,
 
I am using JBoss 7.1.1 final in standalone mode and both that and Tomcat in jdk 
1.7.0_05 64-bit. I am just trying to find out about the interprocess 
communication response time.
 
Thanks,
-Tony

--- On Mon, 6/18/12, Martin Gainty mgai...@hotmail.com wrote:


From: Martin Gainty mgai...@hotmail.com
Subject: RE: Running Tomcat in a jvm with an EJB container...
To: Tomcat Users List users@tomcat.apache.org, adanec...@yahoo.com
Date: Monday, June 18, 2012, 1:31 PM



Tony-

JBOSS v5.1 is implementing a catalina connector whose servlet-spec is at 
*LEAST* 1 full version older than the servlet-spec of that TC 7 support for 
Specification-Version: 3.0

Servlet spec version for the JBOSS 5.1 connector

org.jboss.mx.server.ServerConstants interface
/*** The specification version of the implementation. This value can be 
retrieved from the MBean server delegate. */
   final static String SPECIFICATION_VERSION              = 1.2 Maintenance 
Release;

Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.


 From: demablo...@gmail.com
 Date: Mon, 18 Jun 2012 18:07:28 +0200
 Subject: Re: Running Tomcat in a jvm with an EJB container...
 To: users@tomcat.apache.org
 
 2012/6/18 Tony Anecito adanec...@yahoo.com:
  Hi All,
 
  Since JBoss is usually several minor versions behind on it's embedded 
  Tomcat server I usually run them in different jvms so I can use the latest 
  versions of each.
 
 
 Are you interested on any particular feature in latest releases of
 Tomcat and you cannot find it at JBoss ?
 
 Regards
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
              

Re: Modify HTTP status returned by stopped context

2012-06-18 Thread kharper2
Chris et. al.,

Thank you for the direction.  I created my own servlet which loads without
error.  Here is how I've configured it:

servlet
  servlet-nameHttpResponseAdjuster/servlet-name
  servlet-classbla.bla.tomcat.ReturnNotAvailableServlet/servlet-class
  load-on-startup1/load-on-startup
/servlet

servlet-mapping
  servlet-nameHttpResponseAdjuster/servlet-name
  url-pattern/foo/*/url-pattern
/servlet-mapping

servlet-mapping
  servlet-nameHttpResponseAdjuster/servlet-name
  url-pattern/Testing/*/url-pattern
/servlet-mapping

Unfortunately, when I stop the foo context, tomcat is still returning the
default HTTP 404 page.  It doesn't appear to give any consideration to the
servlet mapping in my ROOT context.  Unless I've configured something
wrong, it appears the desired behavior (to look for /Context first, then a
ROOT servlet with mapping of /Context/*) isn't happening.

You'll notice I setup another servlet-mapping called /Testing/*.  Testing
is NOT a context.  When I go to myserver:8080/Testing my servlet handles
the request and does what I desire (HTTP 503).  To reiterate, my version of
tomcat is 6.0.24.  Perhaps the logic we're relying on wasn't introduced
until later?  Or maybe I'm missing a configuration option at a higher level
to send failed requests to search the ROOT context for mappings?

I'm open to any ideas or alternate solutions at this point.

Thank you.

Kyle Harper




From:   Christopher Schultz ch...@christopherschultz.net
To: Tomcat Users List users@tomcat.apache.org
Date:   06/15/2012 05:05 PM
Subject:Re: Modify HTTP status returned by stopped context



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Kyle,

On 6/15/12 12:30 PM, kharp...@oreillyauto.com wrote:
 I attempted to do what you prescribed but I am running into a snag
 and can't figure out what I've done incorrectly.

 I have a context, we'll call it /foo

 In my ROOT web application (/) I created a servlet with a mapping
 of /foo/* like so: servlet
 servlet-namefoo-404-change/servlet-name


servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class

I

don't think you'll want to use the DefaultServlet for this purpose.

Try defining your own servlet that merely returns a 503 response. This
is better done as a servlet than a JSP, anyway.

 servlet-mapping servlet-namefoo-404-change/servlet-name
 url-pattern/foo/*/url-pattern /servlet-mapping

 I've created a simple JSP to respond with a 503.  We'll call it
 change-status.jsp.  If I call this page, it works fine.  However,
 when I stop the context /foo, and attempt to reach /foo/whatever, I
 still get a 404 as if my servlet isn't even trying to handle the
 request.

 I thought maybe I needed to specify an error page so that ROOT
 would know what to do with a 404, so I setup the following in the
 ROOT web app's web.xml: error-page error-code404/error-code
 location/change-status.jsp/location

Don't map 404: just map /foo/* to your foo-404-change servlet and
leave it at that.

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

iEYEARECAAYFAk/bsAwACgkQ9CaO5/Lv0PAdOgCfdMi3jVdXL/mQ1qtBkZG9bSAt
TN0Ani5zPBO2eVCjHn+SGwbOBu93OXmP
=2vo8
-END PGP SIGNATURE-

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


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



This communication and any attachments are confidential, protected by 
Communications Privacy Act 18 USCS § 2510, solely for the use of the intended 
recipient, and may contain legally privileged material. If you are not the 
intended recipient, please return or destroy it immediately. Thank you.

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



Re: iis not looking for jsp in tomcat webapps folder

2012-06-18 Thread Pid
On 18/06/2012 10:10, Vijaya wrote:

 file=c:/tomcat-5.5.16/conf/jk2.shm

So... tomcat-5.5.16 AND jk2?


I had to blow the dust of the 5.x security page...

http://tomcat.apache.org/security-5.html#Fixed_in_Apache_Tomcat_5.5.16,_5.0.SVN


just sayin'


p

-- 

[key:62590808]





signature.asc
Description: OpenPGP digital signature


Re: Tomcat not starting properly on a customer's AS/400, and I have no idea why. Help?

2012-06-18 Thread James Lampert

Found the problem:

The lines
# Java 6 settings if needed 
export -s JAVA_HOME=/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/jre  
export -s CATALINA_HOME=/wintouch/tomcat
export -s JAVA_OPTS=-Dos400.awt.native=true -Djava.awt.headless=true -Djava.version=1.6 -Xms256m -Xmx512m 
(which have been necessary in every AS/400 Tomcat installation I've 
participated in) were missing.


I've been told that there is a more elegant place to put them than in 
catalina.sh, but I can't remember *where* I was told to put them, and if 
just sticking them in catalina.sh is considered a bad practice, I'd like 
very much to switch to the preferred place for these lines.


--
JHHL

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



Re: Tomcat not starting properly on a customer's AS/400, and I have no idea why. Help?

2012-06-18 Thread Mark Thomas
On 18/06/2012 22:02, James Lampert wrote:
 Found the problem:
 
 The lines
 # Java 6 settings if
 needed   
  
 export -s
 JAVA_HOME=/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/jre 
 
 export -s
 CATALINA_HOME=/wintouch/tomcat   
 
 export -s JAVA_OPTS=-Dos400.awt.native=true -Djava.awt.headless=true
 -Djava.version=1.6 -Xms256m -Xmx512m 
 (which have been necessary in every AS/400 Tomcat installation I've
 participated in) were missing.
 
 I've been told that there is a more elegant place to put them than in
 catalina.sh, but I can't remember *where* I was told to put them, and if
 just sticking them in catalina.sh is considered a bad practice, I'd like
 very much to switch to the preferred place for these lines.

Create setenv.sh and put them in there.

Mark

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



Re: Tomcat not starting properly on a customer's AS/400, and I have no idea why. Help?

2012-06-18 Thread James Lampert

Mark Thomas wrote:

On 18/06/2012 22:02, James Lampert wrote:

Found the problem:

The lines

# Java 6 settings if
needed
export -s
JAVA_HOME=/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/jre 
export -s
CATALINA_HOME=/wintouch/tomcat   
export -s JAVA_OPTS=-Dos400.awt.native=true -Djava.awt.headless=true
-Djava.version=1.6 -Xms256m -Xmx512m 

(which have been necessary in every AS/400 Tomcat installation I've
participated in) were missing.

I've been told that there is a more elegant place to put them than in
catalina.sh, but I can't remember *where* I was told to put them, and if
just sticking them in catalina.sh is considered a bad practice, I'd like
very much to switch to the preferred place for these lines.


Create setenv.sh and put them in there.


Thanks. I'll try it shortly.

--
JHHL

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



RE: Tomcat not starting properly on a customer's AS/400, and I have no idea why. Help?

2012-06-18 Thread Hedrick, Brooke - 43

 -Original Message-
 From: James Lampert [mailto:jam...@touchtonecorp.com]
 Sent: Monday, June 18, 2012 4:03 PM
 To: Tomcat Users List
 Subject: Re: Tomcat not starting properly on a customer's AS/400, and I have
 no idea why. Help?
 
 Found the problem:
 
 The lines
  # Java 6 settings if needed
  export -s
 JAVA_HOME=/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/jre
  export -s CATALINA_HOME=/wintouch/tomcat
  export -s JAVA_OPTS=-Dos400.awt.native=true -Djava.awt.headless=true
 -Djava.version=1.6 -Xms256m -Xmx512m
 (which have been necessary in every AS/400 Tomcat installation I've
 participated in) were missing.
 
 I've been told that there is a more elegant place to put them than in
 catalina.sh, but I can't remember *where* I was told to put them, and if just
 sticking them in catalina.sh is considered a bad practice, I'd like very much 
 to
 switch to the preferred place for these lines.
 

On linux I use CATALINA_BASE/bin/setenv.sh



 --
 JHHL
 
 -
 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 not starting properly on a customer's AS/400, and I have no idea why. Help?

2012-06-18 Thread James Lampert

# Java 6 settings if needed
export -s JAVA_HOME=/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/jre
export -s CATALINA_HOME=/wintouch/tomcat
export -s JAVA_OPTS=-Dos400.awt.native=true -Djava.awt.headless=true 
-Djava.version=1.6 -Xms256m -Xmx512m


I just tried moving them out of bin/catalina.sh and into bin/setenv.sh 
on our production AS/400, and restarted Tomcat, and everything continues 
to work just fine.


Thanks to both who gave me the answer, and especially thanks for not 
screaming at me for mucking about in catalina.sh without knowing what 
I'm doing.


--
JHHL

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



Re: heap memory issues

2012-06-18 Thread Miguel González Castaños

On 18/06/2012 09:52, Konstantin Kolinko wrote:

2012/6/16 Miguel González Castañosmiguel_3_gonza...@yahoo.es:

Dear all,

   We have a webapp under Tomcat 5.5 and jdk 1.5 32 bits under a virtual
machine of 4 Gb and a 64 bits OS.

4 Gb is memory size?

Yes



   Some of you have helped me suggesting me to install Javamelody and sar to
monitor the system. Setting up heap dumps I have managed to see what was
going on with the eclipse memory analyzer.

   The webapp sends emails that have been previously entered into the
database. It loads the emails into memory, so if you are sending 10k emails,
it loads 10k objects containing those emails. That makes the app to use
around 200-300 mb of the heap memory.

Do you need to keep 10k of them in the memory at the same time?
Usually one would send mails one by one and release their memory
immediately.
I don't. Fortunately the developer has corrected this, so probably other 
issues will arise but not this one.




  The settings we have now for the JDK are:

  CATALINA_OPTS=$CATALINA_OPTS -XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/opt/tomcat5/logs/ -Xms128m -Xmx512m -verbose:gc
-XX:+PrintGCTimeStamps -XX:+PrintGCDetails

  Facts that I have witnessed:

  If I try to increase the Xmx to 740m or 1024m the GC starts working very
much and Tomcat shuts down.

GC? Or OS memory swapping?

GC, no swapping reported by sar.



  I have also tried downloading a 64 bits 1.7 jdk but I get the typical:

  Java HotSpot(TM) 64-Bit Server VM warning: Exception
java.lang.OutOfMemoryError occurred dispatching signal SIGTERM to handler-
the VM may need to be forcibly terminated

64-bit JVM usually needs more memory than 32-bit one,  because memory
address range is wider and pointers need more memory.
I know, but how do I know how much ram to assign in a 64 bits jdk? We 
are planning to move to a bigger server (hopefully 16 or 32 gb).


Miguel

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



Re: iis not looking for jsp in tomcat webapps folder

2012-06-18 Thread André Warnier

Pid wrote:

On 18/06/2012 10:10, Vijaya wrote:


file=c:/tomcat-5.5.16/conf/jk2.shm


So... tomcat-5.5.16 AND jk2?


I had to blow the dust of the 5.x security page...

http://tomcat.apache.org/security-5.html#Fixed_in_Apache_Tomcat_5.5.16,_5.0.SVN


just sayin'



And no easier to find : 
http://archive.apache.org/dist/tomcat/tomcat-connectors/jk2/
shows that the last release of mod_jk2 was in 2002.

Vijaya, how old is that system which you are trying to get back to work again ?
the mod_jk2 connector, which you are apparently using, has not been developed or 
maintained for quite a while.  Maybe you'd like to install and configure mod_jk instead ?

Then we could also really help you (if the on-line documentation is not 
sufficient).
There is not a big difference in the concept between mod_jk2 and mod_jk.
Start looking here : 
http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html




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



RE: heap memory issues

2012-06-18 Thread Martin Gainty

Chris Hansen sugire:

Thread maximum stack size 2m
Initial stack is 32m
Initial PermGen 32m
Max PermGen 200m
Max Heap at 367 M
Allow Concurrent Mark and Sweep
CMS ClassUnloading enabled
-Xss2m 
-Xms32m 
-XX:PermSize=32m 
-XX:MaxPermSize=200m 
-Xverify:none 
-Xmx367m 
-XX:+UseConcMarkSweepGC 
-XX:+CMSClassUnloadingEnabled 


http://my.opera.com/karmazilla/blog/2007/03/13/good-riddance-permgen-outofmemoryerror?cid=2666067#comment2666067
http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.60%2Fdiag%2Fappendixes%2Fcmdline%2Fcommands_jvm.html

Saludos Cordiales,
Martin 
__ 
Porfavor..no altere esta communicacion..Gracias


 Date: Tue, 19 Jun 2012 00:34:46 +0200
 From: miguel_3_gonza...@yahoo.es
 To: users@tomcat.apache.org
 Subject: Re: heap memory issues
 
 On 18/06/2012 09:52, Konstantin Kolinko wrote:
  2012/6/16 Miguel González Castañosmiguel_3_gonza...@yahoo.es:
  Dear all,
 
 We have a webapp under Tomcat 5.5 and jdk 1.5 32 bits under a virtual
  machine of 4 Gb and a 64 bits OS.
  4 Gb is memory size?
 Yes
 
 Some of you have helped me suggesting me to install Javamelody and sar 
  to
  monitor the system. Setting up heap dumps I have managed to see what was
  going on with the eclipse memory analyzer.
 
 The webapp sends emails that have been previously entered into the
  database. It loads the emails into memory, so if you are sending 10k 
  emails,
  it loads 10k objects containing those emails. That makes the app to use
  around 200-300 mb of the heap memory.
  Do you need to keep 10k of them in the memory at the same time?
  Usually one would send mails one by one and release their memory
  immediately.
 I don't. Fortunately the developer has corrected this, so probably other 
 issues will arise but not this one.
 
 
The settings we have now for the JDK are:
 
CATALINA_OPTS=$CATALINA_OPTS -XX:+HeapDumpOnOutOfMemoryError
  -XX:HeapDumpPath=/opt/tomcat5/logs/ -Xms128m -Xmx512m -verbose:gc
  -XX:+PrintGCTimeStamps -XX:+PrintGCDetails
 
Facts that I have witnessed:
 
If I try to increase the Xmx to 740m or 1024m the GC starts working very
  much and Tomcat shuts down.
  GC? Or OS memory swapping?
 GC, no swapping reported by sar.
 
I have also tried downloading a 64 bits 1.7 jdk but I get the typical:
 
Java HotSpot(TM) 64-Bit Server VM warning: Exception
  java.lang.OutOfMemoryError occurred dispatching signal SIGTERM to handler-
  the VM may need to be forcibly terminated
  64-bit JVM usually needs more memory than 32-bit one,  because memory
  address range is wider and pointers need more memory.
 I know, but how do I know how much ram to assign in a 64 bits jdk? We 
 are planning to move to a bigger server (hopefully 16 or 32 gb).
 
 Miguel
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
  

Protect JSP from Direct Access in Tomcat 7.0.xx

2012-06-18 Thread Kiran Badi

Hi All,

I need your guidance again.I have bunch of JSP's close to 100+ which I 
need to protect it from direct access.


I have this mapping in web xml and this is not working,It seems that 
probably i need to define a role first and then use below settings.But 
unfortunately my app is open internet application which does not use 
realm at all.


security-constraint
display-nameDenyAccesstoDirectJSP/display-name
web-resource-collection
web-resource-namesample.jsp/web-resource-name
descriptionSample confirmation JSP/description
url-pattern*.jsp/url-pattern
http-methodGET/http-method
http-methodPOST/http-method
/web-resource-collection
/security-constraint

All my jsp's are residing in the webpages folder of project directory.I 
know this is incorrect and probably gives direct access to jsp's.


So I have some clarification to ask,

1. is their a way to tell tomcat to not to serve direct jsp's probably 
via web xml


2. Is their any extra setting that is required if I move my JSP's inside 
web-inf.I created a folder under web-inf and create sample hello 
world.jsp and then tried to invoke that jsp but got 404 message.


- Kiran

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



RE: Apache tomcat (7.0.27) is not loading the user and role class for JAASRealm

2012-06-18 Thread Esmond Pitt
Javed

Just call Session.invalidate() or HttpServletRequest.logout(). The JAASRealm
will do the rest, and call logout() on your LoginModule. Note that you can't
assume it is the same instance of your login module, that's what all the
shared state is for. 

EJP


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



Re: Modify HTTP status returned by stopped context

2012-06-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Kyle,

On 6/18/12 3:52 PM, kharp...@oreillyauto.com wrote:
 Thank you for the direction.  I created my own servlet which loads
 without error.  Here is how I've configured it:

Where did you configure this? Which webapp's web.xml?

 servlet servlet-nameHttpResponseAdjuster/servlet-name 
 servlet-classbla.bla.tomcat.ReturnNotAvailableServlet/servlet-class

 
load-on-startup1/load-on-startup

You don't need to load this on startup if you don't want to: the
servlet will be initialized when necessary.

 /servlet
 
 servlet-mapping 
 servlet-nameHttpResponseAdjuster/servlet-name 
 url-pattern/foo/*/url-pattern /servlet-mapping
 
 servlet-mapping 
 servlet-nameHttpResponseAdjuster/servlet-name 
 url-pattern/Testing/*/url-pattern /servlet-mapping
 
 Unfortunately, when I stop the foo context, tomcat is still
 returning the default HTTP 404 page.  It doesn't appear to give any
 consideration to the servlet mapping in my ROOT context.  Unless
 I've configured something wrong, it appears the desired behavior
 (to look for /Context first, then a ROOT servlet with mapping of
 /Context/*) isn't happening.

Yes, the longest match should win.

 You'll notice I setup another servlet-mapping called /Testing/*.
 Testing is NOT a context.  When I go to myserver:8080/Testing my
 servlet handles the request and does what I desire (HTTP 503).  To
 reiterate, my version of tomcat is 6.0.24.  Perhaps the logic we're
 relying on wasn't introduced until later?  Or maybe I'm missing a
 configuration option at a higher level to send failed requests to
 search the ROOT context for mappings?

Assuming you have everything configured as described, then your
expected behavior is also what I'd expect.  Please test with latest
6.0 which is 6.0.35. If that doesn't work, please also test with
7.0.28 (freshly minted this weekend) and let us know if you have more
success.

If it does not work with 6.0.35 or it does not work with 7.0.28, can
you create a simple test case (ROOT.war + some other WAR w/overlapping
URI spaces) and create a Bugzilla ticket for it (or 2, if the bug
exists in both versions)?

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

iEYEARECAAYFAk/fyvkACgkQ9CaO5/Lv0PBkvwCgiZ9fDieTRdPSJTkrphxRn7Yi
CoUAoJy5RTwqSwSLCJe5hrnpmw747k4O
=5ESc
-END PGP SIGNATURE-

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



Re: heap memory issues

2012-06-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Miguel,

On 6/18/12 6:34 PM, Miguel González Castaños wrote:
 [H]ow do I know how much ram to assign in a 64 bits jdk? We are
 planning to move to a bigger server (hopefully 16 or 32 gb).

Nobody can tell you how big your heap needs to be: it all depends upon
the needs of your app and its users. We ran for 5 years with a 64 MiB
heap and never had any problems. We started getting OOMEs because we
started supporting more users and their (small) sessions were piling
up and busting our heap, so we had to increase the heap size.

Now that you have your email issue handled, you might even decide that
bigger hardware isn't necessary.

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

iEYEARECAAYFAk/fzDUACgkQ9CaO5/Lv0PCqFgCdGIzKHtqi/rSI/hmSrk+2VcO3
6+wAoJoAi0CxzV1q4ZjjvrFSrFNiLrmj
=VD69
-END PGP SIGNATURE-

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



Re: heap memory issues

2012-06-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Martin,

On 6/18/12 7:26 PM, Martin Gainty wrote:
 Chris Hansen sugire:
 
 Thread maximum stack size 2m Initial stack is 32m Initial PermGen
 32m Max PermGen 200m Max Heap at 367 M Allow Concurrent Mark and
 Sweep CMS ClassUnloading enabled -Xss2m -Xms32m -XX:PermSize=32m 
 -XX:MaxPermSize=200m -Xverify:none -Xmx367m -XX:+UseConcMarkSweepGC
  -XX:+CMSClassUnloadingEnabled

Those seem like awfully specific and totally inappropriate JVM tuning
parameters to recommend to someone whose environment you have
absolutely no experience with.

Miguel: completely ignore this post. It will only lead you down a
rathole of foolishness and it's best to just walk away.

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

iEYEARECAAYFAk/fzbQACgkQ9CaO5/Lv0PAF7gCfRAAcq34Z28IR81i5Is0728IM
JKIAni0pLP2jTunWh7Y3QDjHMa9wABbj
=hoBS
-END PGP SIGNATURE-

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



Re: Protect JSP from Direct Access in Tomcat 7.0.xx

2012-06-18 Thread Tim Watts
Hi Kiran,

On Tue, 2012-06-19 at 05:40 +0530, Kiran Badi wrote:
 Hi All,
 
 I need your guidance again.I have bunch of JSP's close to 100+ which I 
 need to protect it from direct access.
 
By direct access do you mean that http://host/myapp/sample.jsp is
returning the JSP source code rather than executing it?  Or do you mean
that you don't want any .jsp URLs to be accessible to users?

 I have this mapping in web xml and this is not working,It seems that 
 probably i need to define a role first and then use below settings.But 
 unfortunately my app is open internet application which does not use 
 realm at all.
 
 security-constraint
 display-nameDenyAccesstoDirectJSP/display-name
 web-resource-collection
 web-resource-namesample.jsp/web-resource-name
 descriptionSample confirmation JSP/description
 url-pattern*.jsp/url-pattern
 http-methodGET/http-method
 http-methodPOST/http-method
 /web-resource-collection
 /security-constraint
 
This isn't going to help you. Dump it.

 All my jsp's are residing in the webpages folder of project directory.I 
 know this is incorrect and probably gives direct access to jsp's.
 
 So I have some clarification to ask,
 
 1. is their a way to tell tomcat to not to serve direct jsp's probably 
 via web xml
 
If by serve direct jsp's you mean don't return source code then,
yes.  Put them under your web app's directory.  For example, if your web
app's context is 'myapp' then in tomcat it will be deployed under
TC_BASE/webapps/myapp.  You could put them directly in this directory
or group them under a separate directory; 'jsps' for instance.  Then
sample.jsp would be addressed as http://host/myapp/sample.jsp (or
http://host/myapp/jsps/sample.jsp )

 2. Is their any extra setting that is required if I move my JSP's inside 
 web-inf.I created a folder under web-inf and create sample hello 
 world.jsp and then tried to invoke that jsp but got 404 message.
 
First of all, it's WEB-INF. Case matters.  

No, there's no special setting that will directly expose anything
under WEB-INF via a URL.  That's the part of the Servlet Spec.  It's a
Good Thing®.  However, if you're trying to make your JSPs inaccessible
via URLs, then you can move them there and have them indirectly accessed
using a servlet which forwards the request to them.  See
ServletContext.getRequestDispatcher() and RequestDispatcher.forward().  

Hopefully, you're trying to use or move toward the MVC (Model, View,
Controller) pattern.  If not, you should.  Google MVC design pattern.
There are many, many frameworks that will make this easier for you (once
you learn them): Struts, Spring MVC...

If you're well into your project and don't want to add a framework to it
you could write a simple servlet that uses an algorithm to map URI paths
to JSPs then forwards to the JSP using a dispatcher.  For instance, you
could put your JSPs in myapp/WEB-INF/jsps.  Then have the servlet map a
URI such as /sample to /WEB-INF/jsps/sample.jsp (all relative
to /myapp). 

This isn't a great approach because you really aren't separating the
model from the view (all the app logic and display logic are housed in
the JSP -- a maintenance nightmare).  But if you don't have time to
re-architect the app now, it will hide the .jsp's from direct access.
And it will put you in a slightly better position if/WHEN you do
re-architect it.


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



signature.asc
Description: This is a digitally signed message part


Re: Protect JSP from Direct Access in Tomcat 7.0.xx

2012-06-18 Thread Kiran Badi

On 6/19/2012 8:03 AM, Tim Watts wrote:

Hi Kiran,

On Tue, 2012-06-19 at 05:40 +0530, Kiran Badi wrote:

Hi All,

I need your guidance again.I have bunch of JSP's close to 100+ which I
need to protect it from direct access.


By direct access do you mean that http://host/myapp/sample.jsp is
returning the JSP source code rather than executing it?  Or do you mean
that you don't want any .jsp URLs to be accessible to users?
No its not returning source code.I have couple of jsps where in I use EL 
in those to access session objects and directly accessing those jsps is 
not something I want.



I have this mapping in web xml and this is not working,It seems that
probably i need to define a role first and then use below settings.But
unfortunately my app is open internet application which does not use
realm at all.

security-constraint
display-nameDenyAccesstoDirectJSP/display-name
web-resource-collection
web-resource-namesample.jsp/web-resource-name
descriptionSample confirmation JSP/description
url-pattern*.jsp/url-pattern
http-methodGET/http-method
http-methodPOST/http-method
/web-resource-collection
/security-constraint


This isn't going to help you. Dump it.

Yup its not helping.



All my jsp's are residing in the webpages folder of project directory.I
know this is incorrect and probably gives direct access to jsp's.

So I have some clarification to ask,

1. is their a way to tell tomcat to not to serve direct jsp's probably
via web xml


If by serve direct jsp's you mean don't return source code then,
yes.  Put them under your web app's directory.  For example, if your web
app's context is 'myapp' then in tomcat it will be deployed under
TC_BASE/webapps/myapp.  You could put them directly in this directory
or group them under a separate directory; 'jsps' for instance.  Then
sample.jsp would be addressed as http://host/myapp/sample.jsp (or
http://host/myapp/jsps/sample.jsp )

Yup I have same setup.Still its not working.my bad.



2. Is their any extra setting that is required if I move my JSP's inside
web-inf.I created a folder under web-inf and create sample hello
world.jsp and then tried to invoke that jsp but got 404 message.


First of all, it's WEB-INF. Case matters.

Ok got it.



No, there's no special setting that will directly expose anything
under WEB-INF via a URL.  That's the part of the Servlet Spec.  It's a
Good Thing®.  However, if you're trying to make your JSPs inaccessible
via URLs, then you can move them there and have them indirectly accessed
using a servlet which forwards the request to them.  See
ServletContext.getRequestDispatcher() and RequestDispatcher.forward().
Yup I have lot many of request dispatchers in servlets.Almost all my 
JSP's are using data which is forwarded by servlets.I pull data from db 
via servlet, store it in session scope,forward it to jsp and in jsp 
access it via el.On logoff I remove attributes from the session.



Hopefully, you're trying to use or move toward the MVC (Model, View,
Controller) pattern.  If not, you should.  Google MVC design pattern.
There are many, many frameworks that will make this easier for you (once
you learn them): Struts, Spring MVC...

If you're well into your project and don't want to add a framework to it
you could write a simple servlet that uses an algorithm to map URI paths
to JSPs then forwards to the JSP using a dispatcher.  For instance, you
could put your JSPs in myapp/WEB-INF/jsps.  Then have the servlet map a
URI such as /sample to /WEB-INF/jsps/sample.jsp (all relative
to /myapp).

http://localhost:8080/mysite/WEB-INF/jsp/newjsp.jsp

I just created folder jsp under WEB-INF and then added newjsp.jsp(this 
is hello world jsp) and then ran the file.I get 404 error. I am trying 
all this with netbeans.

This isn't a great approach because you really aren't separating the
model from the view (all the app logic and display logic are housed in
the JSP -- a maintenance nightmare).  But if you don't have time to
re-architect the app now, it will hide the .jsp's from direct access.
And it will put you in a slightly better position if/WHEN you do
re-architect it.
I think I am using kind of MVC pattern of course the one used around 6 
to 8 years back.I am using jsp as view, servlet as kind controller and 
then some beans/jstl and el to make my life easy somewhat. I would love 
to work with frameworks like spring or struts someday.


Ok  let me explain as what I need again,

I have form A with say about 10 fields, lets call this as jsp A. So in 
browser bar it looks like http://localhost:8080/mysite/A.jsp


User fills this A.jsp and then clicks Submit button. It posts the form 
to Servlet B which does insert in the database and then forwards the 
request via request dispatcher to  C.jsp which has some confirmation 
details in it.(Unique reference ids pulled out from DB).


Now with my existing setup if I directly give url like

http://localhost:8080/mysite/C.jsp   I go directly to C Jsp which I 
should not because its not suppose 

apache-tomcat-7.0.27 start up errors on Mac OX Lion

2012-06-18 Thread Samuel V Green III
I followed directions for install and config here:
http://wolfpaulus.com/journal/mac/tomcat7

and here:

http://www.janhellevik.no/blog/?p=323

When attempting to start Tomcat I get the following error…. ( I've googled the 
_ _ it out of this error and can't find a fix.

sudo $CATALINA_HOME/bin/catalina.sh run
Password:
Using CATALINA_BASE:   /Library/Tomcat
Using CATALINA_HOME:   /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME:
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
Using CLASSPATH:   
/Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
Exception in thread main java.lang.NoClassDefFoundError: 
org/apache/catalina/startup/Bootstrap
Caused by: java.lang.ClassNotFoundException: 
org.apache.catalina.startup.Bootstrap
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

When I attempt start this way:

sudo /Library/Tomcat/bin/startup.sh
Password:
Using CATALINA_BASE:   /Library/Tomcat
Using CATALINA_HOME:   /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME:
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
Using CLASSPATH:   
/Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar

I get no errors, but http://localhost:8080 does not connect.

Thanks for any help!

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



Re: heap memory issues

2012-06-18 Thread Terence M. Bandoian

 On 1:59 PM, Miguel González Castaños wrote:
I know, but how do I know how much ram to assign in a 64 bits jdk? We 
are planning to move to a bigger server (hopefully 16 or 32 gb).


Miguel


16 or 32 GB?  Is this a medical image processing system?  A control 
system for a space flight?  Sorry for the sarcasm but that just seems 
like an enormous amount of memory.


-Terence Bandoian


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



Re: Protect JSP from Direct Access in Tomcat 7.0.xx

2012-06-18 Thread Tim Watts
On Tue, 2012-06-19 at 08:48 +0530, Kiran Badi wrote:
 No its not returning source code.I have couple of jsps where in I use EL 
 in those to access session objects and directly accessing those jsps is 
 not something I want.

Good move.

SNIP

  2. Is their any extra setting that is required if I move my JSP's inside
  web-inf.I created a folder under web-inf and create sample hello
  world.jsp and then tried to invoke that jsp but got 404 message.
 
  First of all, it's WEB-INF. Case matters.
 Ok got it.
 
 
  No, there's no special setting that will directly expose anything
  under WEB-INF via a URL.  That's the part of the Servlet Spec.  It's a
  Good Thing®.  However, if you're trying to make your JSPs inaccessible
  via URLs, then you can move them there and have them indirectly accessed
  using a servlet which forwards the request to them.  See
  ServletContext.getRequestDispatcher() and RequestDispatcher.forward().

 Yup I have lot many of request dispatchers in servlets.Almost all my 
 JSP's are using data which is forwarded by servlets.I pull data from db 
 via servlet, store it in session scope,forward it to jsp and in jsp 
 access it via el.On logoff I remove attributes from the session.
 

So then those JSPs which are forwarded to by servlets (typical
controllers in MVC) could be moved to WEB-INF/whatever and then the
servlets would use a dispatcher to forward to
/WEB-INF/whatever/sample.jsp instead of /webpages/sample.jsp or
whatever they're using now.  You'd need to physically move those JSPs
then update the servlets to use the JSPs' new location.

 
  Hopefully, you're trying to use or move toward the MVC (Model, View,
  Controller) pattern.  If not, you should.  Google MVC design pattern.
  There are many, many frameworks that will make this easier for you (once
  you learn them): Struts, Spring MVC...
 
  If you're well into your project and don't want to add a framework to it
  you could write a simple servlet that uses an algorithm to map URI paths
  to JSPs then forwards to the JSP using a dispatcher.  For instance, you
  could put your JSPs in myapp/WEB-INF/jsps.  Then have the servlet map a
  URI such as /sample to /WEB-INF/jsps/sample.jsp (all relative
  to /myapp).
 http://localhost:8080/mysite/WEB-INF/jsp/newjsp.jsp
 
 I just created folder jsp under WEB-INF and then added newjsp.jsp(this 
 is hello world jsp) and then ran the file.I get 404 error. I am trying 
 all this with netbeans.

Well I hope by now you understand why or we're just going in circles.
Of course, that URL gives a 404: it's trying to access WEB-INF which is
never accessible via HTTP.  But it is accessible via
RequestDispatcher.forward() -- e.g.:


servletCtx.getRequestDispatcher(/WEB-INF/jsp/newjsp.jsp).forward(request, 
response);

This is kind of like what you said earlier that your servlets are
essentially doing, right?


  This isn't a great approach because you really aren't separating the
  model from the view (all the app logic and display logic are housed in
  the JSP -- a maintenance nightmare).  But if you don't have time to
  re-architect the app now, it will hide the .jsp's from direct access.
  And it will put you in a slightly better position if/WHEN you do
  re-architect it.
 I think I am using kind of MVC pattern of course the one used around 6 
 to 8 years back.I am using jsp as view, servlet as kind controller and 
 then some beans/jstl and el to make my life easy somewhat. I would love 
 to work with frameworks like spring or struts someday.
 
They're free you know. :-)  But of course, free software doesn't add
hours to the day.  You're basically rolling your own MVC and that will
probably help you understand better what these frameworks do.  But move
away from this as soon as you can.  They've solved a lot of problems you
probably haven't even considered and they can make your applications
much less brittle if you take the time to learn them well.

 Ok  let me explain as what I need again,
 
 I have form A with say about 10 fields, lets call this as jsp A. So in 
 browser bar it looks like http://localhost:8080/mysite/A.jsp
 
Ah, so you do want SOME of your JSPs to be URL accessible!  Well, if
A.jsp doesn't and never ever will have any dependencies on the
application's state then fine.  Maybe it's true today but I doubt it
will stay that way.  So it's probably better to be consistent and hide
this as well.

 User fills this A.jsp and then clicks Submit button. It posts the form 
 to Servlet B which does insert in the database and then forwards the 
 request via request dispatcher to  C.jsp which has some confirmation 
 details in it.(Unique reference ids pulled out from DB).
 
So on submit, an HTTP POST is sent to http://localhost:8080/mysite/B.
Then servlet B does its work and essentially invokes:

ctx.getRequestDispatcher(/C.jsp).forward(request, response);

then C.jsp sends back the response using data from the session.

Is this right?

(btw, you know your app'ss 

Abtract methods in DelegatingResultSet

2012-06-18 Thread Olivier Lefevre

I just noticed that the DelegatingResultSet object handed by Tomcat
sports a slew of abstract methods even though the class itself is
not declared abstract. In Tomcat 7.0.x there are only 2 such methods:
the two getObject methods taking a Class as second argument, which are
also the only two methods marked as 1.7 level in the Javadocs, but for
Tomcat 6.0.x there are lots of them, including the isClosed method, all
of them marked 1.6 level AFAICT.

This seems very wrong, esp. the fact the DelegatingResultSet class is
not marked as abstract. I have attached a test servlet that demonstrates
the behaviour: install it and call http://localhost:8080/test1/get
(or whatever is your Tomcat server location). I tested against 6.0.30
and 7.0.27. Can somebody comment?

Thanks,

-- O.L.
package test1;

import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.sql.*;

import javax.naming.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.sql.DataSource;

public class Test1Servlet extends HttpServlet {

private DataSource dataSource;

@Override
public void init() throws ServletException {
dataSource = getDataSource();
}

private DataSource getDataSource() throws ServletException {
try {
Context ctx = new InitialContext();
return (DataSource)ctx.lookup(java:comp/env/jdbc/Test1Database); }
catch (NamingException e) {
// aborting servlet initialization
throw new UnavailableException(getDataSource error, -1); }
}

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
ServletContext ctx = getServletContext();
try {
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(SELECT 1, 2, 3);
conn.close();
resp.setStatus(HttpServletResponse.SC_OK);
PrintWriter w = resp.getWriter();
Class? klass = rs.getClass();
w.println(ResultSet class:);
w.println(   + Modifier.toString(klass.getModifiers()) +   + 
klass.getName());
try {
w.println(isClosed() method signature:);
w.println(   + klass.getMethod(isClosed)); }
catch (NoSuchMethodException e) {
w.println(isClosed() method not found); }
w.println(abstract methods:);
for (Method m : klass.getMethods()) {
if (Modifier.isAbstract(m.getModifiers()))
w.println(   + m); }
w.flush();
w.close(); }
catch (SQLException e) {
ctx.log(== query error);
e.printStackTrace(); }
}
}



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

Javamail exception in tomcat 7.0.11

2012-06-18 Thread Kiran Badi

Hi All,

I have send mail servlet, which looks something like below,

protected void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {

   String emailRecipient = request.getParameter(name);
//   String emailRecipient = xxx;
try {
Message msg = new MimeMessage(this.session);
msg.setFrom(new InternetAddress(xxx));
System.out.println( remoteAddr is  + emailRecipient + ');
for (int i = 0; i  10; i++) {
msg.setRecipients(Message.RecipientType.TO, 
InternetAddress.parse(emailRecipient, false));

}

msg.setSubject(Test email);
msg.setText(Hello This is test mail);
msg.setSentDate(new Date());
Transport.send(msg); *(This is line number 60)*
System.out.println(Message sent OK.);
} catch (Exception ex) {
 
Logger.getLogger(MailSendingServlet.class.getName()).log(Level.SEVERE, 
null, ex);

}
}
}

and I have javamail reference declared in context.xml something like 
this one,


Resource name=mail/ourstorymailsession
auth=Container
type=javax.mail.Session
mail.smtp.host=smtp.gmail.com
mail.smtp.port=465
mail.smtp.auth=true
mail.smtp.user=sender userid
password=
mail.smtp.starttls.enable=true

mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory

mail.debug=true /

and web.xml something like
resource-ref
description
   My site mail server
/description
res-ref-namemail/mysitemailsession/res-ref-name
res-typejavax.mail.Session/res-type
res-authContainer/res-auth
res-sharing-scopeShareable/res-sharing-scope
/resource-ref

With this setting now I am getting below exception,

avax.mail.MessagingException: Could not connect to SMTP host: localhost, 
port: 25;

  nested exception is:
java.net.ConnectException: Connection refused: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)
at 
com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)

at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at indianads.MailSendingServlet.doPost(MailSendingServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at 
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
   

Re: Protect JSP from Direct Access in Tomcat 7.0.xx

2012-06-18 Thread Kiran Badi

On 6/19/2012 10:22 AM, Tim Watts wrote:

Hopefully, you're trying to use or move toward the MVC (Model, View,
Controller) pattern.  If not, you should.  Google MVC design pattern.
There are many, many frameworks that will make this easier for you (once
you learn them): Struts, Spring MVC...

If you're well into your project and don't want to add a framework to it
you could write a simple servlet that uses an algorithm to map URI paths
to JSPs then forwards to the JSP using a dispatcher.  For instance, you
could put your JSPs in myapp/WEB-INF/jsps.  Then have the servlet map a
URI such as /sample to /WEB-INF/jsps/sample.jsp (all relative
to /myapp).

http://localhost:8080/mysite/WEB-INF/jsp/newjsp.jsp

I just created folder jsp under WEB-INF and then added newjsp.jsp(this
is hello world jsp) and then ran the file.I get 404 error. I am trying
all this with netbeans.

Well I hope by now you understand why or we're just going in circles.
Of course, that URL gives a 404: it's trying to access WEB-INF which is
never accessible via HTTP.  But it is accessible via
RequestDispatcher.forward() -- e.g.:


servletCtx.getRequestDispatcher(/WEB-INF/jsp/newjsp.jsp).forward(request, 
response);

This is kind of like what you said earlier that your servlets are
essentially doing, right?
No I did not do the way you mentioned.I just created a jsp under WEB-INF 
and invoked it directly and got 404.I think I now see what you are 
mentioning.

and its wonderful idea.Makes perfect sense now.Thanks Tim.



This isn't a great approach because you really aren't separating the
model from the view (all the app logic and display logic are housed in
the JSP -- a maintenance nightmare).  But if you don't have time to
re-architect the app now, it will hide the .jsp's from direct access.
And it will put you in a slightly better position if/WHEN you do
re-architect it.

I think I am using kind of MVC pattern of course the one used around 6
to 8 years back.I am using jsp as view, servlet as kind controller and
then some beans/jstl and el to make my life easy somewhat. I would love
to work with frameworks like spring or struts someday.


They're free you know. :-)  But of course, free software doesn't add
hours to the day.  You're basically rolling your own MVC and that will
probably help you understand better what these frameworks do.  But move
away from this as soon as you can.  They've solved a lot of problems you
probably haven't even considered and they can make your applications
much less brittle if you take the time to learn them well.
Yup I have another project in mind which I plan to roll out soon 
probably either with spring or JSF.Maybe in a month or 2.I am fast 
learner and risk taker.





Ok  let me explain as what I need again,

I have form A with say about 10 fields, lets call this as jsp A. So in
browser bar it looks like http://localhost:8080/mysite/A.jsp


Ah, so you do want SOME of your JSPs to be URL accessible!  Well, if
A.jsp doesn't and never ever will have any dependencies on the
application's state then fine.  Maybe it's true today but I doubt it
will stay that way.  So it's probably better to be consistent and hide
this as well.


User fills this A.jsp and then clicks Submit button. It posts the form
to Servlet B which does insert in the database and then forwards the
request via request dispatcher to  C.jsp which has some confirmation
details in it.(Unique reference ids pulled out from DB).


So on submit, an HTTP POST is sent to http://localhost:8080/mysite/B.
Then servlet B does its work and essentially invokes:

ctx.getRequestDispatcher(/C.jsp).forward(request, response);

then C.jsp sends back the response using data from the session.

Is this right?

(btw, you know your app'ss requirements better than I, but storing all
data in the session isn't the only scope available.  It's likely that a
lot of response data needn't survive past the current request.  In that
case, setting request attributes would be better -- less memory needed,
less likely to pick up data that's inappropriate for the current
request).
Yup thats correct.I will explore this option of moving attributes to 
request.Thanks.

Now with my existing setup if I directly give url like

http://localhost:8080/mysite/C.jsp   I go directly to C Jsp which I
should not because its not suppose to be accessed directly.


Right.  Put C.jsp in WEB-INF, get a request dispatcher for
/WEB-INF/C.jsp, forward to that and go home.

Yup got it.I think this should resolve my issue.


-

-
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: Javamail exception in tomcat 7.0.11

2012-06-18 Thread Tim Watts
On Tue, 2012-06-19 at 10:54 +0530, Kiran Badi wrote:
 Hi All,
 
 I have send mail servlet, which looks something like below,
 
 protected void doPost(HttpServletRequest request, HttpServletResponse 
 response) throws ServletException, IOException {
 String emailRecipient = request.getParameter(name);
  //   String emailRecipient = xxx;
  try {
  Message msg = new MimeMessage(this.session);

Looks like your mail session isn't getting initialized properly and you
left out that piece of the puzzle.  How  where does 'this.session' get
set?


  msg.setFrom(new InternetAddress(xxx));
  System.out.println( remoteAddr is  + emailRecipient + ');
  for (int i = 0; i  10; i++) {
  msg.setRecipients(Message.RecipientType.TO, 
 InternetAddress.parse(emailRecipient, false));
  }
 
  msg.setSubject(Test email);
  msg.setText(Hello This is test mail);
  msg.setSentDate(new Date());
  Transport.send(msg); *(This is line number 60)*
  System.out.println(Message sent OK.);
  } catch (Exception ex) {
   
 Logger.getLogger(MailSendingServlet.class.getName()).log(Level.SEVERE, 
 null, ex);
  }
  }
 }
 
 and I have javamail reference declared in context.xml something like 
 this one,
 
 Resource name=mail/ourstorymailsession
  auth=Container
  type=javax.mail.Session
  mail.smtp.host=smtp.gmail.com
  mail.smtp.port=465
  mail.smtp.auth=true
  mail.smtp.user=sender userid
  password=
  mail.smtp.starttls.enable=true
  
 mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
  mail.debug=true /
 
 and web.xml something like
 resource-ref
 description
 My site mail server
 /description
 res-ref-namemail/mysitemailsession/res-ref-name

Doesn't match your Resource definition name.

--tim

 res-typejavax.mail.Session/res-type
 res-authContainer/res-auth
 res-sharing-scopeShareable/res-sharing-scope
 /resource-ref
 
 With this setting now I am getting below exception,
 
 avax.mail.MessagingException: Could not connect to SMTP host: localhost, 
 port: 25;
nested exception is:
  java.net.ConnectException: Connection refused: connect
  at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)
  at 
 com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)
  at javax.mail.Service.connect(Service.java:295)
  at javax.mail.Service.connect(Service.java:176)
  at javax.mail.Service.connect(Service.java:125)
  at javax.mail.Transport.send0(Transport.java:194)
  at javax.mail.Transport.send(Transport.java:124)
  at indianads.MailSendingServlet.doPost(MailSendingServlet.java:60)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at 
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
  at 
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at 
 org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
  at 
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
  at 
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
  at 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
  at 
 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
  at 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
  at 
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
  at 
 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
  at 
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at 
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
  at 
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
  at 
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
  at 
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
  at 
 org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
  at 
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
  at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
  at java.lang.Thread.run(Thread.java:662)
 Caused by: