Re: Loading a DeSerialized Class to WebabbClassLoader Question

2013-01-24 Thread Peter Lavin

Hi again Christopher,

thanks for your note and interest, some more details
inline...

On 01/23/2013 07:39 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-

ObjectInputStream should be using the context class loader of the
thread which should be the WebappClassLoader.

Can you show us your code (the part that actually loads the bytes
into the ClassLoader to define the class)?

The byte[] arrives at the service as a Base64 string. Base64 to byte[]
is trivial and has been ruled out as a problem. The class type is loaded
using a custom ClassLoader (code as follows)

public class FileClassLoader extends java.lang.ClassLoader {
public FileClassLoader(ClassLoader contextClassLoader) {
super(contextClassLoader);
}
public synchronized Class? arrayToClass(String name, byte[] ct,
boolean resolve) {
Class? c = defineClass(name, ct, 0, ct.length);
try {
this.loadClass(c.getName(), resolve);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return c;
}
}

This is called by...
ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();
Class? spClass = cl.arrayToClass(null, byArray, True);


Also, where does the de-serialization occur? I suspect in the
webapp, but you haven't described everything in detail (and the
details count).

The problem is (was) deserializing an instance of such an object. Code
uses is as follows...

public Object Base64StringToObject(String str) {
   Object outObj = null;
   if (str != null) {
  try {
ByteArrayInputStream bais = null;
bais = new ByteArrayInputStream(Base64.decode(str));
ObjectInputStream ois = new ObjectInputStream(bais);
outObj = ois.readObject();
} catch (IOException e) {
e.printStackTrace();
return null;
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
}
return outObj;
}

called by...
Object spB64Inst = su.Base64StringToObject(base64codeStrInstance);


In my service, I've loaded a full class definition and created an
instance of it. At this point it (afaik) must be in the cache of
the WebappClassLoader. However, when an ObjectInputStream is
called to... ois.readObject() on a byte[] of an instance of that
same class, it fail for ClassNotFoundException.


Hmm. Can you post the full stack trace of that CNFE?

Although the class (spClass) is now loaded in my custom class loader,
this fails, the CFNE is pasted at the very bottom of this note (for ease
of reading).

What works...
Using the code form this page...

http://www.jarvana.com/jarvana/view/org/apache/tomcat/tomcat-catalina/7.0.4/tomcat-catalina-7.0.4-sources.jar!/org/apache/catalina/util/CustomObjectInputStream.java?format=ok

And described here...
http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/util/CustomObjectInputStream.html

I implemented this in my application (i.e. not imported from a jar) and
use it like this (unchanged except for the package declaration)...

public Object Base64StringToObjectCustomOis(String str, ClassLoader cl) {
Object outObj = null;
if (str != null) {
try {
ByteArrayInputStream bais = null;
bais = new ByteArrayInputStream(Base64.decode(str));
CustomObjectInputStream cois = new 
CustomObjectInputStream(bais, cl);

  / next line is the main difference...

outObj = cois.readObject();

} catch (IOException e) {
e.printStackTrace();
return null;
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
}
return outObj;
}

And called like this... (cl same object as before)
Object spB64Inst =
su.Base64StringToObjectCustomOis(base64codeStrInstance,cl);

I've read (can't recall where) that the standard ObjectInputStream uses
a class loader of the JVM which may not have visiblilty on the 
WebappClassLoader due to the delegation model used by Tomcat. All the 
CustomObjectInputStream appears to do is to override one of the methods 
of OIS and pass a class loader, but in this case passes 'my' 
WebappClassLoader.


When I used this code, the problem went away.

FYI, (for reading the stacktrace), The class spClass is the type
definition for HelloWorldSP.java. The class in the application which is
running when this error happens is called FetchProfAbilities.java.

The object su in the above code refers to an instance of
SerializationUtilities (where the de/serialization takes place).

Please shout with any more questions. I appear to have overcome the
problem, but for my thesis, I would like to 

Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-24 Thread André Warnier

Hermes Flying wrote:

Hi,
So is there an explanation for this? All I am interested is make sure that 
after a limit, clients attempted to connect are stopped based on my 
configuration on maxThreads and accept count.
But I can not figure out how this works.



(This all being explained in vernacular language to which experts may object).

Threads in Tomcat serve to process requests.  Each Thread can process one 
request.
0 Threads = 0 requests being processed.
n Threads = n requests can be processed simultaneously (kind of).

Threads belong to either a Connector (by default), or an Executor (if you configure 
several Connectors to use an Executor, then they use the common pool of Threads of the 
Executor, instead of their own individual pool of Threads).


Having a common pool of Threads between several Connectors is normally more efficient and 
allows for a smoother operation.  Otherwise you could have the case that requests arriving 
through one Connector (e.g. HTTP) are being starved because this particular Connector has 
no more Threads available, while on the other hand another Connector (e.g. AJP) still has 
plenty of capacity.


The acceptCount is another matter entirely, working at a deeper level.
Before a Thread is assigned to process a request,
- the client requests a TCP connection to the server
- the server must accept this connection. If it doesn't within a certain time, the 
client will get an error (connect timeout).
- when the server accepts the connection, it goes into a queue. The length of that queue 
corresponds to the acceptCount of the corresponding Connector.

(If the accept queue is already full, the connection request will be rejected).
As long as the server does no further action, an accepted connection stays in the queue 
and the client request does not proceed. If that lasts a long time, the client may timeout 
(usually saying that the server is not responsive).
- whenever the server feels like it (for example, when it sees that it has at least one 
Thread free to handle a request), it will pop the first connection from the accept queue, 
and pass it to a Thread to be processed.
Now a Thread is assigned to process this request, so one less Thread is available in the 
pool of Threads.

- if another client connection happens now, it goes into the accept queue.
- whenever the original Thread is done processing the request, the Thread goes back into 
the pool of available Threads, and could be assigned to another client request currently 
sitting in the accept queue.


That's roughly how it works.
If it does not do so in your case, then it must mean that you are setting your parameters 
in the wrong place, and Tomcat is either not seeing them at all, or ignoring them because 
they are not where they should be.


The default Tomcat settings are chosen by people who know what they are doing, to obtain a 
reasonable Tomcat behaviour over a reasonable range of conditions.
If you change these settings, you can get a behaviour that is no longer reasonable or 
balanced.
For example, if you set the accepCount to 1 and maxThreads to 1, then you can have the 
following :

- 1 request accepted and allocated a Thread, thus in process
- 1 additional request being queued in the accept queue, waiting for a Thread to become 
available
And any additional client request arriving at that time will be rejected at the TCP level. 
 That will hardly result in an error that is understandable by the clients.


Intuitively, it does not seem to make a lot of sense to set up a whole machinery like a 
host, a JVM and a Tomcat, just to process one single request at a time.


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



Re: How to stop mod_jk.log in apache 2.2

2013-01-24 Thread lokesh borse
Hi Felix,

Somebody set JKLoglevel to Debug. I set it to info which writes only
necessary standard logs and it seems that its not occupying that much
space. Will moniter for 2-3 days more.

Regards,
Lokesh

On Sat, Nov 24, 2012 at 4:03 PM, Felix Schumacher 
felix.schumac...@internetallee.de wrote:

 Hi Lokesh,

 Am Freitag, den 23.11.2012, 18:12 +0530 schrieb lokesh borse:
  Hi Felix,
 
  Thanks for the link however I could not find how to stop mod_jk logs on
  Windows. There is a command line parameter given for Linux
 --disable-trace
  but could not find anything for windows. Can I set JKLoglevel in some
 file?
  If yes, where to set it?
 Yes, the directive JkLogLevel is set in a httpd-configuration file. I
 would search the filesystem for files containing the word JkLogLevel
 or JkLogStampFormat.

 There are a few other links on the previously given page, which can lead
 to even more information about the meaning of the keywords and where
 they are meant to be set.

 
  I am afraid of doing some testing as its our production server. If you
  provide some steps, that would really help me.
 I would be afraid to and I wonder of the reasons you had for not having
 an integration/testing environment :)

 Regards
  Felix
 
  Regards,
  Lokesh
 
  On Fri, Nov 23, 2012 at 12:13 PM, Felix Schumacher 
  felix.schumac...@internetallee.de wrote:
 
  
  
   lokesh borse lokesh@gmail.com schrieb:
  
   Hi,
   
   We are using Apache 2.2 installed on windows server 2008 Enterprise
   edition, 64 bit. I am extremely surprised that the log file mod_jk.log
   (Apache2.2/logs) is increasing so rapidly to 21 GB and I am  having
   space
   issue due to the same.
   
   I did search on internet but could not find any useful.
   
   Please help me with How to stop mod_jk.log in apache 2.2.
   Have you looked at
   http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html?
  
   You might find JkLogLevel interesting.
  
   Regards
   Felix
   
   
   Regards,
   Lokesh
  
  
  
   -
   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




