Hello,
I am new to ejb and was trying to deploy and run Sun's Resource Management
System application using jboss and tomcat on NT. The ear file is deployed
properly and i can see my bean listed on jndiview. But I am getting the
following error everytime I try to do the initial context lookup. Has
anyone tried this example on Jboss? Thanks,
[EmbeddedTomcat] ctx : javax.naming.InitialContext@77e3d4
[EmbeddedTomcat] getRMSConn() fails
javax.naming.NameNotFoundException: RMSBean not bound
[EmbeddedTomcat] javax.naming.NameNotFoundException: RMSBean not bound
[EmbeddedTomcat] at
org.jnp.server.NamingServer.getBinding(NamingServer.j
ava:474)
[EmbeddedTomcat] at
org.jnp.server.NamingServer.getBinding(NamingServer.j
ava:482)
[EmbeddedTomcat] at
org.jnp.server.NamingServer.getObject(NamingServer.ja
va:488)
[EmbeddedTomcat] at
org.jnp.server.NamingServer.lookup(NamingServer.java:
283)
[EmbeddedTomcat] at
org.jnp.interfaces.NamingContext.lookup(NamingContext
.java:295)
[EmbeddedTomcat] at
org.jnp.interfaces.NamingContext.lookup(NamingContext
.java:403)
[EmbeddedTomcat] at
org.jnp.interfaces.NamingContext.lookup(NamingContext
.java:279)
[EmbeddedTomcat] at javax.naming.InitialContext.lookup(Unknown
Source)
[EmbeddedTomcat] at RMS.JSP.getRMSConn(jsp.java:53)
[EmbeddedTomcat] at RMS.JSP.getAllCategories(jsp.java:158)
[EmbeddedTomcat] at
_0002fprojSearchInfo_0002ejspprojSearchInfo_jsp_6._js
pService(_0002fprojSearchInfo_0002ejspprojSearchInfo_jsp_6.java:96)
[EmbeddedTomcat] at
org.apache.jasper.runtime.HttpJspBase.service(HttpJsp
Base.java:119)
[EmbeddedTomcat] at
javax.servlet.http.HttpServlet.service(HttpServlet.ja
va:853)
[EmbeddedTomcat] at
org.apache.jasper.servlet.JspServlet$JspServletWrappe
r.service(JspServlet.java:177)
[EmbeddedTomcat] at
org.apache.jasper.servlet.JspServlet.serviceJspFile(J
spServlet.java:318)
[EmbeddedTomcat] at
org.apache.jasper.servlet.JspServlet.service(JspServl
et.java:391)
[EmbeddedTomcat] at
javax.servlet.http.HttpServlet.service(HttpServlet.ja
va:853)
[EmbeddedTomcat] at
org.apache.tomcat.core.ServletWrapper.doService(Servl
etWrapper.java:404)
[EmbeddedTomcat] at
org.apache.tomcat.core.Handler.service(Handler.java:2
86)
[EmbeddedTomcat] at
org.apache.tomcat.core.ServletWrapper.service(Servlet
Wrapper.java:372)
[EmbeddedTomcat] at
org.apache.tomcat.core.ContextManager.internalService
(ContextManager.java:797)
[EmbeddedTomcat] at
org.apache.tomcat.core.ContextManager.service(Context
Manager.java:743)
[EmbeddedTomcat] at
org.apache.tomcat.service.http.HttpConnectionHandler.
processConnection(HttpConnectionHandler.java:210)
[EmbeddedTomcat] at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolT
cpEndpoint.java:416)
[EmbeddedTomcat] at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run
(ThreadPool.java:498)
[EmbeddedTomcat] at java.lang.Thread.run(Unknown Source)
my initialcontext code is as follows:
public RMS getRMSConn ()
{
if (rms == null)
{
try
{
InitialContext ctx = new InitialContext();
System.out.println("ctx : " + ctx);
Object home = ctx.lookup("java:comp/RMSBean");
System.out.println("home is :" + home);
RMSHome rmsHome = (RMSHome)
PortableRemoteObject.narrow(home, RMSHome.class);
System.out.println("rmsHome is : " + rmsHome);
rms = rmsHome.create();
}
catch (NamingException ne)
{
System.err.println("getRMSConn() fails \n" + ne);
ne.printStackTrace();
return null;
}
catch (CreateException ce)
{
System.err.println("Failed to create the RMSBean \n" + ce);
return null;
}
catch (Exception e)
{
System.err.println("Failed to make connection to RMSBean \n" +
e);
return null;
}
}
return rms;
}
my ejb-jar.xml is as follows:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ejb-jar (View Source for full doctype...)>
- <ejb-jar>
<description>no description</description>
<display-name>rmsjar</display-name>
- <enterprise-beans>
- <entity>
<description>no description</description>
<display-name>projBean</display-name>
<ejb-name>projBean</ejb-name>
<home>examples.ejb.beans.projentity.ProjHome</home>
<remote>examples.ejb.beans.projentity.Proj</remote>
<ejb-class>examples.ejb.beans.projentity.ProjBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
- <env-entry>
<description>A description of EntryName</description>
<env-entry-name>dname</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>OracleDS</env-entry-value>
</env-entry>
- <resource-ref>
<description>A description for ResourceRefName</description>
<res-ref-name>jdbc/CloudscapeDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
- <entity>
<description>no description</description>
<display-name>propBean</display-name>
<ejb-name>propBean</ejb-name>
<home>examples.ejb.beans.propentity.PropHome</home>
<remote>examples.ejb.beans.propentity.Prop</remote>
<ejb-class>examples.ejb.beans.propentity.PropBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
- <env-entry>
<description>A description of EntryName</description>
<env-entry-name>dname</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>OracleDS</env-entry-value>
</env-entry>
- <resource-ref>
<description>A description for ResourceRefName</description>
<res-ref-name>jdbc/CloudscapeDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
- <session>
<description>no description</description>
<display-name>sessionBean</display-name>
<ejb-name>sessionBean</ejb-name>
<home>examples.ejb.beans.session.RMSHome</home>
<remote>examples.ejb.beans.session.RMS</remote>
<ejb-class>examples.ejb.beans.session.RMSBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
- <env-entry>
<description>A description of EntryName</description>
<env-entry-name>dname</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>OracleDS</env-entry-value>
</env-entry>
- <ejb-ref>
<description>A description of EjbRefName</description>
<ejb-ref-name>ejb/propBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>examples.ejb.beans.propentity.PropHome</home>
<remote>examples.ejb.beans.propentity.Prop</remote>
<ejb-link>propBean</ejb-link>
</ejb-ref>
- <ejb-ref>
<description>A description of EjbRefName</description>
<ejb-ref-name>ejb/projBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>examples.ejb.beans.projentity.ProjHome</home>
<remote>examples.ejb.beans.projentity.Proj</remote>
<ejb-link>projBean</ejb-link>
</ejb-ref>
- <resource-ref>
<description>A description for ResourceRefName</description>
<res-ref-name>jdbc/CloudscapeDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
- <assembly-descriptor>
- <container-transaction>
- <method>
<ejb-name>projBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getData</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
- <container-transaction>
- <method>
<ejb-name>projBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>update</method-name>
- <method-params>
<method-param>examples.ejb.beans.share.StorageDataIF</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
- <container-transaction>
- <method>
<ejb-name>projBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>findByPrimaryKey</method-name>
- <method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
- <container-transaction>
- <method>
<ejb-name>projBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>findAllProjects</method-name>
- <method-params>
<method-param>examples.ejb.beans.share.StorageDataIF</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
- <container-transaction>
- <method>
<ejb-name>projBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>create</method-name>
- <method-params>
<method-param>examples.ejb.beans.share.StorageDataIF</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
- <container-transaction>
- <method>
<ejb-name>propBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getData</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
- <container-transaction>
- <method>
<ejb-name>propBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>update</method-name>
- <method-params>
<method-param>examples.ejb.beans.share.StorageDataIF</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
- <container-transaction>
- <method>
<ejb-name>propBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>findByPrimaryKey</method-name>
- <method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
- <container-transaction>
- <method>
<ejb-name>propBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>findAllProposals</method-name>
- <method-params>
<method-param>examples.ejb.beans.share.StorageDataIF</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
- <container-transaction>
- <method>
<ejb-name>propBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>create</method-name>
- <method-params>
<method-param>examples.ejb.beans.share.StorageDataIF</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
My jboss.xml is as follows:
<?xml version="1.0" encoding="UTF-8" ?>
- <jboss>
<secure>false</secure>
<container-configurations />
<resource-managers />
- <enterprise-beans>
- <session>
<ejb-name>sessionBean</ejb-name>
<jndi-name>RMSBean</jndi-name>
- <resource-ref>
<res-ref-name>jdbc/CloudscapeDB</res-ref-name>
<resource-name>jdbc/Oracle</resource-name>
</resource-ref>
- <ejb-ref>
<ejb-ref-name>ejb/propBean</ejb-ref-name>
<jndi-name>PropBean</jndi-name>
</ejb-ref>
- <ejb-ref>
<ejb-ref-name>ejb/projBean</ejb-ref-name>
<jndi-name>ProjBean</jndi-name>
</ejb-ref>
</session>
- <entity>
<ejb-name>projBean</ejb-name>
<jndi-name>ProjBean</jndi-name>
- <resource-ref>
<res-ref-name>jdbc/CloudscapeDB</res-ref-name>
<jndi-name>jdbc/Oracle</jndi-name>
</resource-ref>
- <cmp>
<table-create-sql />
<table-remove-sql />
<create-table-deploy>true</create-table-deploy>
<delete-table-undeploy>true</delete-table-undeploy>
</cmp>
</entity>
- <entity>
<ejb-name>propBean</ejb-name>
<jndi-name>PropBean</jndi-name>
- <resource-ref>
<res-ref-name>jdbc/CloudscapeDB</res-ref-name>
<jndi-name>jdbc/Oracle</jndi-name>
</resource-ref>
- <cmp>
<table-create-sql />
<table-remove-sql />
<create-table-deploy>true</create-table-deploy>
<delete-table-undeploy>true</delete-table-undeploy>
</cmp>
</entity>
</enterprise-beans>
</jboss>
jndiview is as follows:
Application:
file:/C:/jboss/JBoss-2.2.1_Tomcat-3.2.1/jboss/tmp/deploy/Default/RMSApp.ear/
java:comp namespace of the sessionBean bean:
+- UserTransaction (class: javax.transaction.UserTransaction)
+- env (class: org.jnp.interfaces.NamingContext)
| +- jdbc (class: org.jnp.interfaces.NamingContext)
| | +- CloudscapeDB (class: javax.naming.LinkRef)
| +- ejb (class: org.jnp.interfaces.NamingContext)
| | +- projBean (class: javax.naming.LinkRef)
| | +- propBean (class: javax.naming.LinkRef)
| +- dname (class: java.lang.String)
java:comp namespace of the projBean bean:
+- env (class: org.jnp.interfaces.NamingContext)
| +- jdbc (class: org.jnp.interfaces.NamingContext)
| | +- CloudscapeDB (class: javax.naming.LinkRef)
| +- dname (class: java.lang.String)
java:comp namespace of the propBean bean:
+- env (class: org.jnp.interfaces.NamingContext)
| +- jdbc (class: org.jnp.interfaces.NamingContext)
| | +- CloudscapeDB (class: javax.naming.LinkRef)
| +- dname (class: java.lang.String)
Global JNDI Namespace
+- TopicConnectionFactory (class: org.jbossmq.SpyTopicConnectionFactory)
+- XAQueueConnectionFactory (class:
org.jbossmq.SpyXAQueueConnectionFactory)
+- jmx (class: org.jboss.jmx.server.JMXAdaptorImpl)
+- UILXAQueueConnectionFactory (class:
org.jbossmq.SpyXAQueueConnectionFactory)
+- RMIXAQueueConnectionFactory (class:
org.jbossmq.SpyXAQueueConnectionFactory)
+- RMIQueueConnectionFactory (class:
org.jbossmq.SpyQueueConnectionFactory)
+- NonOptimized (class: $Proxy4)
+- XATopicConnectionFactory (class:
org.jbossmq.SpyXATopicConnectionFactory)
+- UILXATopicConnectionFactory (class:
org.jbossmq.SpyXATopicConnectionFactory)
+- RMIXATopicConnectionFactory (class:
org.jbossmq.SpyXATopicConnectionFactory)
+- RMITopicConnectionFactory (class:
org.jbossmq.SpyTopicConnectionFactory)
+- Optimized (class: $Proxy4)
+- invokers (class: org.jnp.interfaces.NamingContext)
| +- sessionBean (class:
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker)
| +- projBean (class:
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker)
| +- Optimized (class:
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker)
| +- NonOptimized (class:
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker)
| +- propBean (class:
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker)
+- propBean (class: $Proxy39)
+- sessionBean (class: $Proxy36)
+- queue (class: org.jnp.interfaces.NamingContext)
| +- D (class: org.jbossmq.SpyQueue)
| +- C (class: org.jbossmq.SpyQueue)
| +- B (class: org.jbossmq.SpyQueue)
| +- A (class: org.jbossmq.SpyQueue)
| +- controlQueue (class: org.jbossmq.SpyQueue)
| +- testQueue (class: org.jbossmq.SpyQueue)
| +- ex (class: org.jbossmq.SpyQueue)
| +- testObjectMessage (class: org.jbossmq.SpyQueue)
| +- E (class: org.jbossmq.SpyQueue)
+- topic (class: org.jnp.interfaces.NamingContext)
| +- testDurableTopic (class: org.jbossmq.SpyTopic)
| +- example (class: org.jbossmq.SpyTopic)
| +- testTopic (class: org.jbossmq.SpyTopic)
| +- metrics (class: org.jbossmq.SpyTopic)
| +- bob (class: org.jbossmq.SpyTopic)
| +- beancache (class: org.jbossmq.SpyTopic)
+- UILQueueConnectionFactory (class:
org.jbossmq.SpyQueueConnectionFactory)
+- projBean (class: $Proxy38)
+- QueueConnectionFactory (class: org.jbossmq.SpyQueueConnectionFactory)
+- UILTopicConnectionFactory (class:
org.jbossmq.SpyTopicConnectionFactory)
+- jmx:minal:rmi (class: org.jboss.jmx.server.RMIConnectorImpl)
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user