RE: Using EL expressions in an ObjectFactory

2013-08-30 Thread Xavier Dury
Hi,

I don't think you understood me. The point here is not about the 
${catalina.base}, it's about the whole expression 
CacheManager.newInstance(URI('file:${catalina.base}/conf/ehcache.xml').toURL()).

The ${catalina.base} will of course be expanded and give something like:

CacheManager.newInstance(URI('file:/home/tomcat/conf/ehcache.xml').toURL())

And then, this expression can be evaluated through EL and give a real 
CacheManager instance.

I could have written this that way:

CacheManager.newInstance(URI('file:'+System.getProperty('catalina.base')+'/conf/ehcache.xml').toURL())

The important thing here is that the whole expression parameter could be given 
to an ELProcessor instead of having specialized ObjectFactory for each case (I 
would of course use a specific ObjectFactory if there's one, like 
BasicDataSourceFactory... but for exotic and rare cases where no ObjectFactory 
exist, a generic EL-based one could be helpful).

Xavier


 Date: Thu, 29 Aug 2013 14:53:31 -0400
 From: ch...@christopherschultz.net
 To: users@tomcat.apache.org
 Subject: Re: Using EL expressions in an ObjectFactory

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Xavier,

 On 8/29/13 3:06 AM, Xavier Dury wrote:
 Could it be possible for the tomcat team to include a
 javax.naming.spi.ObjectFactory which would use EL3.0 expressions?

 It would be great if you want to have resource-ref which are not of
 the usual types.

 I always wanted to have an ObjectFactory for URLs but having one
 for each type is too much work... so now, that we have a more
 powerful EL engine, maybe it would a great opportunity to use it.

 Resource name=/url/SomeService type=java.net.URL
 factory=org.apache.tomcat.jndi.ELObjectFactory
 importClass=java.net.URI
 expression=URI('http://some.service.url').toURL() /

 Resource name=/cache/CacheManager
 type=net.sf.ehcache.CacheManager
 factory=org.apache.tomcat.jndi.ELObjectFactory
 importClass=net.sf.ehcache.CacheManager,java.net.URI
 importStatic=net.sf.ehcache.CacheManager.newInstance
 expression=CacheManager.newInstance(URI('file:${catalina.base}/conf/ehcache.xml').toURL())

 What's

 wrong with just using $catalina.base within your context.xml?
 It will expand appropriately already... no EL needed.

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.14 (Darwin)
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQIcBAEBCAAGBQJSH5irAAoJEBzwKT+lPKRYRoYP/03+hC07yLehUBQHuaIghRTB
 6NWcWrzcZ3bCy/uFtQDLH12am7sbE2zQ+VO6HPlOJaRJul8UQLCdZlTXmQuquz+G
 8SGoGb4BWqPcluMrhbO+8v7f4aMPN7NenxBRpzNvWlQPtOo2h7+9cmz2bwh+XikU
 5J8IGE2e7wb8dAQBu6DJtFsQi+fAhOGaiLfBtorwDLYrpJ4nN0tr28LSFrX9VKtD
 d0Fwga1zzHrBiGFzNAoUUujuGaPYCfbGugNJogWQO0dvHKQMmAM9GGLStnJbyy4U
 vehGGU4lRq6mhkD0KCUJ/zVxM1fuFxK+Q4hRah97Mw7r8jHgqyQEqdfGV9EjUZh4
 GVg0Y5W308ZTZfiutb7N++GTFrYq9qohHmI8pQyJ2jQLPtIo7gZv9KKBgFHUggpM
 2lg4ZL6/3wjALScRsQ5/NKUpg4s0NIb25LPOKViCW1fHF2euUcEH/lkkelgGMgFP
 2BXVszGOhQghePXFg6hkpAa4zhF0HRJQj8T5a1kJIBnf4QW3mm/g2Xv19EVNyiOs
 ZrkC6dSXZXnJZ0aYxusxRNKvSplTGm6ywuftxy17H89Mblib8qb0G+5MNwRJwceF
 tOkvHoMEY20dbhRZpQDL79a5dVL7YLc4M8hXBR1JQkmo1RyslHU/Y/+782OSs5+w
 ZFM1iRO6JYbxLrGdwQ3n
 =9lxu
 -END PGP SIGNATURE-

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



