Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!

babujava jayaraman

Greenhorn
+ Follow
since Apr 28, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by babujava jayaraman

Hi

Iam new to Sun One Application Server 8.1, I try to deploy Local EJB in Sun one Server, its deployed successfully, but it thow error duing jndi look up time.


ejb-jar.xml
===========

<?xml version="1.0" encoding="UTF-8"?>
< !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 id="ejb-jar_ID">
<description>ejb-jar.xml for LocalizationDepwb component</description>
<display-name>rvwlocalandRemoteEJB</display-name>
<enterprise-beans>
<session>
<display-name>Common RVW EJB</display-name>
<ejb-name>com.ramco.ejb.RVWEJBBean</ejb-name>
<home>com.ramco.ejb.RVWEJBHome</home>
<remote>com.ramco.ejb.RVWEJBRemote</remote>
<ejb-class>com.ramco.ejb.RVWEJBBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>

<ejb-local-ref>
<ejb-ref-name>ejb/RVWEJBLocal</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.ramco.local.ejb.RVWEJBHomeLocal</local-home>
<local>com.ramco.local.ejb.RVWEJBRemoteLocal</local>
<ejb-link>RVWEJBLocal</ejb-link>
</ejb-local-ref>
</session>
<session>
<ejb-name>RVWEJBLocal</ejb-name>
<local-home>com.ramco.local.ejb.RVWEJBHomeLocal</local-home>
<local>com.ramco.local.ejb.RVWEJBRemoteLocal</local>
<ejb-class>com.ramco.local.ejb.RVWEJBBeanLocal</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>


sun-ejb-jar.xml
===============


<?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 EJB 2.1//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_2_1-1.dtd">;
<sun-ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee">
<enterprise-beans>
<ejb>
<ejb-name>RVWEJB</ejb-name>
<jndi-name>com.ramco.ejb.remote</jndi-name>
</ejb>
</enterprise-beans>
</sun-ejb-jar>

error
=======
javax.naming.NameNotFoundException

Thanks lot...
13 years ago
Hi

Iam new to EJB2 with Websphere, I got the following error while try to the LOCAL EJB, Please help me to solve this error.


com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. Root exception is com.ibm.ejs.container.ContainerEJBException: Unable to initialize deferred EJB.
at com.ibm.ws.runtime.component.EJBContainerImpl.initializeDeferredEJB(EJBContainerImpl.java:4177)
at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:341)
at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:300)
at com.ibm.ejs.container.EJSContainer.getLocalHome(EJSContainer.java:1176)
at com.ibm.ejs.container.util.LocalInterfaceHomeObjectFactory.getObjectInstance(LocalInterfaceHomeObjectFactory.java:115)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:314)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:874)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:191)

Advance Thanks..

ejb-jar.xml
-----------
<enterprise-beans>
<session id="Session_1">
<display-name>Common RVW EJB</display-name>
<ejb-name>RVWEJB</ejb-name>
<home>com.ramco.ejb.RVWEJBHome</home>
<remote>com.ramco.ejb.RVWEJBRemote</remote>
<ejb-class>com.ramco.ejb.RVWEJBBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref id="EJBLocalRef_1178289858377">
<ejb-ref-name>rvw/RVWLocalEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.ramco.local.ejb.RVWEJBHomeLocal</local-home>
<local>com.ramco.local.ejb.RVWEJBRemoteLocal</local>
<ejb-link>commonEJB.jar#RVWEJBLocal</ejb-link>
</ejb-local-ref>
</session>
<session id="Session_1178289858377">
<ejb-name>RVWEJBLocal</ejb-name>
<local-home>com.ramco.local.ejb.RVWEJBHomeLocal</local-home>
<local>com.ramco.local.ejb.RVWEJBRemoteLocal</local>
<ejb-class>com.ramco.local.ejb.RVWEJBBeanLocal</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>

client code( JSP)
----------------
InitialContext context = new InitialContext();
out.println("Context created.....");
context.lookup("java:comp/env/rvw/RVWLocalEJB");

Pls post your reply as soon as possible, thanks lot.........

regards
Babu Jayaraman
13 years ago
Hi
I got the following error during the lookup time of Local interface, please help me to solve the problem. ( Websphere 6.0.1, Jsp, EJB2 )

--------
error
------
R java.lang.ClassCastException: test.EJSLocalStatelesscounterHome_8ada3073
at com.ibm._jsp._EJBTest._jspService(_EJBTest.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:171)

-------------------------------------------------------------------------
ejb-jar.xml
-----------