Unexpected poller error

2013-01-24 Thread Vishal-sh Sharma
Hi ,

I get the following error in catalina.log when i connect the tomcat server over 
http. However https works fine.

24-Jan-2013 13:06:48.505 SEVERE [http-apr-11831-Poller-0] 
org.apache.tomcat.util.net.AprEndpoint$Poller.run Unexpected poller error
 java.lang.NoSuchMethodError: org.apache.tomcat.jni.Poll.addWithTimeout(JJIJ)I
at org.apache.tomcat.util.net.AprEndpoint$Poller.run(AprEndpoint.java:1287)

24-Jan-2013 13:06:52.237 SEVERE [http-apr-11831-Poller-0] 
org.apache.tomcat.util.net.AprEndpoint$Poller.run Unexpected poller error
 java.lang.NoSuchMethodError: org.apache.tomcat.jni.Poll.addWithTimeout(JJIJ)I
at org.apache.tomcat.util.net.AprEndpoint$Poller.run(AprEndpoint.java:1287)

24-Jan-2013 13:06:52.777 SEVERE [http-apr-11831-Poller-0] 
org.apache.tomcat.util.net.AprEndpoint$Poller.run Unexpected poller error
 java.lang.NoSuchMethodError: org.apache.tomcat.jni.Poll.addWithTimeout(JJIJ)I
at org.apache.tomcat.util.net.AprEndpoint$Poller.run(AprEndpoint.java:1287)

Problem exists with both tomcat-7.0.35 and tomcat-7.0.33 version. I am using 
the TC-Native-1.1.24. I do get the log message of library getting properly 
loaded as

24-Jan-2013 13:05:58.788 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.init Loaded APR based Apache 
Tomcat Native library 1.1.24 using APR version 1.4.6.
24-Jan-2013 13:05:58.790 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.init APR capabilities: IPv6 
[true], sendfile [true], accept filters [false], random [true].
24-Jan-2013 13:05:58.952 INFO [main] 
org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL 
successfully initialized (OpenSSL 1.0.1c 10 May 2012)

Any ideas

Thanks,
Vishal





---
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and delete this e-mail. Any unauthorized copying, 
disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional 
EU corporate and regulatory disclosures.

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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-24 Thread Hermes Flying
Hi,
I don't see how this answers my issue.
1) You say 0 threads means 0 requests being processed. This does not happen. 
Requests are being processed. No error noticed
2)You say: you are setting your parameters in the wrong place. This is not 
the case here.I already send an example server.xml. Will copy/paste it again 
bellow
3)It does not seem to make a lot of sense to set up a whole machinery like a 
host, a JVM and a Tomcat, just to process one single request at a time. I am 
not planning to do that, but I must see how the system behaves in various 
configuration. Tomcat does not seem to behave as expected in the trivial case.
4) The default Tomcat settings are chosen by people who know what they are 
doing, to obtain a reasonable Tomcat behaviour over a reasonable range 
of conditions What does this actually mean? That we are not supposed to 
configure Tomcat according to our needs?


?xml version='1.0' encoding='utf-8'?
Server port=8005 shutdown=SHUTDOWN

  !--APR library loader. Documentation at /docs/apr.html --
  Listener className=org.apache.catalina.core.AprLifecycleListener 
SSLEngine=on /
  !--Initialize Jasper prior to webapps are loaded. Documentation at 
/docs/jasper-howto.html --
  Listener className=org.apache.catalina.core.JasperListener /
  !-- Prevent memory leaks due to use of particular java/javax APIs--
  Listener
 className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
  !-- JMX Support for the Tomcat server.
 Documentation at /docs/non-existent.html --
  Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
  Listener 
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /

  !-- Global JNDI resources
   Documentation at /docs/jndi-resources-howto.html
  --
  GlobalNamingResources
    !-- Editable user database that can also be used by
 UserDatabaseRealm to authenticate users
    --
    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

  !-- A Service is a collection of one or more Connectors that share
   a single Container Note:  A Service is not itself a Container, 
   so you may not define subcomponents such as Valves at this level.
   Documentation at /docs/config/service.html
   --
  Service name=Catalina
  
    !--The connectors can use a shared executor, you can define one or more 