Re: (MY Tomcat version :- 7.0.40 and deployed on CentOS

2013-08-30 Thread Sushil Prusty
Hi Chris

Thanks to show me a light in black dark room.
Please just look below work flow and requirement.


Before login to my web application, i need to swap data card to access my
web application. So data card  should be certified by OCSP instead CRL. My
java based web application is deployed on apache tomcat 7.0.40 ,so i think
i need to integrate OCSP some where in apache tomcat to certify my
application?
Or do you i need to write any external java program to interact with ocsp
responder ?

Is there any java api for provided by apache?


On Fri, Aug 30, 2013 at 12:34 AM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Sushil,

 On 8/29/13 2:38 AM, Sushil Prusty wrote:
  I need to configure OCSP in tomcat for my project and need to test
  through client browser . I searched every where in all search
  engine but unable to find out .
 
  Please help out on How can we configure OCSP in tomcat.

 The Tomcat native library must be built with OCSP support built-in or
 not (it's not runtime selectable). If you want to build with OCSP
 support, you'll want to use the --enable-ocsp switch when running
 configure before compiling.

 Are you using a package managed by RedHat, or did you build tcnative
 yourself?

 If you aren't using tcnative -- that is, you are using BIO or NIO
 connector -- you might just have to set a system property. See these
 references:


 http://security.stackexchange.com/questions/33451/does-javas-implementation-of-ocsp-and-crl-checking-handle-intermediate-cas

 and


 http://docs.oracle.com/javase/7/docs/technotes/guides/security/certpath/CertPathProgGuide.html#AppC

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.14 (Darwin)
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQIcBAEBCAAGBQJSH5tLAAoJEBzwKT+lPKRYVkQP/2sVzBz76gK3NJMZ6BJfL9Vs
 DUycZGhVfLjZaV/scyYiQfUZkH8Fb6twUjvqMASysOMgeOhiKn3k5dLOvRb8Qc1N
 EPhCsHhgEL/wd2uii3NFX/qsNPi+gEX+Tq/IPNj01LX2RAvkhSdOZgUSmNAYWLP9
 RsT7I8KKJ44ddrntuIg518+qcBBsfAGW1BZiEp3rNEQzLTYOc8rJkoXRO6Ggjj65
 78OtbaiQljW4/QhJ6KLvldOM+3WEuJTLGZBYW1FavFOVYEBVx/4P+FqFfKxs9Kvu
 s23psmTgjm604PCVCZDwGxNK+ncLOWjMLfpjbNFLw0/CUdEWsfLbKw6Q5OggKC6H
 Nsq9SRabpDH7oEqNZIWqTlLp3iuiKC8RsoFBz0C0XbgZv+0xWMqy7xtmzJAimSJe
 50Fg/DRfSlpSmytnWwreVkZmvVlTc1FFyxo4WElD8b+GTFAsLeRAr0BxFrjI5UYw
 YTTQvVZivUg5ZnitnQDuEO36s0kV1AEkfPMoWl0A3C/IxDcSYbW454x0+hc69QhB
 6RyQIgmA8wwkLAeiq1cA8fbmlSlVee4lqCkNCrD3OHDEBLoHArz3h0zd2Fsf0Woa
 lKZmPw14PSOw4P3AAtSbx/uRKtAobJrjzOviyKL5XvPeD/qQ6HXyK8JeXWhFLUyf
 FQ53mHbgx3/0KbVvMCjD
 =ebjb
 -END PGP SIGNATURE-



HttpServlet

2013-08-30 Thread Morten Bo Oelbye
I am using Tomcat as a server.
I am only able to either receive data or send data.
The problem is that I am not able to use handchaking.
If I try use send, I get the error:
java.io.IOException: Connection closed
not able to receive any longer
What to do?


Re: HttpServlet

2013-08-30 Thread André Warnier

Morten Bo Oelbye wrote:

I am using Tomcat as a server.
I am only able to either receive data or send data.
The problem is that I am not able to use handchaking.
If I try use send, I get the error:
java.io.IOException: Connection closed
not able to receive any longer
What to do?



Hi.
I believe that we are missing some information here, to be able to understand your problem 
and help you.

Maybe start from the beginning :
- what version of Tomcat are you using ?
- from where did you get it ?
- what version of java are you using ?
- on which kind of machine ?
- what is the URL you are using in the browser, to access Tomcat ?


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



configuring tomcat realm

2013-08-30 Thread Francesco Viscomi
Hi,

I've a tomcat-users.xml file in which user Francesco should can access to
http://localhost:8080/manager: 

I also have a server.xml that in the tag  GlobalNamingResources has
declared 2 resource, one is for accessing to http://localhost:8080/manager
and the other is for accessing via JDBC to a protected area in my
application.

Also I nested in the host tag the realm. 

I've attached both tomcat_user.xml and server.xml at the and of this mail.

 

 

When I try to start tomcat, with startup.bat I get the following error:

 




---

GRAVE: Failed to load keystore type JKS with path C:\Documents and
Settings\francesco/.keystore due to C:\Documents and
Settings\francesco\.keystore (Impossibile trovare il file specificato)

java.io.FileNotFoundException: C:\Documents and Settings\francesco\.keystore
(Impossibile trovare il file specificato)

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

 

but the server starts the same.

 

When I try to access http://localhost:8080/manager with user: francesco and
passwd: francesco

 

  I cannot access to the manager, I'm asking where I made a mistake.

 

 

Thanks really much

Francesco

Italy

 

 

 

 

 

Tomcat_user.xml

?xml version='1.0' encoding='utf-8'?
!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the License); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an AS IS BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--
tomcat-users
!--
  NOTE:  By default, no user is included in the manager-gui role required
  to operate the /manager/html web application.  If you wish to use this
app,
  you must define such a user - the username and password are arbitrary.
--
!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  !.. .. that surrounds them.
--

  role rolename=tomcat/
  role rolename=role1/
  role rolename=AdminRole/
  role rolename=UserRole/
  user username=admin password=adminpw1 role=AdminRole/
  user username=user password=userpw01 role=UserRole/
  user username=tomcat password=tomcat roles=tomcat/
  user username=both password=tomcat roles=tomcat,role1/
  user username=role1 password=tomcat roles=role1/
  user password=francesco roles=manager-script,manager-gui,admin
username=francesco/
/tomcat-users



 

 

 

Server.xml:

 

?xml version='1.0' encoding='utf-8'?
Server port=8005 shutdown=SHUTDOWN
  Listener className=org.apache.catalina.core.AprLifecycleListener
SSLEngine=on /
  Listener className=org.apache.catalina.core.JasperListener /
  Listener
className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
  Listener
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /
  Listener
className=org.apache.catalina.core.ThreadLocalLeakPreventionListener /
  GlobalNamingResources
Resource name=jdbc/PoolConnessioni auth=Container
type=javax.sql.DataSource
  maxActive=100 maxIdle=30 maxWait=1
  username=utentedb password=utentedb
driverClassName=com.mysql.jdbc.Driver
 
url=jdbc:mysql://localhost:3306/timesheet?zeroDateTimeBehavior=convertToNul
l/  

Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
  description=User database that can be updated and saved
  factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /
  /GlobalNamingResources
  Service name=Catalina
Connector port=8080 protocol=HTTP/1.1
   connectionTimeout=2
   redirectPort=8443 /  
Connector port=8443 protocol=HTTP/1.1 SSLEnabled=true
  maxThreads=150 scheme=https secure=true
  clientAuth=false sslProtocol=TLS /

Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /
Engine name=Catalina defaultHost=localhost
  Realm className=org.apache.catalina.realm.LockOutRealm
Realm className=org.apache.catalina.realm.UserDatabaseRealm
   resourceName=UserDatabase/
  /Realm
  Host name=localhost  appBase=webapps
unpackWARs=true autoDeploy=true
Realm 

Re: HttpServlet

2013-08-30 Thread Morten Bo Oelbye

Well, it is very simple from my point of wiev.
The Tomcat act in the same way in 6 and 7 in window xp
I have not done any editing in the Tomcat, other than those nessisary to do 
a Tomcat connection using Apace in front with mod_jk.
The design use a Midlet url http connection to access my Tomcat, so it is 
not a browser question.
The wireless module/ mobile has no display to do a response. So I am totally 
dependent on some sort of handshaking with Tomcat.
Reading data from my module to Tomcat is not a problem. The data sent to 
Tomcat are written to a file.
But in the same moment, I have sent back an acknowledge, from Tomcat to the 
module, Tomcat terminate the connection. I only use string, as data.
So, I do not know anything else, about how to garantee a read and write 
connection.


The web.xml is very simple:
servlet
 servlet-nameGPS/servlet-name
 servlet-classGPS/servlet-class
/servlet

servlet-mapping
 servlet-nameGPS/servlet-name
 url-pattern/GPS/*/url-pattern
/servlet-mapping

The content.xml is also very simple:
?xml version=1.0 encoding=UTF-8?
Context
antiJARLocking=true
path=
reloadable=true
unloadDelay=3000
/

If You want more I have copyed it all to:
http://87.50.63.187/mytomcat/
Only when the computer is on.
Br for now.





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



Re: configuring tomcat realm

2013-08-30 Thread Sudhir Bhoga
On Fri, Aug 30, 2013 at 12:13 PM, Francesco Viscomi fvisc...@gmail.com wrote:
 Hi,

 I've a tomcat-users.xml file in which user Francesco should can access to
 http://localhost:8080/manager:

 I also have a server.xml that in the tag  GlobalNamingResources has
 declared 2 resource, one is for accessing to http://localhost:8080/manager
 and the other is for accessing via JDBC to a protected area in my
 application.

 Also I nested in the host tag the realm.

 I've attached both tomcat_user.xml and server.xml at the and of this mail.





 When I try to start tomcat, with startup.bat I get the following error:



 
 
 
 ---

 GRAVE: Failed to load keystore type JKS with path C:\Documents and
 Settings\francesco/.keystore due to C:\Documents and
 Settings\francesco\.keystore (Impossibile trovare il file specificato)

 java.io.FileNotFoundException: C:\Documents and Settings\francesco\.keystore
 (Impossibile trovare il file specificato)

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



 but the server starts the same.



 When I try to access http://localhost:8080/manager with user: francesco and
 passwd: francesco



   I cannot access to the manager, I'm asking where I made a mistake.





 Thanks really much

 Francesco

 Italy











 Tomcat_user.xml

 ?xml version='1.0' encoding='utf-8'?
 !--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the License); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an AS IS BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 --
 tomcat-users
 !--
   NOTE:  By default, no user is included in the manager-gui role required
   to operate the /manager/html web application.  If you wish to use this
 app,
   you must define such a user - the username and password are arbitrary.
 --
 !--
   NOTE:  The sample user and role entries below are wrapped in a comment
   and thus are ignored when reading this file. Do not forget to remove
   !.. .. that surrounds them.
 --

   role rolename=tomcat/
   role rolename=role1/
   role rolename=AdminRole/
   role rolename=UserRole/
   user username=admin password=adminpw1 role=AdminRole/
   user username=user password=userpw01 role=UserRole/
   user username=tomcat password=tomcat roles=tomcat/
   user username=both password=tomcat roles=tomcat,role1/
   user username=role1 password=tomcat roles=role1/
   user password=francesco roles=manager-script,manager-gui,admin
 username=francesco/
 /tomcat-users









 Server.xml:



 ?xml version='1.0' encoding='utf-8'?
 Server port=8005 shutdown=SHUTDOWN
   Listener className=org.apache.catalina.core.AprLifecycleListener
 SSLEngine=on /
   Listener className=org.apache.catalina.core.JasperListener /
   Listener
 className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
   Listener
 className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /
   Listener
 className=org.apache.catalina.core.ThreadLocalLeakPreventionListener /
   GlobalNamingResources
 Resource name=jdbc/PoolConnessioni auth=Container
 type=javax.sql.DataSource
   maxActive=100 maxIdle=30 maxWait=1
   username=utentedb password=utentedb
 driverClassName=com.mysql.jdbc.Driver

 url=jdbc:mysql://localhost:3306/timesheet?zeroDateTimeBehavior=convertToNul
 l/

 Resource name=UserDatabase auth=Container
   type=org.apache.catalina.UserDatabase
   description=User database that can be updated and saved
   factory=org.apache.catalina.users.MemoryUserDatabaseFactory
   pathname=conf/tomcat-users.xml /
   /GlobalNamingResources
   Service name=Catalina
 Connector port=8080 protocol=HTTP/1.1
connectionTimeout=2
redirectPort=8443 /
 Connector port=8443 protocol=HTTP/1.1 SSLEnabled=true
   maxThreads=150 scheme=https secure=true
   clientAuth=false sslProtocol=TLS /

 Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /
 Engine name=Catalina defaultHost=localhost
   Realm className=org.apache.catalina.realm.LockOutRealm
 Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=UserDatabase/
 

Re: configuring tomcat realm

2013-08-30 Thread Daniel Mikusa
On Aug 30, 2013, at 12:13 PM, Francesco Viscomi fvisc...@gmail.com wrote:

 Hi,
 
 I've a tomcat-users.xml file in which user Francesco should can access to
 http://localhost:8080/manager: 
 
 I also have a server.xml that in the tag  GlobalNamingResources has
 declared 2 resource, one is for accessing to http://localhost:8080/manager
 and the other is for accessing via JDBC to a protected area in my
 application.
 
 Also I nested in the host tag the realm. 
 
 I've attached both tomcat_user.xml and server.xml at the and of this mail.

 When I try to start tomcat, with startup.bat I get the following error:
 
 
 
 
 ---
 
 GRAVE: Failed to load keystore type JKS with path C:\Documents and
 Settings\francesco/.keystore due to C:\Documents and
 Settings\francesco\.keystore (Impossibile trovare il file specificato)
 
 java.io.FileNotFoundException: C:\Documents and Settings\francesco\.keystore
 (Impossibile trovare il file specificato)
 
at java.io.FileInputStream.open(Native Method)

This is saying that the default keystore could not be loaded.  It's trying to 
load the default keystore because you've not specified on in your HTTPS 
connector.  You'll either want to create a default keystore or set 
keystoreFile on the Connector / tag.

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

 
 but the server starts the same.
 
 When I try to access http://localhost:8080/manager with user: francesco and
 passwd: francesco
 
  I cannot access to the manager, I'm asking where I made a mistake.

See below.

 
 Thanks really much
 
 Francesco
 
 Italy
 
 Tomcat_user.xml
 
 ?xml version='1.0' encoding='utf-8'?
 !--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the License); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
 
  http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an AS IS BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
 --
 tomcat-users
 !--
  NOTE:  By default, no user is included in the manager-gui role required
  to operate the /manager/html web application.  If you wish to use this
 app,
  you must define such a user - the username and password are arbitrary.
 --
 !--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  !.. .. that surrounds them.
 --
 
  role rolename=tomcat/
  role rolename=role1/
  role rolename=AdminRole/
  role rolename=UserRole/
  user username=admin password=adminpw1 role=AdminRole/
  user username=user password=userpw01 role=UserRole/
  user username=tomcat password=tomcat roles=tomcat/
  user username=both password=tomcat roles=tomcat,role1/
  user username=role1 password=tomcat roles=role1/
  user password=francesco roles=manager-script,manager-gui,admin
 username=francesco/
 /tomcat-users
 
 Server.xml:
 
 ?xml version='1.0' encoding='utf-8'?
 Server port=8005 shutdown=SHUTDOWN
  Listener className=org.apache.catalina.core.AprLifecycleListener
 SSLEngine=on /
  Listener className=org.apache.catalina.core.JasperListener /
  Listener
 className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
  Listener
 className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /
  Listener
 className=org.apache.catalina.core.ThreadLocalLeakPreventionListener /
  GlobalNamingResources
Resource name=jdbc/PoolConnessioni auth=Container
 type=javax.sql.DataSource
  maxActive=100 maxIdle=30 maxWait=1
  username=utentedb password=utentedb
 driverClassName=com.mysql.jdbc.Driver
 
 url=jdbc:mysql://localhost:3306/timesheet?zeroDateTimeBehavior=convertToNul
 l/  
 
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
  description=User database that can be updated and saved
  factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /
  /GlobalNamingResources
  Service name=Catalina
Connector port=8080 protocol=HTTP/1.1
   connectionTimeout=2
   redirectPort=8443 /  


Connector port=8443 protocol=HTTP/1.1 SSLEnabled=true
  maxThreads=150 scheme=https secure=true
  clientAuth=false sslProtocol=TLS /


Re: HttpServlet

2013-08-30 Thread Daniel Mikusa
On Aug 30, 2013, at 12:15 PM, Morten Bo Oelbye morte...@post3.tele.dk wrote:

First, don't top post.  Post at after the original message or post inline, like 
I'm doing here.

 Well, it is very simple from my point of wiev.

I would agree that it's not very clear what you are trying to accomplish.  The 
more detail you can provide the more likely it is someone on this list will be 
able to help you.

 The Tomcat act in the same way in 6 and 7 in window xp

Which versions of Tomcat 6 and Tomcat 7 have you tried?

 I have not done any editing in the Tomcat, other than those nessisary to do a 
 Tomcat connection using Apace in front with mod_jk.

Ok, good to know that you are running this through HTTPD with mod_jk.  Again, 
what versions are you using?

 The design use a Midlet url http connection to access my Tomcat, so it is not 
 a browser question.

Ok, I'm not familiar with Midlet.  Have you tried this is something more 
standard like a browser or with curl?  Are you still seeing the issue in those 
cases?

 The wireless module/ mobile has no display to do a response. So I am totally 
 dependent on some sort of handshaking with Tomcat.

What do you mean by handshaking here?  I'm not sure I follow you.

 Reading data from my module to Tomcat is not a problem. The data sent to 
 Tomcat are written to a file.

Ok, good.

 But in the same moment, I have sent back an acknowledge, from Tomcat to the 
 module,

What do you mean here exactly?  Did you write something to the servlet's 
OutputStream?  A code sample here would be helpful.

 Tomcat terminate the connection.

Do you see an exception when this occurs?  If so, include the stack trace.

 I only use string, as data.
 So, I do not know anything else, about how to garantee a read and write 
 connection.
 
 The web.xml is very simple:
 servlet
 servlet-nameGPS/servlet-name
 servlet-classGPS/servlet-class
 /servlet
 
 servlet-mapping
 servlet-nameGPS/servlet-name
 url-pattern/GPS/*/url-pattern
 /servlet-mapping
 
 The content.xml is also very simple:
 ?xml version=1.0 encoding=UTF-8?
 Context
 antiJARLocking=true
 path=
 reloadable=true
 unloadDelay=3000
 /
 
 If You want more I have copyed it all to:
 http://87.50.63.187/mytomcat/
 Only when the computer is on.

Please post anything relevant to the issue to this thread in the mailing list.  
This is helpful for someone who stumbles onto this thread days or months from 
now, experiencing the same problem as you.  If you post everything here, that 
person can then follow the complete thread.

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



8.0.0-RC1: WebSocket Exception

2013-08-30 Thread Igor Urisman
Dear all,

Getting the following exception with none of my code on the stack:

SEVERE: Error reading request, ignored
java.lang.IllegalStateException: The WebSocket session has been closed and
no method (apart from close()) may be called on a closed session
at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:607)
at
org.apache.tomcat.websocket.WsSession.getUserPrincipal(WsSession.java:536)
at
org.apache.tomcat.websocket.server.WsServerContainer.registerSession(WsServerContainer.java:308)
at
org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:131)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1550)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

