| Author |
[JCAResource] Registration is not done -> stop
|
rajeshkumar nair nair
Greenhorn
Joined: Nov 17, 2005
Posts: 1
|
|
I am new to EJB and JBOSS.I am trying to deploy an sample bean managed entity bean in Jboss and I am struck for a week with jdbc problem. Steps I followed : ------------------ 1.Added the following Jar files into C:\Rajesh\Softwares\jboss-3.2.5\server\default\deploy\server\default\lib mssqlserver msutil msbase 2.copy the mssql-ds.xml file from the C:\Rajesh\Softwares\jboss-3.2.5\server\default\deploy\docs\examples\jca directory C:\Rajesh\Softwares\jboss-3.2.5\server\default\deploy\server\default\deploy and modified as mentioned below ------------------------------------------------------------------------------------------------- <datasources> <local-tx-datasource> <jndi-name>MSSQLDS</jndi-name> <connection-url>jdbc:microsoft:sqlserver://ATSERVER:1433;DatabaseName=Scantrack</connection-url> <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class> <user-name>coreadmin</user-name> <password>coreadmin</password> <!-- sql to call when connection is created <new-connection-sql>some arbitrary sql</new-connection-sql> --> <!-- sql to call on an existing pooled connection when it is obtained from pool <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql> --> </local-tx-datasource> </datasources> ------------------------------------------------------------------------------------------------ 3. change the C:\Rajesh\Softwares\jboss-3.2.5\server\default\conf a) standardjaws.xml Added the following lines : --------------------------- <jaws> <datasource>java:/MSSQLDS</datasource> <type-mapping>MS SQLSERVER2000</type-mapping> <debug>false</debug> --------------------------------------------------------- b)standardjbosscmp-jdbc <jbosscmp-jdbc> <defaults><datasource>java:/MSSQLDS</datasource><datasource-mapping>MS SQLSERVER2000</datasource-mapping></defaults> Here is my ejb-jar.xml -------------------------------------------------------------------------------------------------------------------- <?xml version="1.0"?> <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'> <ejb-jar> <enterprise-beans> <entity> <ejb-name>beanManaged</ejb-name> <home>MasterItemTypeHome</home> <remote>MasterItemType</remote> <ejb-class>MasterItemTypeBean</ejb-class> <persistence-type>Bean</persistence-type> <prim-key-class>java.lang.String</prim-key-class> <reentrant>False</reentrant> <resource-ref> <res-ref-name>jdbc/MSSQLDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </entity> </enterprise-beans> <assembly-descriptor> <container-transaction> <method> <ejb-name>beanManaged</ejb-name> <method-name>*</method-name> </method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor> </ejb-jar> ------------------------------------------------------------------------------------------------------------------ Here is my jboss.xml file ------------------------------------------------------------------------------------------------------------------ <jboss> <enterprise-beans> <entity> <ejb-name>beanManaged</ejb-name> <jndi-name>MasterItemTypeHome</jndi-name> <resource-ref> <res-ref-name>jdbc/MSSQLDS</res-ref-name> <resource-name>java:/MSSQLDS</resource-name> </resource-ref> </entity> </enterprise-beans> </jboss> ------------------------------------------------------------------------------------------------------- Here is my client -------------------------------------------------------------------------------------------------------- import java.util.Hashtable; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class MasterItemTypeClient { public static void main (String[] args) throws Exception { Hashtable env = new Hashtable(); env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); env.put("java.naming.factory.url.pkgs", "org.jboss.naming rg.jnp.interfaces"); env.put("java.naming.provider.url", "localhost"); // Create naming context. InitialContext context = new InitialContext(env); DataSource ds = (DataSource)context.lookup("java:/MSSQLDS"); // Connection con=ds.getConnection(); //Object o = context.lookup ("MasterItemTypeHome"); MasterItemTypeHome home = (MasterItemTypeHome)PortableRemoteObject.narrow (ds,MasterItemTypeHome.class); home.create("10"); } } // ------------------------------------------------------------------------------------------------- when I start the jboss ..the console says -------------------------------------------------------------------------------------------- 15:11:57,281 INFO [MSSQLDS] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=MSSQLDS to JNDI name 'java:/MSSQLDS' ------------------------------------------------------------------------------------------------------ Then I executed my MasterItemtypeclient.java from eclipse I am getting this error --------------------------------------------------------------------------------------------------- Exception in thread "main" javax.naming.NameNotFoundException: MSSQLDS not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:495) at org.jnp.server.NamingServer.getBinding(NamingServer.java:503) -------------------------------------------------------------------------------------------------------- Then when I retouched the mssql-ds.xml file its gives this message in the client ------------------------------------------------------------------------------------ 15:14:55,062 INFO [MSSQLDS] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=MSSQLDS to JNDI name 'java:/MSSQLDS' 15:14:55,062 INFO [JCAResource] Registration is not done -> stop ----------------------------------------------------------------------------------------------------------- CAN ANYBODY PLEASE HELP ME TO SOLVE THIS ISSUE...CAN U PLEASE TELL ME WHERE I WENT WRONG OR DO I MISSED SOMETHING.. I AM REALLY FRUSTRATED ..PLS HELP ME ASAP.. any body if u have the sample working bean managed entity bean pls mail me at rajesh@coretrace.jp THANKS, RAJESH KUMAR. rajesh@coretrace.jp
|
 |
 |
|
|
subject: [JCAResource] Registration is not done -> stop
|
|
|