Try after removing the code
 env.put("java.naming.provider.url", "jnp://localhost:1099"); 


-----Original Message-----
From: Amit Nair [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 06, 2006 1:42 PM
To: [email protected]
Subject: Lookup failing in Backing Bean


Hello Friends

I am stuck in a very strange kind of problem. 
My application is having the following ejb3,  jsf & JBoss-4.0.4.GA I
have got a jsp page which takes the user name & password of the user.
The fields are binded to user object in the backing bean[scope is
request]. When the user does a login the method in the backing bean is
getting called. On doing a lookup[UserService userService =
(UserService) context.lookup("UserServiceImpl/remote");] in the backing
bean it is throwing exception. But the same lookup works fine when
tested in TestClass.


EXCEPTION:
javax.naming.CommunicationException [Root exception is
java.rmi.ServerException: RemoteException occurred in server thread;
nested exception is: 
        java.rmi.UnmarshalException: error unmarshalling arguments;
nested exception is: 
        java.net.MalformedURLException: no protocol:
Deployment_5Dec/Delete/jboss-4.0.4.GA/server/default/deploy/Test.war/WEB
-INF/classes/]

Code for doing the lookup

try
{
        Hashtable <String,String> env = new Hashtable<String,String>();
       
env.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextF
actory"); 
        env.put("java.naming.provider.url", "jnp://localhost:1099"); 
       
env.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfa
ces");
        InitialContext context = new InitialContext(env);
        UserService userService =
(UserService)context.lookup("UserServiceImpl/remote");
        user = userService.authenticateUser(user);
        if(user != null && user.getUserId() != 0)
        {
                System.out.println("Logged in successfully");
        }
           
}catch (Exception e)
  {
            e.printStackTrace();
  }



The xml file of data source
mysql-ds.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- $Id: mysql-ds.xml,v 1.3.2.3 2006/02/07 14:23:00 acoliver Exp $ -->
<!--  Datasource config for MySQL using 3.0.9 available from:
http://www.mysql.com/downloads/api-jdbc-stable.html
-->

<datasources>
  <local-tx-datasource>
    <jndi-name>MySqlDS</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/test_db</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>root</user-name>
    <password>hello</password>
   
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQ
LExceptionSorter</exception-sorter-class-name>
    <!-- should only be used on drivers after 3.22.1 with "ping" support
   
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.ven
dor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
    -->
    <!-- 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 - MySQLValidConnectionChecker is preferred for newer
drivers
    <check-valid-connection-sql>some arbitrary
sql</check-valid-connection-sql>
      -->

    <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml
(optional) -->
    <metadata>
       <type-mapping>mySQL</type-mapping>
    </metadata>
  </local-tx-datasource>
</datasources>

Please let me know where I am getting wrong.
Thanks in Advance
Amit
--
View this message in context:
http://www.nabble.com/Lookup-failing-in-Backing-Bean-tf2766701.html#a771
5173
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to