May still be my problem, of course, but far as I can tell, all I do is call
Session.close()  once on this session.  I understand this may be too little
to go by,-- if so I am happy to try and isolate into a testcase.

Thanks in advance,
-Igor.


RE: configuring tomcat realm

2013-08-30 Thread Francesco Viscomi
Thanks really much.

Francesco


-Original Message-
From: Daniel Mikusa [mailto:dmik...@gopivotal.com] 
Sent: venerdì 30 agosto 2013 20.20
To: Tomcat Users List
Subject: Re: configuring tomcat realm

On Aug 30, 2013, at 12:13 PM, Francesco Viscomi fvisc...@gmail.com wrote:

 Hi,
 
 I've a tomcat-users.xml file in which user Francesco should can access to
 http://localhost:8080/manager: 
 
 I also have a server.xml that in the tag  GlobalNamingResources has
 declared 2 resource, one is for accessing to http://localhost:8080/manager
 and the other is for accessing via JDBC to a protected area in my
 application.
 
 Also I nested in the host tag the realm. 
 
 I've attached both tomcat_user.xml and server.xml at the and of this mail.

 When I try to start tomcat, with startup.bat I get the following error:
 






 ---
 
 GRAVE: Failed to load keystore type JKS with path C:\Documents and
 Settings\francesco/.keystore due to C:\Documents and
 Settings\francesco\.keystore (Impossibile trovare il file specificato)
 
 java.io.FileNotFoundException: C:\Documents and