named thread pools--
    !--
   
 Executor name=tomcatThreadPool namePrefix=catalina-exec- 
    maxThreads=150 minSpareThreads=4/
    --
    
    
    !-- A Connector represents an endpoint by which requests are received
 and responses are returned. Documentation at :
 Java HTTP Connector: /docs/config/http.html (blocking  non-blocking)
 Java AJP  Connector: /docs/config/ajp.html
 APR (HTTP/AJP) Connector: /docs/apr.html
 Define a non-SSL HTTP/1.1 Connector on port 8080
    --
    Connector port=8080 maxThreads=0 acceptCount=1
 protocol=HTTP/1.1 
   connectionTimeout=2 
   redirectPort=8443 /

    !-- Define an AJP 1.3 Connector on port 8009 --
    Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /


    !-- An Engine represents the entry point (within Catalina) that processes
 every request.  The Engine implementation for Tomcat stand alone
 analyzes the HTTP headers included with the request, and passes them
 on to the appropriate Host (virtual host).
 Documentation at /docs/config/engine.html
 --

    !-- You should set jvmRoute to support load-balancing via AJP ie :
    Engine name=Catalina defaultHost=localhost jvmRoute=jvm1 
    -- 
    Engine name=Catalina defaultHost=localhost


  !-- This Realm uses the UserDatabase configured in the global JNDI
   resources under the key UserDatabase.  Any edits
   that are performed against this UserDatabase are immediately
   available for use by the Realm.  --
  Realm
 className=org.apache.catalina.realm.UserDatabaseRealm
 resourceName=UserDatabase/

  !-- Define the default virtual host
   Note: XML Schema validation will not work with Xerces 2.2.
   --
  Host name=localhost  appBase=webapps
    unpackWARs=true autoDeploy=true
    xmlValidation=false xmlNamespaceAware=false


  /Host
    /Engine
  /Service
/Server





 From: André Warnier a...@ice-sa.com
To: Tomcat Users List users@tomcat.apache.org 
Sent: Thursday, January 24, 2013 11:53 AM
Subject: Re: Fw: Can not understand how maxThreads of Connectors works
 
Hermes Flying wrote:
 Hi,
 So is there an explanation for this? All I am interested is make sure that 
 after a limit, clients attempted to connect are stopped based on my 
 

Tomcat6+webapps+log4j

2013-01-24 Thread Tiago Sousa

Hello to all.

I have tomcat 6 using JULI for logging (logging.properties in conf dir) 
plus several webapps using its own log4j.properties.


I need to centralized all the logs so i thought to put a global/shared 
log4j.properties in $CATALINA_BASE\lib so that tomcat and each webapp 
can be controlled through this file.


The problem i'm facing is that no logs are produced.

At this time i'm trying to configure just TOMCAT, no webapps, to log 
through log4j but still no logs are produced. I've folowed the tutorial 
in Apache logging webpage with the standard log4j.properties. No logs in 
$CATALINA_BASE\logs.


Can you help me saying what mistakes i am doing in this basic 
configuration (tomcat and no apps)?


Thanks.

Tiago

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



RE: Tomcat6+webapps+log4j

2013-01-24 Thread Justin Rosenberg
You might try putting the log4j properties file (or xml) in a shared
loader location.

In catalina.properties add something like this:

shared.loader=${catalina.base}/conf/properties

and then put the properties file there.

~Justin


-Original Message-
From: Tiago Sousa [mailto:tiago-a-so...@ext.ptinovacao.pt] 
Sent: Thursday, January 24, 2013 10:01 AM
To: users@tomcat.apache.org
Subject: Tomcat6+webapps+log4j

Hello to all.

I have tomcat 6 using JULI for logging (logging.properties in conf dir)
plus several webapps using its own log4j.properties.

I need to centralized all the logs so i thought to put a global/shared
log4j.properties in $CATALINA_BASE\lib so that tomcat and each webapp
can be controlled through this file.

The problem i'm facing is that no logs are produced.

At this time i'm trying to configure just TOMCAT, no webapps, to log
through log4j but still no logs are produced. I've folowed the tutorial
in Apache logging webpage with the standard log4j.properties. No logs in
$CATALINA_BASE\logs.

Can you help me saying what mistakes i am doing in this basic
configuration (tomcat and no apps)?

Thanks.

Tiago

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


CONFIDENTIALITY NOTICE:
The information in this message, and any attachment, is intended for the 
sole use of the individual and entity to whom it is addressed. This 
information may be privileged, confidential, and protected from 
disclosure. If you are not the intended recipient you are hereby notified 
that you have received this communication in error and that any review, 
disclosure, dissemination, distribution or copying of it, or its contents, 
is strictly prohibited. If you think that you have received this message 
in error please notify the sender and destroy all copies of this 
communication and any attachments. Thank you.

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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-24 Thread André Warnier

Hermes Flying wrote:

Hi,
I don't see how this answers my issue.
1) You say 0 threads means 0 requests being processed. This does not happen. 
Requests are being processed. No error noticed


It is not only me saying it. The on-line documentation at 
https://tomcat.apache.org/tomcat-7.0-doc/config/http.html

says this :
quote

maxThreads  

The maximum number of request processing threads to be created by this Connector, which 
therefore determines the maximum number of simultaneous requests that can be handled. If 
not specified, this attribute is set to 200. If an executor is associated with this 
connector, this attribute is ignored as the connector will execute tasks using the 
executor rather than an internal thread pool.


unquote

Now, considering this, there are a number of possibilities :
- the documentation is totally wrong
- there is a bug in Tomcat
- your Tomcat server is not using this server.xml
- or, it being rather unlikely that processing 0 requests is what a normal user would 
want, the Tomcat developers have coded this so that an obviously nonsensical value of 0 
would result in the default (of 200) being applied.


Pick any one of the above.


2)You say: you are setting your parameters in the wrong place. This is not 
the case here.I already send an example server.xml. Will copy/paste it again bellow


Yes, but we cannot check from here if this is really the server.xml that your Tomcat is 
reading. Are you absolutely sure it is ? How ?



3)It does not seem to make a lot of sense to set up a whole machinery like a host, 
a JVM and a Tomcat, just to process one single request at a time. I am not planning 
to do that, but I must see how the system behaves in various configuration. Tomcat does 
not seem to behave as expected in the trivial case.


The trivial case is 0 Threads ? What happens when you set it to 1 ?

4) The default Tomcat settings are chosen by people who know what they are 
doing, to obtain a reasonable Tomcat behaviour over a reasonable range 
of conditions What does this actually mean? That we are not supposed to configure Tomcat according to our needs?




