Question about HttpSessionBindingListener and getAttribute in valueBound()

2011-04-12 Thread Thomas Chabaud

Hi,

I have problem with Tomcat 6.0 StandardSession implementation.
We have an application who calls setAttribute(myAttr, myValue), and try to 
get this attribute in a method launched in valueBound(), but only gets null value.

According to source code, the setAttribute() method calls valueBound *before* 
setting attribute in attributes Map :

public void setAttribute(String name, Object value, boolean notify)
{
[...]
// Call the valueBound() method if necessary
if (notify  value instanceof HttpSessionBindingListener)
{
// Don't call any notification if replacing with the same value
Object oldValue = attributes.get(name);
if (value != oldValue)
{
event = new HttpSessionBindingEvent(getSession(), name, value);
try
{
((HttpSessionBindingListener) value).valueBound(event);
}
catch (Throwable t)
{

manager.getContainer().getLogger().error(sm.getString(standardSession.bindingEvent),
 t);
}
}
}

// Replace or add this attribute
Object unbound = attributes.put(name, value);

// Call the valueUnbound() method if necessary
 [...]
}

Why valueBound() is called before setting the attribute in the map ? Is it 
allowed to call getAttribute() from valueBound() ? Is the following code 
correct ?

setAttribute(myAttr, myValue);
- valueBound() event fired

In the valueBound() :
// getAttribute() always returns null
Object myAttr = getAttribute(myAttr);

Thanks in advance.

Regards,
Thomas


Ce message est protégé par les règles relatives au secret des correspondances. 
Il est donc établi à destination exclusive de son destinataire. Celui-ci peut 
donc contenir des informations confidentielles. La divulgation de ces 
informations est à ce titre rigoureusement interdite. Si vous avez reçu ce 
message par erreur, merci de le renvoyer à l'expéditeur dont l'adresse e-mail 
figure ci-dessus et de détruire le message ainsi que toute pièce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, 
this message is intended solely for the attention of the addressee. This 
message may contain privileged or confidential information, as such the 
disclosure of these informations is strictly forbidden. If, by mistake, you 
have received this message, please return this message to the addressser whose 
e-mail address is written above and destroy this message and all files attached.



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



Re: Question about HttpSessionBindingListener and getAttribute in valueBound()

2011-04-12 Thread Thomas Chabaud

I found the answer in the servlet specification :

SRV.7.4Binding Attributes into a Session

The valueBound method must be called before the object is made available via
the getAttribute method of the HttpSession interface.

Sorry for the noise :-\

Le 12/04/2011 11:05, Thomas Chabaud a écrit :

Hi,

I have problem with Tomcat 6.0 StandardSession implementation.
We have an application who calls setAttribute(myAttr, myValue), and try to 
get this attribute in a method launched in valueBound(), but only gets null value.

According to source code, the setAttribute() method calls valueBound *before* 
setting attribute in attributes Map :

public void setAttribute(String name, Object value, boolean notify)
{
[...]
// Call the valueBound() method if necessary
if (notify  value instanceof HttpSessionBindingListener)
{
// Don't call any notification if replacing with the same value
Object oldValue = attributes.get(name);
if (value != oldValue)
{
event = new HttpSessionBindingEvent(getSession(), name, value);
try
{
((HttpSessionBindingListener) value).valueBound(event);
}
catch (Throwable t)
{
manager.getContainer().getLogger().error(sm.getString(standardSession.bindingEvent),
 t);
}
}
}

// Replace or add this attribute
Object unbound = attributes.put(name, value);

// Call the valueUnbound() method if necessary
[...]
}

Why valueBound() is called before setting the attribute in the map ? Is it 
allowed to call getAttribute() from valueBound() ? Is the following code 
correct ?

setAttribute(myAttr, myValue);
- valueBound() event fired

In the valueBound() :
// getAttribute() always returns null
Object myAttr = getAttribute(myAttr);

Thanks in advance.

Regards,
Thomas


Ce message est protégé par les règles relatives au secret des correspondances. 
Il est donc établi à destination exclusive de son destinataire. Celui-ci peut 
donc contenir des informations
confidentielles. La divulgation de ces informations est à ce titre 
rigoureusement interdite. Si vous avez reçu ce message par erreur, merci de le 
renvoyer à l'expéditeur dont l'adresse e-mail figure
ci-dessus et de détruire le message ainsi que toute pièce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, 
this message is intended solely for the attention of the addressee. This 
message may contain privileged or confidential
information, as such the disclosure of these informations is strictly 
forbidden. If, by mistake, you have received this message, please return this 
message to the addressser whose e-mail address is
written above and destroy this message and all files attached.



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