Settings\francesco\.keystore
 (Impossibile trovare il file specificato)
 
at java.io.FileInputStream.open(Native Method)

This is saying that the default keystore could not be loaded.  It's trying
to load the default keystore because you've not specified on in your HTTPS
connector.  You'll either want to create a default keystore or set
keystoreFile on the Connector / tag.

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

 
 but the server starts the same.
 
 When I try to access http://localhost:8080/manager with user: francesco
and
 passwd: francesco
 
  I cannot access to the manager, I'm asking where I made a mistake.

See below.

 
 Thanks really much
 
 Francesco
 
 Italy
 
 Tomcat_user.xml
 
 ?xml version='1.0' encoding='utf-8'?
 !--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the License); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
 
  http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an AS IS BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
 --
 tomcat-users
 !--
  NOTE:  By default, no user is included in the manager-gui role required
  to operate the /manager/html web application.  If you wish to use this
 app,
  you must define such a user - the username and password are arbitrary.
 --
 !--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  !.. .. that surrounds them.
 --
 
  role rolename=tomcat/
  role rolename=role1/
  role rolename=AdminRole/
  role rolename=UserRole/
  user username=admin password=adminpw1 role=AdminRole/
  user username=user password=userpw01 role=UserRole/
  user username=tomcat password=tomcat roles=tomcat/
  user username=both password=tomcat roles=tomcat,role1/
  user username=role1 password=tomcat roles=role1/
  user password=francesco roles=manager-script,manager-gui,admin
 username=francesco/
 /tomcat-users
 
 Server.xml:
 
 ?xml version='1.0' encoding='utf-8'?
 Server port=8005 shutdown=SHUTDOWN
  Listener className=org.apache.catalina.core.AprLifecycleListener
 SSLEngine=on /
  Listener className=org.apache.catalina.core.JasperListener /
  Listener
 className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
  Listener
 className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /
  Listener
 className=org.apache.catalina.core.ThreadLocalLeakPreventionListener /
  GlobalNamingResources
