- Stateless session bean not bound 2007-07-17 - By dgdwinte
Back Hi,
back with another question: using JBoss 5 beta2, i cannot find my first stateless session bean using a JNDI-lookup from a servlet:
| | try{ | Context jndiContext=getInitialContext(); | Context ejbCtx = (Context) jndiContext.lookup("java:comp"); | ArticleManagerLocal artman= (ArticleManagerLocal) ejbCtx.lookup( "ArticleManager/local"); | PrintWriter out=res.getWriter(); | out.println("Test"); | out.close(); | } catch (javax.naming.NamingException ne){ | ne.printStackTrace(); | PrintWriter out=res.getWriter(); | out.println("Test2"); | out.close(); | } | } | | private static javax.naming.Context getInitialContext() { | try { | java.util.Properties .html>java.util.Properties java.util.Properties .java.html> ' border=0> environment = new java.util.Properties .html>java.util.Properties java.util.Properties .java.html> ' border=0>(); | environment.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp .interfaces.NamingContextFactory"); | environment.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org .jnp.interfaces"); | environment.put(Context.PROVIDER_URL, "jnp://localhost:1099"); | return new javax.naming.InitialContext (environment); | } catch(Exception e) { | e.printStackTrace(); | return null; | } | } | |
I try to find the Session-bean ArticleManager using a JNDI-lookup, but I always get the following error-message:
| 22:22:12,359 ERROR [STDERR] javax.naming.NameNotFoundException : ArticleManager n | ot bound |
However, when I have a look at the JNDI-view in the JBoss-server, I can see that my session-bean has been deployed:
| java:comp namespace of the component jboss.j2ee:service=EJB3,ear=texaco _deploy-1 (See http://loy-1.ora-code.com).0-SNAPSHOT.ear,jar=texaco_model-1 (See http://del-1.ora-code.com).0-SNAPSHOT.jar,name=ArticleManager : | | +- UserTransaction (class: org.jboss.ejb3.tx.UserTransactionImpl) | +- env (class: org.jnp.interfaces.NamingContext ) | | +- be.erpsystem.texaco.articles.ArticleManager (class: org.jnp .interfaces.NamingContext) | | | +- em (class: org.jboss.ejb3.entity .TransactionScopedEntityManager) | |
Finally, the code of my session-bean is as follows:
| @(protected) (mappedName="ArticleManager") | public class ArticleManager implements ArticleManagerRemote, ArticleManagerLocal { | @(protected) (unitName="texaco") EntityManager em; | public void testArticles(){ | int i=0; | i*=2; | } | } |
As I'm very new to EJB / EJB 3.0, this might be an obvious question.
Any help however, is very appreciated!
Thanks Davy.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic &p=4065154#4065154
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode =reply&p=4065154 __ ____ ____ ____ ____ ____ ____ ____ ____ ____ jboss-user mailing list jboss-user@(protected) https://lists.jboss.org/mailman/listinfo/jboss-user
|
|