[ 
http://jira.jboss.com/jira/browse/JBAS-1269?page=comments#action_12314539 ]
     
Adrian Brock commented on JBAS-1269:
------------------------------------

There are two errors here:

1) The provider of the EJB must know that toString() should not throw an 
exception
and that using getPrimaryKey() is not allowed in all contexts. e.g. the ejb
instance may be being used on a home invocation.

2) The logging within JBoss should cause the operation to fail.
It can be easily fixed in this case since all we are interested in is 
identifying
the ejb instance so we can just use the default toString() implementation:
-log.trace("new stack for key: " + rawKey);
+log.trace("new stack for key: " + rawKey.getClass().getName() + "@" + 
Integer.getAsHexString(System.identityHashCode(rawKey)));



> toString called on EJB
> ----------------------
>
>          Key: JBAS-1269
>          URL: http://jira.jboss.com/jira/browse/JBAS-1269
>      Project: JBoss Application Server
>         Type: Bug
>   Components: EJBs
>     Versions: JBossAS-4.0.1 Final
>  Environment: Linux, J2SE 1.4.2_06
>     Reporter: Michael Lipp
>     Assignee: Scott M Stark
>     Priority: Critical

>
>
> org.jboss.resource.connectionmanager.CachedConnectionManager calls toString() 
> on EJBs (e.g. line 250, where "rawKey" is an EJB.
> The "toString()" method of an EJB may, however, be overwritten, as is 
> appropriate for the type of EJB. Such a toString() method may use 
> getPrimaryKey() as it will usually be called from the business methods, i.e. 
> from a context where this call is legal.
> CachedConnectionManager calls toString() during create, i.e. in a context 
> where the call to getPrimaryKey is illegal, which results in an 
> IllegalStateException. In order to avoid this kind of problem, the 
> application server should never call toString() on EJBs.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to