User development,
A new message was posted in the thread "Name lookup fails, reason unknown":
http://community.jboss.org/message/522234#522234
Author : Timothy Mowlem
Profile :
http://community.jboss.org/people/jvm
Message:
--------------------------------------------------------------
One thing has me confused. There is this statement: "The name
being looked up is "<myapp>/<myfacade>/remote" But later you give
this code:
@EJB(beanName=<a name>)
private xyzManager xyzSession;
How does xyzSession relate to "<myapp>/<myfacade>/remote", or is it
something completely different? If completely different, why mention it? If is is the
same, why is it not:
@EJB(beanName=<a name>)
private <myfacade> xyzSession;
Sorry Peter I should have made this clearer. I have re-examined the code and what I said
is not correct.
The myfacade class is a remote interface and decorated with @Remote.
It extends a set of other interfaces but those interfaces are decorated with @Local, they
are NOT remote.
It extends one interface which has no decoration. Rather oddly the implementing class for
that interface is decorated thus:
@Stateless(name="ControlledValueManager")
@Remote(value={ControlledValueManagerRemote.class})
public class ControlledValueManagerBean implements ControlledValueManagerLocal,
ControlledValueManagerRemote
I don't understand this but I don't see how it can be the cause as the bean seems
to be running and the JNDI name seems set.
So I think this is okay. The class contains most of the client calls and uses the other
helper beans to do the work.
It uses dependency injection for the helper beans. I suppose the clue was in the name of
the class!!
Here are some real examples from the code:
@EJB(beanName="ServiceManager)
private ServiceManager serviceSession;
@EJB(beanName="InstanceManager")
private InstanceManager instanceSession;
@EJB(beanName="SearchManager")
private SearchManager searchSession;
Each interface is @Local.
Also ,the reference object looks OK - it would appear to be a
reference for a "ProxyFactory/myapp/myfacade/myapp/myfacade/remote" which
seems to indicate that if you cast it to myfacade you should be OK. That is verififed by
this info:
Type: Remote Business Interface
Content: <package>.interfaces.myfacade
Okay. It looks like a standard java ClassCastException. So we are trying to cast a
javax.naming.Reference to a package.interfaces.myfacade and that fails which I would
expect from J2SE. The error output is:
Connecting to server localhost:1099
2010-01-26 09:47:06,022 DEBUG ContextFactory:41 - Connecting to localhost:1099
2010-01-26 09:47:06,025 DEBUG BeanFinder:57 - Looking up bean: myapp/myfacade/remote
2010-01-26 09:47:06,243 DEBUG BeanFinder:68 - Completed bean lookup
java.lang.ClassCastException: javax.naming.Reference cannot be cast to
package.interfaces.myfacade
at package.mySession.<init>(mySession.java:64)
I believe it used to be necessary to do a PortableRemoteObject.narrow (Object obj, Class
cls) to cast the returned remote proxy to the correct type but that is no longer necessary
with EJB 3? Is the same thing happening but now hidden somehow?
Otherwise surely you would expect a ClassCast because a javax.naming.Reference is not a
package.interfaces.myfacade?
> "The console log showed a couple of warnings:"
I don't think that the warnings have anything to do with this particular problem - as
long as the name shows up in the JNDI tree, you should be
able to look up the EJB. Of course, you might run into issues later with accessing entity
beans.
Yes that was what I thought. Hibernate issues would presumably not affect the naming
service, only trying to use persistence.
Where does the client live - the one that is looking up the EJB?
I am running the client which is a java thick client via Eclipse on my MacBook Pro along
with JBoss.
The databases are on a local dev server.
Frustrating as it seems to be running fine but the attempt to use it is failing...
--------------------------------------------------------------
To reply to this message visit the message page:
http://community.jboss.org/message/522234#522234