[EJB/JBoss] - Client proxy problem
by tonioc
Strange problem with EJB/Client
My business logic EJB/Stateless Session Bean (EJB 3.0)
1 - Users (Authorization/Authentication/Accounting)
2 - Calculator (add, multiply,etc)
I'm accessing these EJBs with the BusinessDelegate Pattern.
My applications running in a Tomcat in different JVM
1 - Authentication-Application
Web-Service for authentication (the war includes users-client.jar)
2 - Calculator-Application
Web-Service for calculator (add, multiply, etc) (the war includes users-client.jar)
Tomcat includes in it's shared class-loader all jboss-client
libraries needed, so they are common for all applications
When a user wants to call a calculator service he must do:
1 - Call authentication web-service obtain a ticket
2 - Call calculator method with the ticket just obtained
The problem is that when the we call de calculator method
internally the application calls the UsersEJB to check that the
ticket is valid, when I call the the Business Delegate I receive
this error:
Caused by: java.lang.ClassCastException: isoa.users.bean.UserContext
| at $Proxy9.isUserAuthorized(Unknown Source)
| at isoa.users.bean.UsersServiceBd$5.run(UsersServiceBd.java:127)
| at isoa.commons.bean.AbstractBizDelegate$EjbRun.runWithRetries(AbstractBizDelegate.java:150)
| ... 37 more
|
If I wait 60 seconds or more between the call to obtain the ticket, and
the call to calculator method it works ok !!!!.
What I suppose is that the proxy clients caches UserContext from
the first call (the one I used to obtained the ticket), this UserContext
is loaded by authentication-application class loader.
When the calculator-application calls the authentication-ejb the proxy returns the UserContext that belongs to the authentication-application class loader, and not the UserContext that belongs to the calculator-application class-loader.
I've tested as pure RMI/Client, servlet without web-service (all in one), etc
and in all cases all works ok,
Anybody can give me an idea if I'm totally missing the point, or
something like this is happening, and in that case a way to work it out, without sharing user-client in all my applications.
Thanks in advance
tonio
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997631#3997631
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997631
19 years, 3 months
[Messaging, JMS & JBossMQ] - IllegalStateException (The connection is closed) after heavy
by harrismic
We are using JBossMQ with JBoss version 4.0.2 and 4.0.4
We have a configuration with a JMS client connected to JMS queues. There are two JMS queues a request queue and response queue. The web app running under JBoss can submit requests for statistical analysis to the request queue. The JMS client listens to the request queue processes the request and puts the result on the result queue. The web app listens to the result queue picks up the results and displays them.
Everything works fine until we do heavy stress testing. Note that we are using DeliveryMode.NON_PERSISTENT . After many successful messages have been sent and processed, we get the exception:
"javax.jms.IllegalStateException: The connection is closed" when trying to send back the result via JMS.
The code to send the results back is:
try {
// Is there a way to test the queueConnection here so that
// I can reestablish the connection if it is broken or closed ??
QueueSession resultSession =
queueConnection.createQueueSession(false,
QueueSession.AUTO_ACKNOWLEDGE);
ObjectMessage msg = resultSession.createObjectMessage(result);
Queue resultQueue = (Queue) resultDestination;
QueueSender resultSender =
resultSession.createSender(resultQueue);
resultSender.send(msg, DeliveryMode.NON_PERSISTENT,
Message.DEFAULT_PRIORITY,
Message.DEFAULT_TIME_TO_LIVE);
resultSender.close();
resultSession.close();
} catch (JMSException ex) {
logger.error("Caught JMS exception when trying to send result.");
logger.error(ex);
} catch (Exception ex) {
logger.error("Caught exception when trying to send result.");
logger.error(ex);
}
Two questions:
a) Is this a bug in the JBossMQ? We are not getting a JMS onException() call for the borken/closed connection like you would for ping timeout.
b) Is there a way to test the status of the connection (i.e. someting like a method connection.isClosed() ) to see if it is broken or closed so that the connection can be reestablished?
Thanks..
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997630#3997630
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997630
19 years, 3 months
[JBossCache] - TCP replication conf issue ?
by oew
Hi All,
I am facing a strange problem : I am trying to cluster 2 (and later 3) caches . My tests are based on the test.examples.StudentMaintTest. Code remains the same except for private PojoCache createCache(String name), there is one method for each of the cache that reads different conf files.
one conf file has :
<TCP bind_addr="10.32.2.48" loopback="true" start_port="7800" enable_diagnostics="false" />
| <TCPPING down_thread="true" initial_hosts="10.32.2.48[7800],10.32.2.48[7801]" num_initial_members="3" port_range="5" timeout="3500" up_thread="true" />
| <MERGE2 max_interval="10000" min_interval="5000"/>
| <FD down_thread="true" max_tries="5" shun="true" timeout="2500" up_thread="true"/>
| <VERIFY_SUSPECT down_thread="false" timeout="1500" up_thread="false"/>
| <pbcast.NAKACK down_thread="true" gc_lag="100" retransmit_timeout="3000" up_thread="true"/>
| <pbcast.STABLE desired_avg_gossip="20000" down_thread="false" up_thread="false"/>
| <pbcast.GMS down_thread="true" join_retry_timeout="2000" join_timeout="5000" print_local_addr="false" shun="false" up_thread="true"/>
| <pbcast.STATE_TRANSFER down_thread="true" up_thread="true"/>
the other one has :
<TCP bind_addr="10.32.2.48" loopback="true" start_port="7801" enable_diagnostics="false" />
| <TCPPING down_thread="true" initial_hosts="10.32.2.48[7800],10.32.2.48[7801]" num_initial_members="3" port_range="5" timeout="3500" up_thread="true"/>
| <MERGE2 max_interval="10000" min_interval="5000"/>
| <FD down_thread="true" max_tries="5" shun="true" timeout="2500" up_thread="true"/>
| <VERIFY_SUSPECT down_thread="false" timeout="1500" up_thread="false"/>
| <pbcast.NAKACK down_thread="true" gc_lag="100" retransmit_timeout="3000" up_thread="true"/>
| <pbcast.STABLE desired_avg_gossip="20000" down_thread="false" up_thread="false"/>
| <pbcast.GMS down_thread="true" join_retry_timeout="2000" join_timeout="5000" print_local_addr="false" shun="false" up_thread="true"/>
| <pbcast.STATE_TRANSFER down_thread="true" up_thread="true"/>
and nothing happens (regarding sychronization) test fails : NullPointerException is thrown when doing joe2.addCourse(bar_); . Joe2 comes from Student joe2 = (Student) cache2_.getObject("/students/65432");
If I do NOT list all the "servers" in the TCPPING it works !!!
Did I do something wrong in the service.xml files ? or did I really miss something ?
Thanks for your answers
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997629#3997629
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997629
19 years, 3 months