[EJB 3.0] - Equals method on entity failes to evaluate correctly due to
by ejb3workshop
On a recent project we thought it would be a good idea to inherit a generic implementation of equals and hashCode, as well as the primariy key from an abstract entity. In the equals method we evaluate the class as well as the primary key. In most cases this worked really well for us, but in certain cases equality was not evaluated correctly. After looking further into the problem we found that in the cases it did not evaluate correctly the problem was caused by the classes not matching. It tried to compare one class (Test for example) against another (Test_$$_javassist_), which didn't equate and produces a false response.
I am guessing that the javassist originates from entities being loaded LAZY.
Is there a better way of achieving what we are trying to do ?
We are using JBoss 4.0.5 with EJB3 RC9.
Any suggestions welcome
Alex
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069607#4069607
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069607
18Â years, 8Â months
[JBoss Messaging] - Re: JBM and JAAS Client authentication
by btsibr
Interesting, because it does seem to work with reading messages (or it's not authenticating the user at all on write which seems unlikely).
Note that I am using secured JNDI, so the JAAS login is working for that.
Pardon any mistyping as I can't copy/paste:
| public static void main(String[] args) {
| try {
| System.setProperty("java.security.auth.login.config",ClassLoader.getSystemResource("jaas.config").getPath());
| LoginContext loginContext = new LoginContext("other", new StaticIdentityCallbackHandler("admin","admin");
| loginContext.login();
|
| InitialContext ctx = new InitialContext();
| ConnectionFactory f = (ConnectionFactory)ctx.lookup("ConnectionFactory");
| Destination dest = (Destination)ctx.lookup("echoService/jms/request");
|
| // This fails on the READ
| Connection conn = f.createConnection();
| conn.start();
| Session session = conn.createSession(true, Session.CLIENT_ACKNOWLEDGE);
|
| MessageProducer producer = session.createProducer(dest);
|
| for (int i = 0; i < 5; i++) {
| Message m = session.createTestMessage("Hello " + i);
| producer.send(m);
| }
|
| session.commit();
| producer.close();
|
| MessageConsumer consumer = session.createConsumer(dest);
|
| Message mess = null;
| while ((mess = consumer.receive(3000)) != null) {
| System.out.println(((TextMessage)mess).getText());
| }
| session.commit();
|
| consumer.close();
| session.close();
| conn.close();
|
| loginContext.logout();
| } catch (Exception e) {
| e.printStackTrace();
| }
|
A few small points, the StaticIdentityCallbackHandler is a simple callback handler I wrote to just return the username and password to the callbacks.
Both JNDI (I'm using the HTTPNamingContext) and JBM are configure to use the same JAAS domain.
What is involved in making the connection capable of using the client login config?
Thanks for any information.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069605#4069605
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069605
18Â years, 8Â months
[JBoss Messaging] - Re: Messaging hangs
by timfox
Martin-
I think I can see a deadlock in the stack you provided, can you try something out for me?
In the method org.jboss.messaging.core.impl.postoffice.MessagingPostOffice::removeBindingInMemory there is the following code:
| if (queues.isEmpty())
| {
| mappings.remove(binding.condition);
| }
|
| // Send a notification
| ClusterNotification notification = new ClusterNotification(ClusterNotification.TYPE_UNBIND, nodeID, queueName);
|
| clusterNotifier.sendNotification(notification);
|
| return binding;
| }
| finally
| {
| lock.writeLock().release();
| }
| }
|
Can you move the notification send outside the lock so it reads something like:
| if (queues.isEmpty())
| {
| mappings.remove(binding.condition);
| }
| }
| finally
| {
| lock.writeLock().release();
| }
|
| // Send a notification
| ClusterNotification notification = new ClusterNotification(ClusterNotification.TYPE_UNBIND, nodeID, queueName);
|
| clusterNotifier.sendNotification(notification);
|
| return binding;
| }
|
and rebuild?
Sorry, but we are a bit snowed under here (understatement of the century) so any help greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069600#4069600
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069600
18Â years, 8Â months