[jboss-user] [Testimonials] - Re: Migration from Weblogic to JBoss 4.0.5

prakash.dumbre do-not-reply at jboss.com
Thu Mar 22 06:44:51 EDT 2007


Thanks for replay 

 When i deployed our ear file, the server takes following 
jndi name .

15:18:22,793 INFO  [ProxyFactory] Bound EJB Home SecurityService' to jndi 'SecurityService'


but i have write the following jndi name in jboss.xml then how it takes "SecurityService"  as jndi name 

<enterprise-bean>
       
		  <ejb-name>SecurityService</ejb-name>
		   <jndi-name>com.cedera.server.user.ejb.SecurityService</jndi-name>
	   
    </enterprise-bean>


and ejb-jar.xml


 
			<ejb-name>SecurityService</ejb-name>
			
			com.cedera.server.user.ejb.SecurityServiceHome
			com.cedera.server.user.ejb.SecurityService
			<ejb-class>com.cedera.server.user.ejb.SecurityServiceEJB</ejb-class>
			<session-type>Stateless</session-type>
			<transaction-type>Container</transaction-type>
      


This is all for SecurityServiceEJB bean

Now i have tested this jndi name in test jsp page the jsp code is following 

<% Connection conn;

Context ctx = new InitialContext();
EJBHome home = (EJBHome) ctx.lookup("SecurityService");
out.println("Connected to JNDI : " + home );

%>

Then it gives following result.
Connected to JNDI : SecurityServiceHome 

Is it mean its work fine. it return SecurityServiceHome  object.


my jndi lookup is 

private static EJBHome lookupHomeInterface(String jndiName)
        throws CederaException
    {
        Context ctx = null;
        EJBHome home = null;
       
        try
        {
        	System.out.println("The JNDI Name is:" + jndiName );
            ctx = EJBUtil.getInitialContext();
            home = (EJBHome)PortableRemoteObject.narrow(ctx.lookup(jndiName), javax.ejb.EJBHome.class);
            System.out.println("The JNDI Name is:" + jndiName);
        }
        catch(NamingException ne)
        {
            
        }
        return home;
    }


after getting home EJBHome object i have to pass it to following method 

 javax.ejb.EJBHome home = EJBHomeFactory.getHomeInterface("com.cedera.server.user.ejb.SecurityService", false);
            SecurityServiceHome secHome = (SecurityServiceHome)PortableRemoteObject.narrow(home, com.cedera.server.user.ejb.SecurityServiceHome.class);
            SecurityService secService = (SecurityService)PortableRemoteObject.narrow(secHome.create(), com.cedera.server.user.ejb.SecurityService.class);

Here i have facing following error when i am accesing login page.

java.lang.ClassCastException
	at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
	at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
	at com.cedera.util.GetRemoteInterfaces.getSecurityService(GetRemoteInterfaces.java:360)


Please help me to solve tis issue 

regards,
Prakash


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030548#4030548

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030548



More information about the jboss-user mailing list