I found my own solution:
| @SuppressWarnings("unchecked")
| public <T> T lookup(Class<T> clazz, final String pJndiName) {
| T cs = null;
| String jndiName = (pJndiName == null)
| ? jndiPrefix + clazz.getSimpleName() + "Bean/remote"
| : pJndiName;
|
| LOG.debug("Looking for "+jndiName);
| try {
| Object o = context.lookup(jndiName);
| if (o == null) {
| System.err.println("unable to find " + jndiName);
| } else {
| System.out.println("retrieved instance of "
| + o.getClass().getName());
| }
| cs = (T) PortableRemoteObject.narrow(o, clazz);
|
| } catch (NamingException e) {
| e.printStackTrace();
| }
| return cs;
| }
|
Errorhandling has to be improved, but this version works for me.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197051#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...