Of course you can. But if you are using nonsensical values, do you expect a sensible 
behaviour ?

Come on, man. This is open-source software, that you get to use for free.
This is not to say that it is not good software, nor that the developers do not try to 
make it as efficient and reliable as possible, nor that the people writing the 
documentation (also for free) do not make every effort to write it well and accurately.
On the other hand, it is kind of expected that people using Tomcat and configuring it, 
would use a bit of judgment and give the developers a bit of slack.


I am not a developer of Tomcat, but what I tried to provide in my explanation is a 
guideline as to how these parameters are supposed to work. That was to help you maybe find 
the reason for what appears to you as not working, but which apparently other people 
cannot reproduce.


I just tried with Tomcat 6.0.24 under Windows, and when I set
maxThreads=0 in the HTTP Connector, Tomcat starts up without error in the log. But if I 
try to access it with a browser, the browser loops saying connecting.. and never goes 
past that point.  If I set maxThreads=1, then Tomcat is answering with the homepage.


Same thing with Tomcat 7.0.21.

So I would say : check that the server.xml below is really the one that Tomcat 
is using.

(Additionally, I would say that it seems that when Tomcat is configured to not have any 
Threads to process requests, well it just does not process any.  Which seems to me like 
sensible behaviour under adverse circumstances.)






?xml version='1.0' encoding='utf-8'?
Server port=8005 shutdown=SHUTDOWN

  !--APR library loader. Documentation at /docs/apr.html --
  Listener className=org.apache.catalina.core.AprLifecycleListener 
SSLEngine=on /
  !--Initialize Jasper prior to webapps are loaded. Documentation at 
/docs/jasper-howto.html --
  Listener className=org.apache.catalina.core.JasperListener /
  !-- Prevent memory leaks due to use of particular java/javax APIs--
  Listener
 className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
  !-- JMX Support for the Tomcat server.
 Documentation at /docs/non-existent.html --
  Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
  Listener 
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /

  !-- Global JNDI resources
   Documentation at /docs/jndi-resources-howto.html
  --
  GlobalNamingResources
!-- Editable user database that can also be used by
 UserDatabaseRealm to authenticate users
--
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

  

Re: Tomcat6+webapps+log4j

2013-01-24 Thread Tiago Sousa

Em 24/01/2013 17:08, Justin Rosenberg escreveu:

You might try putting the log4j properties file (or xml) in a shared
loader location.

In catalina.properties add something like this:

shared.loader=${catalina.base}/conf/properties

and then put the properties file there.

~Justin


-Original Message-
From: Tiago Sousa [mailto:tiago-a-so...@ext.ptinovacao.pt]
Sent: Thursday, January 24, 2013 10:01 AM
To: users@tomcat.apache.org
Subject: Tomcat6+webapps+log4j

Hello to all.

I have tomcat 6 using JULI for logging (logging.properties in conf dir)
plus several webapps using its own log4j.properties.

I need to centralized all the logs so i thought to put a global/shared
log4j.properties in $CATALINA_BASE\lib so that tomcat and each webapp
can be controlled through this file.

The problem i'm facing is that no logs are produced.

At this time i'm trying to configure just TOMCAT, no webapps, to log
through log4j but still no logs are produced. I've folowed the tutorial
in Apache logging webpage with the standard log4j.properties. No logs in
$CATALINA_BASE\logs.

Can you help me saying what mistakes i am doing in this basic
configuration (tomcat and no apps)?

Thanks.

Tiago

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


CONFIDENTIALITY NOTICE:
The information in this message, and any attachment, is intended for the
sole use of the individual and entity to whom it is addressed. This
information may be privileged, confidential, and protected from
disclosure. If you are not the intended recipient you are hereby notified
that you have received this communication in error and that any review,
disclosure, dissemination, distribution or copying of it, or its contents,
is strictly prohibited. If you think that you have received this message
in error please notify the sender and destroy all copies of this
communication and any attachments. Thank you.

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


Hi.

Thanks for your reply.
I had already tried your suggestion with no results.
As said in catalina.properties:
If left as blank, the common loader will be used as Catalina's 
shared loader.

which is the place where log4j.properties is.

Thank you again.

Tiago



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



Re: The APR based Apache Tomcat Native library was not found

2013-01-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Andrew,

On 1/23/13 9:54 PM, Andrew Winter wrote:
 Sorry I forgot the versions of things I am using.
 
 Tomcat 6.0.36 Red Hat Enterprise Linux Server release 6.2
 (Santiago) Java 7u11 (32 bit)
 
 I think I found the problem, though. I have to run a 32 bit jvm
 because a COBOL odbc driver we have to use only comes in a 32 bit
 version. But the Red Hat box is 64 bit and when I ran 'file' on the
 libtcnative.so I compiled I found that it is 64 bit. So I think I
 just need to do a little Googling to see how to compile a 32 bit
 version and it could work.

I think you'll need 32-bit APR and OpenSSL as well, but I've never
tried to do mixed 32-bit and 64-bit support libraries. libtcnative.so
absolutely must be 32-bit to be loaded by a 32-bit JVM.

Reading the Debian multi-arch docs (I'm on Debian), it doesn't sound
like a simple install -32 libapr... you'll need a whole set of
32-bit support libraries, etc.

What's a COBOL ODBC driver? :(

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

iEYEAREIAAYFAlEBbNAACgkQ9CaO5/Lv0PBmMgCfWS3jc3OFGHamEj6vYsKw7Mun
9PgAoKzOudT+RxkvNkcu7v0CEPwoXPmK
=nibJ
-END PGP SIGNATURE-

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



Re: Loading a DeSerialized Class to WebabbClassLoader Question

2013-01-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Peter,

On 1/24/13 4:27 AM, Peter Lavin wrote:
 java.lang.ClassNotFoundException:
 common.core.providers.HelloWorldSP at 
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)

 
at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)

 
at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:264) at 
 java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:621) 
 at 
 java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)

 
at
 java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)

 
at
 java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)

 
at
 java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346) 
 at
 java.io.ObjectInputStream.readObject(ObjectInputStream.java:368) 
 at 
 common.utilities.SerializationUtilities.Base64StringToObject(SerializationUtilities.java:165)

That
 
sure looks like it's using the WebappClassLoader to try to load
the class.

After calling:

 ClassLoader contextClassLoader = 
 Thread.currentThread().getContextClassLoader(); Class? spClass =
 cl.arrayToClass(null, byArray, True);

What do you get back? Does the Class have the right name, etc?