Ce message est protégé par les règles relatives au secret des correspondances. 
Il est donc établi à destination exclusive de son destinataire. Celui-ci peut 
donc contenir des informations confidentielles. La divulgation de ces 
informations est à ce titre rigoureusement interdite. Si vous avez reçu ce 
message par erreur, merci de le renvoyer à l'expéditeur dont l'adresse e-mail 
figure ci-dessus et de détruire le message ainsi que toute pièce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, 
this message is intended solely for the attention of the addressee. This 
message may contain privileged or confidential information, as such the 
disclosure of these informations is strictly forbidden. If, by mistake, you 
have received this message, please return this message to the addressser whose 
e-mail address is written above and destroy this message and all files attached.



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



Re: RMI reaper thread prevents JVM from exiting

2010-01-26 Thread Thomas Chabaud

Le 25/01/2010 20:53, Christopher Schultz a écrit :

You've reached way beyond my understanding of RMI at this point. Is it
possible that, like JNDI, you might have trees of objects instead of
just a flat list? In that case, you'd have to recursively
unexport/unbind objects to make sure you got everything.



Thanks for the advice. I've checked, and I think all objects are already 
unexported,
because on each unexportObject() call the NoSuchObjectException is raised.

Regards.
Thomas



Ce message est protégé par les règles relatives au secret des correspondances. 
Il est donc établi à destination exclusive de son destinataire. Celui-ci peut 
donc contenir des informations confidentielles. La divulgation de ces 
informations est à ce titre rigoureusement interdite. Si vous avez reçu ce 
message par erreur, merci de le renvoyer à l'expéditeur dont l'adresse e-mail 
figure ci-dessus et de détruire le message ainsi que toute pièce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, 
this message is intended solely for the attention of the addressee. This 
message may contain privileged or confidential information, as such the 
disclosure of these informations is strictly forbidden. If, by mistake, you 
have received this message, please return this message to the addressser whose 
e-mail address is written above and destroy this message and all files attached.



Re: RMI reaper thread prevents JVM from exiting

2010-01-24 Thread Thomas Chabaud

Hi, and thanks for your answer.

I've tried to call the setDaemon(true), but I get the following exception :

java.lang.IllegalThreadStateException
at java.lang.Thread.setDaemon(Thread.java:1232)
at 
TestServletContextListener.contextDestroyed(TestServletContextListener.java:45)
at 
org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3882)
at 
org.apache.catalina.core.StandardContext.stop(StandardContext.java:4523)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
at 
org.apache.catalina.core.StandardService.stop(StandardService.java:584)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:628)
at org.apache.catalina.startup.Catalina.start(Catalina.java:603)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

Anyway, the javadoc is pretty explicit :

http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#setDaemon(boolean)

[..] This method must be called before the thread is started

And the problem is that's not me who started this RMI thread, I think it's 
automatically
started by RMI stuff.

Do you have other ideas ?

Thanks in advance.

Thomas


Ce message est protégé par les règles relatives au secret des correspondances. 
Il est donc établi à destination exclusive de son destinataire. Celui-ci peut 
donc contenir des informations confidentielles. La divulgation de ces 
informations est à ce titre rigoureusement interdite. Si vous avez reçu ce 
message par erreur, merci de le renvoyer à l'expéditeur dont l'adresse e-mail 
figure ci-dessus et de détruire le message ainsi que toute pièce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, 
this message is intended solely for the attention of the addressee. This 
message may contain privileged or confidential information, as such the 
disclosure of these informations is strictly forbidden. If, by mistake, you 
have received this message, please return this message to the addressser whose 
e-mail address is written above and destroy this message and all files attached.



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



Re: RMI reaper thread prevents JVM from exiting

2010-01-24 Thread Thomas Chabaud

Le 22/01/2010 18:13, Christopher Schultz wrote :