<enterprise-beans>
<session id="Session_MyTime">
<description>An EJB named counter</description>
<display-name>Ejb Lccal Counter</display-name>
<ejb-name>Counter</ejb-name>
<local-home>test.CounterLocalHome</local-home>
<local>test.CounterLocal</local>
<ejb-class>test.CounterBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<description>This is a Counter session</description>
<ejb-ref-name>ejb/Counter</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>test.CounterLocalHome</local-home>
<local>test.CounterLocal</local>
<ejb-link>Counter</ejb-link>
</ejb-local-ref>
</session>
</enterprise-beans>
</ejb-jar>

-------------------------------------------------------------------
Client code ( JSP client)
------------------------
try {
InitialContext context = new InitialContext();
out.println("Context created.....");
CounterLocalHome home =(CounterLocalHome)context.lookup("java:comp/env/ejb/Counter");
CounterLocal remote=home.create();
out.println(" hit count....."+remote.hit()); out.println(" === finished ===== ");
}
catch (Exception e) {
out.println(e);
e.printStackTrace();
}


%>

------------------------------------------------------------------------
web.xml
--------
<web-app id="WebApp_ID" version="2.4"<br /> xmlns="http://java.sun.com/xml/ns/j2ee"<br /> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br /> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee <a href="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; rel="nofollow">" target="_blank">http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">;
<display-name>
counter</display-name>
<ejb-local-ref>
<ejb-ref-name>ejb/Counter</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>test.CounterLocalHome</local-home>
<local>test.CounterLocal</local>
<ejb-link>Counter</ejb-link>
</ejb-local-ref>
</web-app>


=================================================================
I try to Print the lookup Class before going to cast. it print the classs name is

out.print("Output="+context.lookup("java:comp/env/ejb/Counter").toString());

Output === test.EJSLocalStatelesscounterHome_8ada3073@181b8107(BeanId(__homeOfHomes#__homeOfHomes#__homeOfHomes, counter_jar#counter.jar#counter))


please help me to solve the problem....... Advance Thanks.............
13 years ago
Hi

this my client code.



public static void main(String a[]){
try {
/*************** WAS *************/
Properties p = new Properties();
p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
p.put(javax.naming.Context.PROVIDER_URL, "iiop://172.26.9.124:2812";);
InitialContext context = new InitialContext(p);
System.out.println("=====context created finished.....");
Object result = ic.lookup("time");

System.out.println("lookup finished.....");
MyTimeLocal myTimeLocal = myTimeHomeLocal.create();
System.out.println("create finished.....");
String server_time = myTimeLocal.getTime();
System.out.println("SERVER TIME =: "+server_time);
}
catch (Exception e) {
System.out.println(e);
e.printStackTrace();
}
}



ejb-jar.xml
-----------

<enterprise-beans>
session id="Session_MyTime">
description> An EJB named MyTimeBean /description>
display-name> MyTimeBeanName /display-name>
ejb-name> MyTimeBean </ejb-name>
local-home> mytimepak.MyTimeLocalHome /local-home>
local> mytimepak.MyTimeLocal /local>
ejb-class> mytimepak.MyTimeBean /ejb-class>
session-type> Stateless /session-type>
transaction-type> Container /transaction-type>
/session>
</enterprise-beans>



[ April 29, 2007: Message edited by: babujava jayaraman ]

[ April 29, 2007: Message edited by: babujava jayaraman ]
[ April 29, 2007: Message edited by: babujava jayaraman ]
13 years ago
Hi All

Iam new to websphere 6, I try to lookup the Local Ejb in java Client as well as jspclient. I got the following error. please help me to solve the problem. but remote Interface working fine.


javax.naming.NameNotFoundException: Context: S6324Node01Cell/nodes/S6324Node01/s
ervers/myEJB, name: time: First component in name time not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0]
javax.naming.NameNotFoundException: Context: S6324Node01Cell/nodes/S6324Node01/servers/myEJB, name: time: First component in name time not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/Nami
ngContext/NotFound:1.0 at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHe
lper.java:85)
at m.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java
:4045)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1
776)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1
737)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:
1444)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:132
4)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:144)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
at ejb.bind.ejbBindCheck.main(ejbBindCheck.java:87)



ejb-jar.xml
-----------

<?xml version="1.0" encoding="UTF-8"?>
< !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 id="ejb-jar_ID">
<description>
ejb-jar.xml for LocalizationDepwb component
</description>
<display-name>time</display-name>
<enterprise-beans>
<session id="Session_MyTime">
<description>An EJB named MyTimeBean</description>
<display-name>MyTimeBeanName</display-name>
<ejb-name>MyTimeBean</ejb-name>
<local-home>mytimepak.MyTimeLocalHome</local-home>
<local>mytimepak.MyTimeLocal</local>
<ejb-class>mytimepak.MyTimeBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>

JNDI Name = time

But both remote and local interface working fine in JBOSS server. please Help me to solve the problem..

Thanks lots.....
13 years ago