You are fetching the current context ClassLoader and then using cl
to define your Class. Where do you instantiate your FileClassLoader?
Do you ever set it as the context ClassLoader? If not, it's never
going to work.

I think you can do this without the CustomObjectInputStream class (as
long as you don't need to run under a SecurityManager).

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

iEYEAREIAAYFAlEBcF0ACgkQ9CaO5/Lv0PDENgCghLaRu7LdIfbIrzR3Ubi8n3TX
HLsAmgJPcEpMkW+knGuVxeh7WsnZyKhW
=+pi2
-END PGP SIGNATURE-

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



Re: The APR based Apache Tomcat Native library was not found

2013-01-24 Thread Andrew Winter
We have a COBOL back end that handles the core functions of our product.
The only way we have for the servlet based front end to get at that data is
via a type 1 odbc driver.  It is a real pain because it is not thread safe
so we have to funnel all the traffic through a single thread.

Anyway, I got the APR working and managed to fire up Tomcat with the APR
connector but my original problem (in another email) remains. That being
that calls to a Comet servlet I created return a 400 response saying that
the URL does not support get requests.  I tried NIO first and thought that
APR would perhaps solve my problem. So now I am giving up and trying to
have a go with glassfish instead.

Thanks for your help!!


On Thu, Jan 24, 2013 at 12:18 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Andrew,

 On 1/23/13 9:54 PM, Andrew Winter wrote:
  Sorry I forgot the versions of things I am using.
 
  Tomcat 6.0.36 Red Hat Enterprise Linux Server release 6.2
  (Santiago) Java 7u11 (32 bit)
 
  I think I found the problem, though. I have to run a 32 bit jvm
  because a COBOL odbc driver we have to use only comes in a 32 bit
  version. But the Red Hat box is 64 bit and when I ran 'file' on the
  libtcnative.so I compiled I found that it is 64 bit. So I think I
  just need to do a little Googling to see how to compile a 32 bit
  version and it could work.

 I think you'll need 32-bit APR and OpenSSL as well, but I've never
 tried to do mixed 32-bit and 64-bit support libraries. libtcnative.so
 absolutely must be 32-bit to be loaded by a 32-bit JVM.

 Reading the Debian multi-arch docs (I'm on Debian), it doesn't sound
 like a simple install -32 libapr... you'll need a whole set of
 32-bit support libraries, etc.

 What's a COBOL ODBC driver? :(

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

 iEYEAREIAAYFAlEBbNAACgkQ9CaO5/Lv0PBmMgCfWS3jc3OFGHamEj6vYsKw7Mun
 9PgAoKzOudT+RxkvNkcu7v0CEPwoXPmK
 =nibJ
 -END PGP SIGNATURE-

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




Re: Loading a DeSerialized Class to WebabbClassLoader Question

2013-01-24 Thread Peter Lavin


hi Chris, some more details, I'd left out a line in my code snippet this 
morning,


On 01/24/2013 05:33 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE- Hash: SHA256

Peter,

On 1/24/13 4:27 AM, Peter Lavin wrote:




After calling:


ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader(); Class?  spClass
= cl.arrayToClass(null, byArray, True);




You are fetching the current context ClassLoader and then using cl
to define your Class. Where do you instantiate your FileClassLoader?
Do you ever set it as the context ClassLoader? If not, it's never
going to work.


// I left out a line of code this morning when writing this, this is the
sequence of the code...


ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();

// this line was missing in earlier note
//this calls the class below
FileClassLoader cl = new FileClassLoader(contextClassLoader);

Class? spClass = cl.arrayToClass(null, byArray, True);

// my custom class loader code...

public class FileClassLoader extends java.lang.ClassLoader {
public FileClassLoader(ClassLoader contextClassLoader) {
super(contextClassLoader);
}
public synchronized Class? arrayToClass(String name, byte[] ct,
boolean resolve) {
Class? c = defineClass(name, ct, 0, ct.length);
try {
this.loadClass(c.getName(), resolve);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return c;
}
}






What do you get back? Does the Class have the right name, etc?

Yes, this loads the class ok, with the correct name.



I think you can do this without the CustomObjectInputStream class
(as long as you don't need to run under a SecurityManager).
Ok, that's interesting, I won't be using SecuritManager as this is 
research software,



regards
Peter






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

iEYEAREIAAYFAlEBcF0ACgkQ9CaO5/Lv0PDENgCghLaRu7LdIfbIrzR3Ubi8n3TX
HLsAmgJPcEpMkW+knGuVxeh7WsnZyKhW =+pi2 -END PGP SIGNATURE-

-



To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

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



--
with best regards,
Peter Lavin,
PhD Candidate,
CAG - Computer Architecture  Grid Research Group,
Lloyd Institute, 005,
Trinity College Dublin, Ireland.
+353 1 8961536

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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-24 Thread Hermes Flying
Hi,

I am sure that this server.xml is the one used, since there is no other present.
Also as mentioned my plan is to cut network access after a threshold. I used 
such small values e.g. 0,1,2 to see what happens. 
Also note that I am not using SUN JVM but IBM. Not sure if this makes a 
difference





 From: André Warnier a...@ice-sa.com
To: Tomcat Users List users@tomcat.apache.org 
Sent: Thursday, January 24, 2013 7:14 PM
Subject: Re: Fw: Can not understand how maxThreads of Connectors works
 
Hermes Flying wrote:
 Hi,
 I don't see how this answers my issue.
 1) You say 0 threads means 0 requests being processed. This does not happen. 
 Requests are being processed. No error noticed

It is not only me saying it. The on-line documentation at 
https://tomcat.apache.org/tomcat-7.0-doc/config/http.html
says this :
quote

maxThreads    

The maximum number of request processing threads to be created by this 
Connector, which therefore determines the maximum number of simultaneous 
requests that can be handled. If not specified, this attribute is set to 200. 
If an executor is associated with this connector, this attribute is ignored as 
the connector will execute tasks using the executor rather than an internal 
thread pool.

unquote

Now, considering this, there are a number of possibilities :
- the documentation is totally wrong
- there is a bug in Tomcat
- your Tomcat server is not using this server.xml
- or, it being rather unlikely that processing 0 requests is what a normal user 
would want, the Tomcat developers have coded this so that an obviously 
nonsensical value of 0 would result in the default (of 200) being applied.

Pick any one of the above.

 2)You say: you are setting your parameters in the wrong place. This is not 
 the case here.I already send an example server.xml. Will copy/paste it again 
 bellow

Yes, but we cannot check from here if this is really the server.xml that your 
Tomcat is reading. Are you absolutely sure it is ? How ?

 3)It does not seem to make a lot of sense to set up a whole machinery like a 
 host, a JVM and a Tomcat, just to process one single request at a time. I am 
 not planning to do that, but I must see how the system behaves in various 
 configuration. Tomcat does not seem to behave as expected in the trivial case.

The trivial case is 0 Threads ? What happens when you set it to 1 ?

 4) The default Tomcat settings are chosen by people who know what they are 
 doing, to obtain a reasonable Tomcat behaviour over a reasonable range of 
 conditions What does this actually mean? That we are not supposed to 
 configure Tomcat according to our needs?
 

