wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes A strange thing is happening here , i have no clue,pl help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "A strange thing is happening here , i have no clue,pl help " Watch "A strange thing is happening here , i have no clue,pl help " New topic
Author

A strange thing is happening here , i have no clue,pl help

rohit aggarwal
Greenhorn

Joined: Jul 11, 2001
Posts: 21
i have deployed an application with 2 jars and one war file.
war file has two JSP pages and two javaBeans.

now when i run my application either one of the ejbBean is working means if 1st ejb is working then 2nd one is giving error and vice versa.
they are giving following error:
java.lang.ClassCastException
at com.sun.corba.ee.internal.javax.rmi.PortableRemoteObject.narrow(Portab
leRemoteObject.java:296)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
i am stuck to this problem from last week.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

I need more information. Normally a ClassCastException message indicates the type of class it's trying to cast to. Also, the source code context where you are getting the exception would be useful.


Customer surveys are for companies who didn't pay proper attention to begin with.
rohit aggarwal
Greenhorn

Joined: Jul 11, 2001
Posts: 21
when loginBean is working then i get error in category bean , if category bean is working then i get error in login bean
i am sure the erroris on this line
java.lang.Object objref = ic.lookup("java:comp/env/ejb/Category");
objref is not getting initiated
i am getting error on this code in CategoryBean.java
Context ic = new InitialContext();
java.lang.Object objref = ic.lookup("java:comp/env/ejb/Category");
catHome = (CategoryHome) PortableRemoteObject.narrow(objref,ejbBeans.CategoryHome.class);
LoginBean.java
Context ic = new InitialContext();
java.lang.Object objref = ic.lookup("java:comp/env/ejb/Login");
loginHome = (LoginHome) PortableRemoteObject.narrow(objref,ejbBeans.LoginHome.class);
ruijin yang
Ranch Hand

Joined: Apr 29, 2001
Posts: 96
Is your bean stateless?


SUN Certified Business Component Developer Java EE Platform 5 (2008)<br />SUN Certified Developer for Java Web Services (2007)<br />IBM WebSphere Portal V5.1 Application Development (2006)<br />SUN Certified Web Component Developer (2001)<br />SUN Certified Java 2 Programmer (2001)
rohit aggarwal
Greenhorn

Joined: Jul 11, 2001
Posts: 21
yes both bean is stateless
Manjunath Subramanian
Ranch Hand

Joined: Jul 18, 2001
Posts: 236

Hi Rohit,
Are the EJB's talking to each other?.
If they are talking to each other then have you given the
entiy references of one bean to other.
If one EJB is talking to another EJB then you have to mention
in your DD,
1) The EJB coded name
2)The remote Interface
3)And the Home interface of the other EJB.
in the entity references.
Hope this helps,
Manjuanth
rohit aggarwal
Greenhorn

Joined: Jul 11, 2001
Posts: 21
Hi,
what i am doing is that i am showing categories on a page but before it verifies that user is login or not, if not then it is redirected to login screen and asks userlogin and password.
all this is done through JSP. Now login form is submitted and its login name and login password is checked through stateless session bean i.e LoginEJB.if he exists then it sets sessions.
now it is redirected back to category screen where the categories are shown from CategoryEJB bean.
now what i have done is i have made one jar file for login bean and one for category bean through j2ee deploytool.
i also made one war file which contains JSP files,i.e auc_login.jsp,auc_sell_product.jsp,LoginBean.class and Category.class.
LoginBean and CategoryBean are java beans which acts client to their respective ejb's.
i have deployed them through an one application when i run the application, it reflects to login screen,after submitting login form it verifies the user but gives above error in CategoryBean. again if closes this window and open another window then again it asks login screen but this time after submitting the login form it gives above errors in loginBean but categoryBean is working(that i come to know through console where it shows me al the happenings).
ruijin yang
Ranch Hand

Joined: Apr 29, 2001
Posts: 96
I ever met ClassCastException when I was using EJB in JSP.The post of Nauman Rafique's help me to solve my problem.Refer to:
http://www.javaranch.com/ubb/Forum11/HTML/000231.html
------------
ruijin yang
SCJP2
rohit aggarwal
Greenhorn

Joined: Jul 11, 2001
Posts: 21
Hi Ilya,
Thanks for giving me solutions, actualy j2ee deploytool generates the stub classes automaticaly.
i have seen that, any way i think i been wrong some where else but could not able trace the error.
I have done it with taking two other ejb beans.
in j2ee there is no need to do anything explicitly as deploytool will do it for you. thanks all for helping me.
Rohit
 
 
subject: A strange thing is happening here , i have no clue,pl help
 
Similar Threads
deployment in websphere
JSF application with Tomcat and JBoss.
issue with the war file!!
how to open a WAR file
getting error saying Moduler not found!!!