Resource name=jdbc/PoolConnessioni auth=Container
 type=javax.sql.DataSource
  maxActive=100 maxIdle=30 maxWait=1
  username=utentedb password=utentedb
 driverClassName=com.mysql.jdbc.Driver
 

url=jdbc:mysql://localhost:3306/timesheet?zeroDateTimeBehavior=convertToNul
 l/  
 
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
  description=User database that can be updated and saved
  factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /
  /GlobalNamingResources
  Service name=Catalina
Connector port=8080 protocol=HTTP/1.1
   

Re: 8.0.0-RC1: WebSocket Exception

2013-08-30 Thread Niki Dokovski
On Sat, Aug 31, 2013 at 12:33 AM, Igor Urisman igor.uris...@gmail.comwrote:

 Dear all,

 Getting the following exception with none of my code on the stack:

 SEVERE: Error reading request, ignored
 java.lang.IllegalStateException: The WebSocket session has been closed and
 no method (apart from close()) may be called on a closed session
 at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:607)
 at
 org.apache.tomcat.websocket.WsSession.getUserPrincipal(WsSession.java:536)
 at

 org.apache.tomcat.websocket.server.WsServerContainer.registerSession(WsServerContainer.java:308)
 at

 org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:131)
 at

 org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
 at

 org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
 at

 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
 at

 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1550)
 at

 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at

 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:722)

 May still be my problem, of course, but far as I can tell, all I do is call
 Session.close()  once on this session.  I understand this may be too little
 to go by,-- if so I am happy to try and isolate into a testcase.