Of course you can. But if you are using nonsensical values, do you expect a 
sensible behaviour ?
Come on, man. This is open-source software, that you get to use for free.
This is not to say that it is not good software, nor that the developers do not 
try to make it as efficient and reliable as possible, nor that the people 
writing the documentation (also for free) do not make every effort to write it 
well and accurately.
On the other hand, it is kind of expected that people using Tomcat and 
configuring it, would use a bit of judgment and give the developers a bit of 
slack.

I am not a developer of Tomcat, but what I tried to provide in my explanation 
is a guideline as to how these parameters are supposed to work. That was to 
help you maybe find the reason for what appears to you as not working, but 
which apparently other people cannot reproduce.

I just tried with Tomcat 6.0.24 under Windows, and when I set
maxThreads=0 in the HTTP Connector, Tomcat starts up without error in the 
log. But if I try to access it with a browser, the browser loops saying 
connecting.. and never goes past that point.  If I set maxThreads=1, then 
Tomcat is answering with the homepage.

Same thing with Tomcat 7.0.21.

So I would say : check that the server.xml below is really the one that Tomcat 
is using.

(Additionally, I would say that it seems that when Tomcat is configured to not 
have any Threads to process requests, well it just does not process any.  Which 
seems to me like sensible behaviour under adverse circumstances.)



 
 ?xml version='1.0' encoding='utf-8'?
 Server port=8005 shutdown=SHUTDOWN
 
   !--APR library loader. Documentation at /docs/apr.html --
   Listener className=org.apache.catalina.core.AprLifecycleListener 
SSLEngine=on /
   !--Initialize Jasper prior to webapps are loaded. Documentation at 
/docs/jasper-howto.html --
   Listener className=org.apache.catalina.core.JasperListener /
   !-- Prevent memory leaks due to use of particular java/javax APIs--
   Listener
  className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
   !-- JMX Support for the Tomcat server.
  Documentation at /docs/non-existent.html --
   Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
   Listener 

Re: Unexpected poller error

2013-01-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Vishal,

On 1/24/13 8:47 AM, Vishal-sh Sharma wrote:
 I get the following error in catalina.log when i connect the
 tomcat server over http. However https works fine.
 
 24-Jan-2013 13:06:48.505 SEVERE [http-apr-11831-Poller-0]
 org.apache.tomcat.util.net.AprEndpoint$Poller.run Unexpected poller
 error java.lang.NoSuchMethodError:
 org.apache.tomcat.jni.Poll.addWithTimeout(JJIJ)I at
 org.apache.tomcat.util.net.AprEndpoint$Poller.run(AprEndpoint.java:1287)

That
 
method certainly is defined in Poll.java:91 in Tomcat 7.0.x trunk:

public static native int addWithTimeout(long pollset, long sock,
int reqevents, long timeout);

native/src/poll.c has it, too:

TCN_IMPLEMENT_CALL(jint, Poll, addWithTimeout)(TCN_STDARGS, jlong pollset,
   jlong socket, jint
reqevents,
   jlong socket_timeout)

Since you aren't getting a linkage error of some kind, this seems to
be a Java-related problem (and not a native problem). If the method
was missing from the native library, you'd get UnsatisfiedLinkError.

Are you sure you have a clean Tomcat install?

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

iEYEAREIAAYFAlEBhLoACgkQ9CaO5/Lv0PC+4ACfcp2sNSbR82N81AKQIFgBT5E5
jmYAoIcK7r49ZrK98Bqns3LNdG9SKSy3
=sa47
-END PGP SIGNATURE-

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



Re: The APR based Apache Tomcat Native library was not found

2013-01-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Andrew,

On 1/24/13 12:59 PM, Andrew Winter wrote:
 We have a COBOL back end that handles the core functions of our
 product. The only way we have for the servlet based front end to
 get at that data is via a type 1 odbc driver.  It is a real pain
 because it is not thread safe so we have to funnel all the traffic
 through a single thread.
 
 Anyway, I got the APR working and managed to fire up Tomcat with
 the APR connector but my original problem (in another email)
 remains. That being that calls to a Comet servlet I created return
 a 400 response saying that the URL does not support get requests.
 I tried NIO first and thought that APR would perhaps solve my
 problem. So now I am giving up and trying to have a go with
 glassfish instead.

Please don't give up on Tomcat just yet. Give the (smarter) Tomcat
devs a chance to take a look at this issue. Comet should be enabled by
default on all connectors, and I don't know why you are getting the
does not support GET error.

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

iEYEAREIAAYFAlEBhR8ACgkQ9CaO5/Lv0PDw5ACeI2/XeztcCWgJ4e4PPjXFqLqO
7N8An2+mW7Wn6KZeLxnkRVYG73y6xGsb
=eMT+
-END PGP SIGNATURE-

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



Re: Loading a DeSerialized Class to WebabbClassLoader Question

2013-01-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Peter,

On 1/24/13 1:01 PM, Peter Lavin wrote:
 ClassLoader contextClassLoader = 
 Thread.currentThread().getContextClassLoader();
 
 // this line was missing in earlier note //this calls the class
 below FileClassLoader cl = new
 FileClassLoader(contextClassLoader);
 
 Class? spClass = cl.arrayToClass(null, byArray, True);

What if you try this:

ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();

FileClassLoader cl = new FileClassLoader(contextClassLoader);

Class? spClass = cl.arrayToClass(null, byArray, True);

Thread.currentThread().setContextClassLoader(cl);

Tomcat changes the context ClassLoader all the time, and you'll want
your ClassLoaders to remember previously-loaded classes, so this isn't
a great solution in general.

That's why I suggested that you use a loader configured in
context.xml: that will let you define your own ClassLoader where you
can call arrayToClass at any point and not have to set the context
ClassLoader all the time.

If you've got something working and you're happy, then there's nothing
left to do. If it were me, I'd use a custom Loader for my webapp and
use Java's ObjectInputStream.

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