This thread over on the Sun forums
(http://forums.sun.com/thread.jspa?threadID=169975) says that you can
either unexport all your objects or call System.exit(). :(

Are there some objects that you may have forgotten to unexport?



I don't think so. Here is how I unexport my objects :

Registry lReg = LocateRegistry.getRegistry(RMI_PORT);
String[] lNames = lReg.list();
for (String lName : lNames)
{
Remote lRemoteObj = lReg.lookup(lName);
UnicastRemoteObject.unexportObject(lRemoteObj, true);
lReg.unbind(lName);
}

Is there a way to safely check that all objects have been exported, because I 
don't want to call
System.exit() in my web app, it is  too ugly and dangerous.

Regards,
Thomas


Ce message est protégé par les règles relatives au secret des correspondances. 
Il est donc établi à destination exclusive de son destinataire. Celui-ci peut 
donc contenir des informations confidentielles. La divulgation de ces 
informations est à ce titre rigoureusement interdite. Si vous avez reçu ce 
message par erreur, merci de le renvoyer à l'expéditeur dont l'adresse e-mail 
figure ci-dessus et de détruire le message ainsi que toute pièce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, 
this message is intended solely for the attention of the addressee. This 
message may contain privileged or confidential information, as such the 
disclosure of these informations is strictly forbidden. If, by mistake, you 
have received this message, please return this message to the addressser whose 
e-mail address is written above and destroy this message and all files attached.



RMI reaper thread prevents JVM from exiting

2010-01-22 Thread Thomas Chabaud

Hi,

I have a problem with a webapp using RMI. When I try to shutdown Tomcat 
instance, the JVM doesn't exit.
I have called jstack to see the thread dump :

http://pastebin.com/fa55647

There is a non-daemon thread : RMI Reaper.

I've tried to add a servlet context listener to force RMI Object unexport on 
shutdown, but it has no effect :

http://pastebin.com/f324201e2

I'm using Tomcat 6.0.18 on a Red Hat Enterprise Linux Server release 5.3.
The JVM is a 64 bit JVM, version 1.6.0_07-b06 on a Intel Xeon E5420 CPU.

What can I do to force this RMI reaper thread to stop ?

Thanks in advance for your help.

Thomas


Ce message est protégé par les règles relatives au secret des correspondances. 
Il est donc établi à destination exclusive de son destinataire. Celui-ci peut 
donc contenir des informations confidentielles. La divulgation de ces 
informations est à ce titre rigoureusement interdite. Si vous avez reçu ce 
message par erreur, merci de le renvoyer à l'expéditeur dont l'adresse e-mail 
figure ci-dessus et de détruire le message ainsi que toute pièce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, 
this message is intended solely for the attention of the addressee. This 
message may contain privileged or confidential information, as such the 
disclosure of these informations is strictly forbidden. If, by mistake, you 
have received this message, please return this message to the addressser whose 
e-mail address is written above and destroy this message and all files attached.



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



Re: APR Native library on tomcat 6

2009-06-19 Thread Thomas Chabaud

lmk a écrit :

Hi all,

I have installed apr native library, open ssl; using :./configure:

./configure --with-apr=/usr/local/apr 
--with-java-home=/usr/java/jdk1.5.0_11  --with-ssl=/usr/local/ssl 
--prefix=/usr/tomcat/apache-tomcat-6.0.18


I added to catalina_opts  java.library definition:

export CATALINA_OPTS=$CATALINA_OPTS -Djava.library.path=/usr/local/apr/lib

And I still get the error:

The APR based Apache Tomcat Native library which allows optimal performance
in production environments was not found on the java.library.path:

any idea about this issue?

thanks.


Have you tried an /sbin/ldconfig, then restart Tomcat ?




Ce message est protégé par les règles relatives au secret des correspondances. 
Il est donc établi à destination exclusive de son destinataire. Celui-ci peut 
donc contenir des informations confidentielles. La divulgation de ces 
informations est à ce titre rigoureusement interdite. Si vous avez reçu ce 
message par erreur, merci de le renvoyer à l'expéditeur dont l'adresse e-mail 
figure ci-dessus et de détruire le message ainsi que toute pièce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, 
this message is intended solely for the attention of the addressee. This 
message may contain privileged or confidential information, as such the 
disclosure of these informations is strictly forbidden. If, by mistake, you 
have received this message, please return this message to the addressser whose 
e-mail address is written above and destroy this message and all files attached.



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