Do you call close during @OnOpen? This exception here is possible in this
case as register session call is done after invkoing applicaiton ep OnOpen?


 Thanks in advance,
 -Igor.



Re: 8.0.0-RC1: WebSocket Exception

2013-08-30 Thread Igor Urisman
That's correct.  I call close() inside onOpen().  You correctly call
onClose() on the endpoint as well, so my code is happy.  But a thread of
yours crashes milliseconds later. I have no problem changing my code to
call close() after onOpen() returns, of course.  But if you insist on this
semantics, perhaps you ought to throw an exception in my thread when I call
close() inside onOpen()?

Thanks!
-Igor.


On Fri, Aug 30, 2013 at 6:12 PM, Niki Dokovski nick...@gmail.com wrote:

 On Sat, Aug 31, 2013 at 12:33 AM, Igor Urisman igor.uris...@gmail.com
 wrote:

  Dear all,
 
  Getting the following exception with none of my code on the stack:
 
  SEVERE: Error reading request, ignored
  java.lang.IllegalStateException: The WebSocket session has been closed
 and
  no method (apart from close()) may be called on a closed session
  at
 org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:607)
  at
 
 org.apache.tomcat.websocket.WsSession.getUserPrincipal(WsSession.java:536)
  at
 
 
 org.apache.tomcat.websocket.server.WsServerContainer.registerSession(WsServerContainer.java:308)
  at
 
 
 org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:131)
  at
 
 
 org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
  at
 
 
 org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
  at
 
 
 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
  at
 
 
 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1550)
  at
 
 
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at
 
 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:722)
 
  May still be my problem, of course, but far as I can tell, all I do is
 call
  Session.close()  once on this session.  I understand this may be too
 little
  to go by,-- if so I am happy to try and isolate into a testcase.
 

 Do you call close during @OnOpen? This exception here is possible in this
 case as register session call is done after invkoing applicaiton ep OnOpen?

 
  Thanks in advance,
  -Igor.