iEYEAREIAAYFAlEBhhUACgkQ9CaO5/Lv0PCIkwCfc0MmIyzRqKPuFeY0legimEEG
bA0AoLN//xy4svN8r7TsfqYtrVdaV7+t
=FDOH
-END PGP SIGNATURE-

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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

André,

On 1/24/13 12:14 PM, André Warnier wrote:
 Now, considering this, there are a number of possibilities : - the
 documentation is totally wrong - there is a bug in Tomcat - your
 Tomcat server is not using this server.xml - or, it being rather
 unlikely that processing 0 requests is what a normal user would
 want, the Tomcat developers have coded this so that an obviously
 nonsensical value of 0 would result in the default (of 200) being
 applied.

That last one is not true: the code will happily accept maxThreads=0
but then will throw an exception when the connector tries to actually
start its Executor.

I suspect Hermes is editing some unrelated server.xml file: his
observations seem totally in-line with that hypothesis.

Hermes, try modifying your server.xml file to be syntactically
incorrect. For example, put a !-- into the middle of the file and
try to start Tomcat. If it still starts, you are editing the wrong file.

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

iEYEAREIAAYFAlEBhv8ACgkQ9CaO5/Lv0PDUWgCfWY/BUyhl4rQkZUC19SNB2P72
sckAn2dZwfEd7uVZz6eg0HuPmuZC81j6
=YVBj
-END PGP SIGNATURE-

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



Re: Comet problem - HTTP method GET is not supported by this URL

2013-01-24 Thread Mark Thomas
On 22/01/2013 16:52, Andrew Winter wrote:
 I am trying to implement a Comet process.
 Tomcat 6.0.36
 Red Hat Enterprise Linux Server release 6.2 (Santiago)
 Java 7u11 (32 bit)
 
 I have implemented CometProcessor.  I am using the NIO connector.
 When I try the servlet I get: HTTP method GET is not supported by this URL
 Am I doing something wrong?

NIO Connector config from server.xml?

Mark


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



Re: Comet problem - HTTP method GET is not supported by this URL

2013-01-24 Thread Andrew Winter
Here is the NIO connector:

Connector connectionTimeout=2 port=8080
   protocol=org.apache.coyote.http11.Http11NioProtocol
   redirectPort=9192/

Normal servlet requests work, just not the Comet.

After I sent this email, I installed the APR  and switched back to the
standard connector:
Connector port=8080 protocol=HTTP/1.1
   connectionTimeout=2
   redirectPort=9192 /

The log then showed that the APR connector was being used, but I get the
same message when I try to use the comet servlet.

Thank you!


On Thu, Jan 24, 2013 at 2:45 PM, Mark Thomas ma...@apache.org wrote:

 On 22/01/2013 16:52, Andrew Winter wrote:
  I am trying to implement a Comet process.
  Tomcat 6.0.36
  Red Hat Enterprise Linux Server release 6.2 (Santiago)
  Java 7u11 (32 bit)
 
  I have implemented CometProcessor.  I am using the NIO connector.
  When I try the servlet I get: HTTP method GET is not supported by this
 URL
  Am I doing something wrong?

 NIO Connector config from server.xml?

 Mark


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




RE: JAAS Module Tomcat 7 (Bundling and JNDI Datasource access)

2013-01-24 Thread Justin Rosenberg
I was loading the datasource using Spring

jee:jndi-lookup id=websecurDataSource jndi-name=foo/bar /

In order for it to work it must be

jee:jndi-lookup id=websecurDataSource
jndi-name=java:comp/env/foo/bar /

Also the Realm definition was not correct.  The name of the JAAS class
should be in a jaas.conf file, not in the Realm definition.

Hope that helps someone else running into similar issues.  Thanks
whartung for the help.

~Justin


-Original Message-
From: Justin Rosenberg [mailto:rosenbe...@crlcorp.com] 
Sent: Wednesday, January 23, 2013 7:06 PM
To: users@tomcat.apache.org
Subject: JAAS Module Tomcat 7 (Bundling and JNDI Datasource access)

I'm running into issues accessing a JNDI datasource in a JAAS module.

 

Can I bundle a JAAS module in my war file?  When I try to do this by
defining the Realm in the context.xml of the web application I get a
java.lang.ClassNotFoundException.  The documentation specifies I must
put the module in the lib directory.  Can someone confirm this?

 

When I deploy all the JAAS module and all required dependencies in a
directory listed under common.loader, I run into the following two
issue.

The JAAS module cannot seem to load the JNDI datasource
javax.naming.NameNotFoundException: Name [foo/bar] is not bound in this
Context. Unable to find [foo].

 

Is there a way to expose a JNDI datasource to a JAAS module?

 

Tomcat Version: 7.0.34

 

Datasource is defined in conf/server.xml as:

GlobalNamingResources

Resource auth=Container
name=foo/bar type=javax.sql.DataSource
driverClassName=oracle.jdbc.OracleDriver

 
url=jdbc:oracle:thin:@... username=user password=password /

/GlobalNamingResources

 

The datasource is exposed in conf/context.xml as:

ResourceLink name=foo/bar global=foo/bar
type=javax.sql.DataSource/

 

The JAAS module is defined at either the server.xml or context.xml of
the web application as:

Realm className=com.example.JAASModule
appName=auth-login userClassNames=com.example.SimplePrincipal
roleClassNames=com.example.SimplePrincipal /

 

If defined in the server.xml the server fails to start.  If it's in the
application context.xml it fails when the application tries to load. 

 

Thank you,

Justin

 


CONFIDENTIALITY NOTICE:
The information in this message, and any attachment, is intended for the
sole use of the individual and entity to whom it is addressed. This
information may be privileged, confidential, and protected from
disclosure. If you are not the intended recipient you are hereby
notified that you have received this communication in error and that any
review, disclosure, dissemination, distribution or copying of it, or its
contents, is strictly prohibited. If you think that you have received
this message in error please notify the sender and destroy all copies of
this communication and any attachments. Thank you.

CONFIDENTIALITY NOTICE:
The information in this message, and any attachment, is intended for the 
sole use of the individual and entity to whom it is addressed. This 
information may be privileged, confidential, and protected from 
disclosure. If you are not the intended recipient you are hereby notified 
that you have received this communication in error and that any review, 
disclosure, dissemination, distribution or copying of it, or its contents, 
is strictly prohibited. If you think that you have received this message 
in error please notify the sender and destroy all copies of this 
communication and any attachments. Thank you.

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



Re: Can not understand how maxThreads of Connectors works

2013-01-24 Thread Ben Stringer


On 25/01/2013, at 6:09 AM, Christopher Schultz ch...@christopherschultz.net 
wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256
 
 André,
 
 On 1/24/13 12:14 PM, André Warnier wrote:
 Now, considering this, there are a number of possibilities : - the
 documentation is totally wrong - there is a bug in Tomcat - your
 Tomcat server is not using this server.xml - or, it being rather
 unlikely that processing 0 requests is what a normal user would
 want, the Tomcat developers have coded this so that an obviously
 nonsensical value of 0 would result in the default (of 200) being
 applied.
 
 That last one is not true: the code will happily accept maxThreads=0
 but then will throw an exception when the connector tries to actually
 start its Executor.
 
 I suspect Hermes is editing some unrelated server.xml file: his
 observations seem totally in-line with that hypothesis.
 
 Hermes, try modifying your server.xml file to be syntactically
 incorrect. For example, put a !-- into the middle of the file and
 try to start Tomcat. If it still starts, you are editing the wrong file.

And if using a Linux OS, you can use lsof to identify what file descriptors 
the tomcat JVM has opened, this is handy for tracking down issues with 
misplaced  conf files.

Cheers, Ben

 
 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
 
 iEYEAREIAAYFAlEBhv8ACgkQ9CaO5/Lv0PDUWgCfWY/BUyhl4rQkZUC19SNB2P72
 sckAn2dZwfEd7uVZz6eg0HuPmuZC81j6
 =YVBj
 -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



Load properties file from Tomcat directory

2013-01-24 Thread Justin Rosenberg
Is there a to load a properties file that is dropped in the
${catalina.base}/lib directory?

 

When I try the following it returns null:

MyClass.class.getResourceAsStream(PROPERTY_FILE_NAME) 

 

I realize I can do the following, but I don't want the code to be server
specific:

props.load(new File(System.getProperty(catalina.base) + /lib/ +
PROPERTY_FILE_NAME).toURL().openStream());

 

Thanks for the help,

Justin 

 


CONFIDENTIALITY NOTICE:
The information in this message, and any attachment, is intended for the 
sole use of the individual and entity to whom it is addressed. This 
information may be privileged, confidential, and protected from 
disclosure. If you are not the intended recipient you are hereby notified 
that you have received this communication in error and that any review, 
disclosure, dissemination, distribution or copying of it, or its contents, 
is strictly prohibited. If you think that you have received this message 
in error please notify the sender and destroy all copies of this 
communication and any attachments. Thank you.


Re: Different webapp paths on different hosts

2013-01-24 Thread bxqdev



On 1/24/2013 5:32 AM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

BBQ,

On 1/23/13 12:09 AM, bxqdev wrote:

i need to map a custom paths, like /path1 and /path2, (not root
/ path), of the same webapp to a custom domains.

as i said i need this mapping: ${samewebapp}/path1 is mapped to
http://path1.com/ ${samewebapp}/path2 is mapped to
http://path2.com/

NOT this: ${samewebapp}/path1 is mapped to http://path1.com/path1
${samewebapp}/path2 is mapped to http://path2.com/path2


What is ${samewebpp}/path1? Is that a piece of a webapp?


yes, paths are the parts of one webapp



Do you care if the same webapp is deployed twice (which is probably
going to be required)?


i want to have one instance of webapp,
which has two paths,
and each of the paths servers the root of different domains

is it possible?



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

iEYEAREIAAYFAlEAj0cACgkQ9CaO5/Lv0PCChwCggGZi3v8ylGaj6py+uQ2ZNuq9
0+QAnR5ENaqoollzjpB5dx7KtcT3mquu
=/GYF
-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: Different webapp paths on different hosts

2013-01-24 Thread bxqdev



On 1/24/2013 11:52 AM, Casper Wandahl Schmidt wrote:

See inline

Med venlig hilsen/Kind regards
Casper W. Schmidt

Den 24-01-2013 02:32, Christopher Schultz skrev:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

BBQ,

On 1/23/13 12:09 AM, bxqdev wrote:

i need to map a custom paths, like /path1 and /path2, (not root
/ path), of the same webapp to a custom domains.

as i said i need this mapping: ${samewebapp}/path1 is mapped to
http://path1.com/ ${samewebapp}/path2 is mapped to
http://path2.com/

NOT this: ${samewebapp}/path1 is mapped to http://path1.com/path1
${samewebapp}/path2 is mapped to http://path2.com/path2

What is ${samewebpp}/path1? Is that a piece of a webapp?

Do you care if the same webapp is deployed twice (which is probably
going to be required)?

Actually the OP is not really clear in describing anything. I'm wondering if path1 in 
http://path1.com equals path1 in the
/path1 part or not.


actually the path names and domain names should be able to be different



Anyway I would say a context.xml file in conf/catalina/path1 (the 
hostname)/path1.xml (the context name) should do the trick?
Place the webapp outside the appbase of the hosts and then point the docbase to 
the webapp (or just drop the .war with two
different names in the appbases of the two hosts) :)


i want to have one instance of webapp,
which has two paths,
and each of the paths serves the root of different domains

once again:
* one webapp
* has 2 different paths: /path1 and /path2
* served on 2 domains
* when user goes to http://path1.com/ - {webapp}/path1 is served as root path
* when user goes to http://path2.com/ - {webapp}/path2 is served as root path

is it possible?



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

iEYEAREIAAYFAlEAj0cACgkQ9CaO5/Lv0PCChwCggGZi3v8ylGaj6py+uQ2ZNuq9
0+QAnR5ENaqoollzjpB5dx7KtcT3mquu
=/GYF
-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



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



How to prevent CVE-2012-5568 in Tomcat 7.0.32

2013-01-24 Thread Aditi Sinha
Hi,



We are using Tomcat 7.0.32 in our application.  During a security scan
CVE-2012-5568 was reported.



Is there a configuration which can help us prevent this vulnerability?



I went through the http://tomcat.apache.org/security-7.html but could not
find any detail on the same.



Thanks  Regards,

Aditi


Re: How to prevent CVE-2012-5568 in Tomcat 7.0.32

2013-01-24 Thread Mark Thomas


Aditi Sinha adisinha0...@gmail.com wrote:

We are using Tomcat 7.0.32 in our application.  During a security scan
CVE-2012-5568 was reported.

Is there a configuration which can help us prevent this vulnerability?

I went through the http://tomcat.apache.org/security-7.html but could
not
find any detail on the same.

There is lots if information in the archives on this. This bugzilla issue is 
probably the best place to start:
https://issues.apache.org/bugzilla/show_bug.cgi?id=54263

We could think about adding some info on this under the Not a vulnerability in 
Tomcat section on the security pages.

Mark

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