Statefull bean Reference in a JSP

Weblogic Server 4.5.1
          I have got the reference to a statefull session bean in a JSP, how can i use
          the same reference of session bean in another JSP file. How is this
          achieved.
          Here is an example of the problem
          In a JSP file i display all the information regarding the user using the
          statefull session bean, since this bean maintains the session of the user i
          want to call another method in another jsp using the same statefull sessio
          bean object, which i created in first Jsp. How is this possible
          Thanks in Advance
          Update me. Keep in touch.
          With Warm Regards
          Pavan Kumar
          BenchMark Softech Limited
          150 Luz Church Road
          Mylapore
          Chennai - 4, TN-INDIA
          PH-4987589,90,91,92,93,4971094
          http://www.benchmarkindia.com
          

Put the EJB handle in HttpSession.
          Cheers - Wei
          Pavan <[email protected]> wrote in message
          news:[email protected]..
          > Weblogic Server 4.5.1
          > I have got the reference to a statefull session bean in a JSP, how can i
          use
          > the same reference of session bean in another JSP file. How is this
          > achieved.
          > Here is an example of the problem
          >
          > In a JSP file i display all the information regarding the user using the
          > statefull session bean, since this bean maintains the session of the user
          i
          > want to call another method in another jsp using the same statefull sessio
          > bean object, which i created in first Jsp. How is this possible
          >
          >
          > Thanks in Advance
          >
          > --
          > -----------------------------------------------------------------
          > Update me. Keep in touch.
          > With Warm Regards
          > Pavan Kumar
          >
          > BenchMark Softech Limited
          > 150 Luz Church Road
          > Mylapore
          > Chennai - 4, TN-INDIA
          > PH-4987589,90,91,92,93,4971094
          > http://www.benchmarkindia.com
          >
          >
          

Similar Messages

  • How does session bean contain in the JSP page

    May i know how session bean contains in the JSP page
    If the situation is like the following ...
    if i dont want to put the session bean in the session
    like this :
    session.setAttribute("UserBean",userBean);
    the way i get the session bean is only
    session.getAttribute("UserBean");
    Does have the other way to get the Session bean during the JSP
    if i dont want to use this kind of way,
    what else i can do for?
    may i know the solution with detailed
    and please attach the solution of code to me if you know...
    thanks...

    Hi,
    I am not clear with ur query..
    What I understood from ur query is that, u are trying to put the session ejb in the HttpSession Object for some use ahead in future?
    If this is the case, then I think are approach is not correct.
    StatefulSession beans are meant for this purpose, i.e they will be maintaining the client session. So use the same using the JndiLookup of the HomeInterface and the getting the Home reference and calling the businessmethods
    sameer

  • How to call a void bean method in a jsp ?

    I want to call a bean method from the jsp page. The method is void i.e it returns nothing.
    Lets say the bean id is mybean and the method name is beanmethod( ). I want to know in what type of jsp tags should I put mybean.beanmethod( ). Using jsp expression <%= mybean.beanmethod( ) %> gives error and so does scriptlet <% mybean.beanmethod( ) %>
    Can someone help me out. Thanx.
    Arshad

    did you already implement this?
    <jsp:useBean id="mybean" class="yourPackage.YourBean scope="session"/>
    use ";" at the end:
    <% mybean.beanmethod(); %>

  • Can I use any Class in a Use Bean Tag of a JSP

    I have tried to modify the existing EditForm.java file and created a new Class File which changes the presentation(render method)in the Edit Form.
    can I use the new class as a Bean in the use bean tag of a JSP.

    You can use any class as part of the useBean tag. If you want to add your class to the list of available webbeans, you can add it to <jdev dir>\teamplates\webbeans.xml.

  • Moving Scriptlet Code to backing bean when converting from JSP - Facelets

    Hello!
    We are converting our application from jsf1.2 to 2.0 and all jsps are being converted to XHTML. Some are trivial while others had very complex scriptlets.
    I would like to know what are some of the recommended ways of moving Scriptlet Code to backing bean when converting from JSP -> Facelets.
    I have thought about listeners, actionListeners, putting code getXXXX() of the backing bean and then calling #{bean.XXXX} but not sure whats the best way.
    I do appreciate the response!
    Eg of a jsp page:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="/WEB-INF/xxx-jsf.tld" prefix="l" %>
    <%@ taglib uri="/WEB-INF/yyy-pp.tld" prefix="p" %>
    <%@ page import="com.ttyy.search.beans.jsf.AdvancedSearchFormManagedBean" %>
    <%@ page import="com.kkee.util.*"%>
    <%
        AdvancedSearchFormManagedBean advancedSearchFormManagedBean = (AdvancedSearchFormManagedBean) request.getSession().getAttribute("AdvancedSearchFormManagedBean");
        if (advancedSearchFormManagedBean == null) {
           advancedSearchFormManagedBean = new AdvancedSearchFormManagedBean();
           request.getSession().setAttribute("AdvancedSearchFormManagedBean", advancedSearchFormManagedBean);
        advancedSearchFormManagedBean.initializeForAdvancedSearchOptions();
        advancedSearchFormManagedBean.setQuickSearch();
         request.setAttribute("portletHeader", "Hello " + advancedSearchFormManagedBean.getPerson().getFirstname() + ", check out the latest programs in your practice areas and jurisdictions");
    %>
    <h:form id="MYCenterForm">
         <p:portletRenderer portletSetName="test of portlet"
              portletContainer="#{PortletContainerManagedBean}"
              id="MYCenter"
              portletScope = "TEST_SCOPE"
              suppressIfNoData="true"
              portletSkinName="SOME_SKIN">
              <f:facet name="persistenceToolkit">
                   <h:commandLink id="persistenceToolkitLink"
                        actionListener="#{PortletContainerManagedBean.persistPortletSetStateListener}">
                        <h:outputText value="Save State Of Portlet Set" id="persistenceToolkitLinkText"/>
                   </h:commandLink>
              </f:facet>
         </p:pagePortletSetRenderer>
    </h:form>
    <%
         String flag = PropertyItems.getInstance().getPropertyItem("response.time.flag");
         if("1".equals(flag)){
              ResponseTime rt = (ResponseTime) session.getAttribute("responseTime");
            if(rt!=null){
                rt.setDesc("my cle loaded");
                long now = System.currentTimeMillis();
                long start = rt.getStart() + rt.getTotal();
                rt.setInterval(now-start);
                rt.setTotal(rt.getTotal()+rt.getInterval());
                LogUtil.log(rt.toString(), LogUtil.DEBUG_LEVEL);
                session.setAttribute("responseTime", rt);
    %>

    That helps.
    This could be another topic question but itst kind of related to what i am doing right now. while converting JSP to facelet (in jsf2) I came across another issue.
    <h:commandLink id="Save" rendered="#{RegistrationBean.isNOTInOrigionalRegistrationMode}" action="#{RegistrationBean.updateProfile2Submit}" styleClass="#{portalSkinManagedBean.contentPortletSkin.strongTextStyle}">
              <l:htmlSkinnedImage id="SaveImage" style="border:0;" url="save.gif" alt="Save Information"/>
    </h:commandLink>When I click on the generated link, I get this. And this is happening for all the h:commandLink in the application.
    http://localhost:9080/registration/updateProfile2.jsf[request.getQueryString()=null][request.getRequestedSessionId()=F1CCE237DD81D301F1C4DBA6910FFD8A][request.isRequestedSessionIdFromCookie()=true][request.isRequestedSessionIdFromURL()=false][request.isRequestedSessionIdValid()=true]Parameters:[rolePracticeAreasForm:title=rolePracticeAreasForm:primaryPracticeArea=10002javax.faces.ViewState=-2943345291093118815:-4400303399130292206rolePracticeAreasForm:practiceAreasMod2=10148.1rolePracticeAreasForm:practiceAreasMod1=10002.1rolePracticeAreasForm:Save=rolePracticeAreasForm:SaverolePracticeAreasForm=rolePracticeAreasFormrolePracticeAreasForm:otherField=rolePracticeAreasForm:fromMyAccount=1]||
    javax.servlet.ServletException: Index: 0, Size: 0
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at com.legaledcenter.util.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:250)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at com.jscape.framework.galileo.support.upload.UploadFilter.doFilter(UploadFilter.java:71)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
         at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
         at java.util.ArrayList.RangeCheck(ArrayList.java:547)
         at java.util.ArrayList.get(ArrayList.java:322)
         at javax.faces.component.AttachedObjectListHolder.restoreState(AttachedObjectListHolder.java:161)
         at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1427)
         at com.sun.faces.application.view.StateHolderSaver.restore(StateHolderSaver.java:121)
         at com.sun.faces.application.view.StateManagementStrategyImpl$4.invokeContextCallback(StateManagementStrategyImpl.java:289)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1253)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1262)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1262)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1262)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1262)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
         at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:284)
         at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
         at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:119)
         at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:434)
         at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
         at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
         at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
         at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
         ... 22 more
    ********** Message End *************Thanks

  • Need some explanation about statefull-bean

    Hi.
    I want to develop a statefull session bean that should store user information - userName of the logged user for example. So I create that bean in my login action and store that information therin (set that field). Then in other action I want to check if the user is logged. Should I create a new instance of the bean?? I do so but the persistent field is null and the user information from login action is lost.
    Are there any extra procedures that Statefull Bean should provide??.
    Bartek

    When using a StatefulSessionBean (SFSB), you should get the Handle of the Remote and pass that along in your HTTP session. This allows your "user session" to maintain state across pages via the SFSB. If you do not, then (as you noticed), you'll "lose" the stateful information because you end up creating/using another instance.

  • Can anyone give me a bean for JAVAMAIL in JSP?

    Can anyone give me a bean for JAVAMAIL in JSP?
    I'd like to use a bean instead of writing a complete jsp page for each of my send mail options!!

    Have a look in the javaMail forum, youll find code for a class in there without too much trouble.

  • How do I lookup an EJB 3.0 Session bean from servlet or JSP?

    Does anyone knows how can I invoke an EJB from a servlet or JSP ?
    I deployed a simple EJB on a Oracle Application Server 10g release 10.1.3 and I'm working with JDeveloper 10.1.3. I deployed the files via JDeveloper, and I didn´t specify any orion-ejb-jar.xml or ejb-jar.xml file
    After deployment, the orion-ejb-jar.xml look like this in the server:
    <?xml version="1.0" encoding="utf-8"?>
    <orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd" deployment-version="10.1.3.0.0" deployment-time="10b49516c8f" schema-major-version="10" schema-minor-version="0" >
    <enterprise-beans>
    <session-deployment name="HolaMundoEJB" location="HolaMundoEJB" local-location="HolaMundoEJB_HolaMundoEJBLocal" local-wrapper-name="HolaMundoEJBLocal_StatelessSessionBeanWrapper6" remote-wrapper-name="HolaMundoEJB_StatelessSessionBeanWrapper7" persistence-filename="HolaMundoEJB.home_default_group_1">
    </session-deployment>
    </enterprise-beans>
    <assembly-descriptor>
    <default-method-access>
    <security-role-mapping name="<default-ejb-caller-role>" impliesAll="true" />
    </default-method-access>
    </assembly-descriptor>
    </orion-ejb-jar>
    I'm trying to invoke the ejb in a servlet by doing the following:
    public void doGet(HttpServletRequest request, ....
    Context context = new InitialContext();
    HolaMundoEJB helloWorld =
    (HolaMundoEJB)context.lookup("java:com/env/ejb/HolaMundoEJB");
    String respuesta = helloWorld.sayHello("David");
    When i invoke the servlet I catch a NamingException whose message says something
    like this ....java:com/env/ejb/HolaMundoEJB not found in webLlamaEJB
    I tried different paths for the lookup but nothing....
    Can anyone help me with this topic? Thank you.

    Please try the following code:
    HelloEJBBean.java:
    @Stateless(name="Hello")
    @Remote(value={Hello.class})
    public class HelloEJBBean implements Hello {  ... }
    hello.jsp:
    Context ctx = new InitialContext();
    Hello h = (Hello)ctx.lookup("ejb/Hello");
    web.xml:
    <ejb-ref>
    <ejb-ref-name>ejb/Hello</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <remote>fi.kronodoc.test.model.Hello</remote>
    </ejb-ref>
    i think you should also define jndi mappings for the references in orion-ejb-jar.xml and orion-web.xml but for some reason it seems to be working also without these.

  • Accessing bean attributes in a JSP

    Hi,
    I am sending a bean from a Servlet to a JSP as follows:
    request.setAttribute("newclientTEST", ro_client);
    this.getServletContext().getRequestDispatcher("/jsp/private/research/UserAdded.jsp").forward(request,
    response);I can then access the bean in UserAdded.jsp page as follows:
    <jsp:getProperty name="newclientTEST" property="username" />This works fine and returns the username from the bean but I am a little confused why this is working. From what i have read about JSPs so far in order to access properties of a bean in a JSP we first of all have to make a reference to the bean as follows:
    <jsp:useBean id="newclientTEST" scope="request" class="ie.scourced.beans.PrivateClientBean" />Why does it work for me when I don't refer to the bean using useBean??
    Thanks

    how?.... mmmm ... did ... (head scratch) ...I miss that.
    Thanks a million for spotting that, I really did appreciate that.
    jp.

  • Bean not working in jsp

    OK, maybe I'm oversharing, but I want to be thorough. Note I asked this question a different way using very different code.
    Here's my jsp file - myq.jsp
    <%@ page language="java" import="java.util.*,com.serco.inquire.*" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="inq" tagdir="/WEB-INF/tags" %>
    <inq:displayCollection>
    <jsp:attribute name="mgr">Chris Novish</jsp:attribute>
    </inq:displayCollection>Here's displayCollection.tag used by that jsp:
    <%@ tag body-content="scriptless" import="com.serco.inquire.*" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ attribute name="mgr" required="true" %>
    <jsp:useBean id="irc" scope="session" class="com.serco.inquire.IrCollection">
      <jsp:setProperty name="irc" property="mgrid" value="${mgr}" />
    </jsp:useBean>
    ${irc.size} | ${irc.mgrid}Here's the java class IrCollection (used as a bean in the tag):
    package com.serco.inquire;
    import java.sql.*;
    import java.util.*;
    public class IrCollection {
         public ArrayList iRecords = new ArrayList<InquireRecord>();
         public int size;
         public String mgrid;
         public irCollection() {
              super();
         public void populateCollection() {
              try {
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   String filename = "inquire.mdb";
                   String database = "jdbc:odbc:Driver={Microsof Access Driver (*.mdb)};DBQ=";
                   database+= filename.trim() + ";DriverID=22;READONLY=true}";
                   Connection con = DriverManager.getConnection( database ,"","");
                   Statement s = con.createStatement();
                   s.execute ("SELECT * FROM inquiries WHERE manager = '" + this.mgrid + "'");
                   ResultSet rs = s.getResultSet();
                   int cur;
                   while (rs.next()) {
                        cur = rs.getRow()-1;
                        InquireRecord localIR = new InquireRecord();
                        int curID = rs.getInt("ID");
                        localIR.setID(curID);
                        String cursub = rs.getString("submitter");
                        localIR.setSubmitter(cursub);
                        this.iRecords.add(cur, localIR);
                   con.close();
                   this.size = iRecords.size();
              catch (Throwable e) {
                   System.out.println(e);
         public int getSize () {
              return this.size;
         public void setMgrid(String datum) {
              this.mgrid = datum;
              this.populateCollection();
         public String getMgrid() {
              return this.mgrid;
    }and here's the InquireRecord java class used by IrCollection:
    package com.serco.inquire;
    public class InquireRecord {
         private int ID;
         private String submitter;
         public InquireRecord() {
              super();
         public InquireRecord(String asubmitter) {
              this.submitter = asubmitter;
         public int getID(){
              return this.ID;
         public void setID(int datum) {
              this.ID = datum;
         public String getSubmitter() {
              return this.submitter;
         public void setSubmitter(String datum) {
              this.submitter = datum;
    }The JSP does this: set the mgr variable, which is passes to the tag, the tag then creates an instance of IrCollection using that mgr variable. (Yes, putting that populateCollection() method call in the setMgrid() method is probably Bad Practice, but it works, usually). The IrCollection objects builds an ArrayList of InquireCollection objects from an Access database. It then sets it's size property based on how many InquireCollection instances it put into the ArrayList. Once that's all done, the tag spits out 2 things: The size property and the mgrid property.
    When I view the JSP, it gives me 0 for the size and Chris Novish for the mgrid.
    I think this could be one of the following:
    *Not finding any matching records of the database
    *Not actually executing the populateCollection() method
    *some how forgetting the information it put into that ArrayList?
    I"m sure there's another possibility, but I don't know.
    Here's what gets me. Here's a test class I made called TestCollection:
    {code}package com.serco.inquire;
    import java.util.*;
    import java.text.*;
    public class TestCollection {
         public static void main(String[] args) {
              IrCollection myCollection = new IrCollection();
              myCollection.setMgrid("Chris Novish");
              System.out.println(myCollection.getSize());
              System.out.println(myCollection.getMgrid());
    }{code}
    if I run that I get a size of 4 and a mgrid of Chris Novish.
    Same data in, and it works as expected.
    So... why won't JSP do it?

    You have defined a session scope for that bean. You have to make sure that the bean is instantiated by this jsp and not earlier. If the bean is located in the session because it was set earlier, then the body tags within useBean are not evaluated.
    Look here - http://java.sun.com/products/jsp/tags/syntaxref.fm14.html#8865
    An easy way to test it would be to change the scope of the bean to request.
    ram.

  • Assining a bean attribute to a jsp variable

    I am writing a struts application and am using
    <bean:write name="configattribute" property="name"/>
    to print out info on my jsp page.
    I was wondering if I could assign that value to a local jsp variable so I can check its value and change the colour of the text accordingly.
    e.g.
    String name = <bean:write name="configattribute" property="name"/>;
    if name.equals("Ben"){
    out.print(<font color=\"red\">;
    else{
    out.print(<font color=\"blue\">;
    }

    You should still be able to use the code I listed...the logic:iterate tag creates the bean "configname" in the page scope. So you should be able to do something like this:
    <logic:iterate id="configname" name="confignames">
       <tr>
          <td>
    <% ConfigName configname = (ConfigName)pageContext.getAttribute( "configname" );
       String color = "blue";
       if( "julius".equalsIgnoreCase( configName.getOwner( ) ) )
          color = "red";
       } %>
            <span style="color: <%= color %>"><bean:write name="configname" property="owner"/></span>
          </td>
          <td>
             <bean:write name="configname" property="name"/>
          </td>
       </tr>
    </logic:iterate>Does that sound right?
    - Jesse

  • How to add multiple bean id in a jsp page

    i need to add two bean id in a single jsp page can anyone suggest me how can i do that?
    <jsp:useBeanid="newmember" class = "com.assignment.member" scope ="request"/>now if i want to add another bean id in the same jsp page is that possible? how can i do that? please help

    <jsp:useBeanid="newmember" class = "com.assignment.member" scope ="request"/>
    <jsp:useBeanid="newmember2" class = "com.assignment.member2" scope ="request"/>
    <jsp:useBeanid="newmember3" class = "com.assignment.membe3r" scope ="request"/>
    upto N bean

  • How to cast back and use a retrieved Session Bean reference in a servlet?

    Please help!
    1. I invoke a Session Bean from a servlet :
    travelagent = home.create();
    2. I store the travelagent reference in the HTTP Session :
    session.setAttribute( "travelagent" , travelagent );------------------------------------------------------------------------------------------------------------------
    Now, in another servlet, I have to retrieve the reference to the EJB from the HTTPSession.
    I then have to use this reference to call a business method in the EJB Session Bean.
    I have tried two ways to retrieve the reference and cast it before calling the business method. I get errors in both forms of casting.
    The Values you will see below in the code:
    EJB Remote Interface : TravelAgent (TravelAgent.java)
    Business Method : listItineraries( )
    Servlet which calls the above method : ListItinerary.java
    Line 46 of ListItinerary.java : ArrayList itineraries = traveler.listItineraries();------------------------------------------------------------------------------------------------------------------
    The two ways along with the error I get on the servlet page in the browser are :
    (A)
    TravelAgent traveler = (TravelAgent)session.getAttribute("travelagent");The error I get is :
    java.rmi.NoSuchObjectException: CORBA OBJECT_NOT_EXIST 9998 Maybe; nested exception is:
         org.omg.CORBA.OBJECT_NOT_EXIST: vmcid: 0x2000 minor code: 1806 completed: Maybe
    com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:208)
         com.sun.corba.ee.impl.javax.rmi.CORBA.Util.wrapException(Util.java:591)
         javax.rmi.CORBA.Util.wrapException(Util.java:277)
         source.traveler.ejb._TravelAgent_Stub.listItineraries(Unknown Source)
         source.traveler.servlet.ListItinerary.processRequest(ListItinerary.java:46)
    (B)
    TravelAgent traveler  =
    (TravelAgent)PortableRemoteObject.narrow(session.getAttribute("travelagent"), TravelAgent.class);The error I get is :
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.RemoteException
         com.sun.corba.ee.impl.javax.rmi.CORBA.Util.wrapException(Util.java:597)
         javax.rmi.CORBA.Util.wrapException(Util.java:277)
         source.traveler.ejb._TravelAgent_Stub.listItineraries(Unknown Source)
         source.traveler.servlet.ListItinerary.processRequest(ListItinerary.java:46)
    Could someone advice on how to retrieve and cast the EJBObject's reference from the servlet so that I may use it to call the business method?
    Thanks!

    Thanks guys! It worked.
    1.. I should have used the handle. Got to coding without going deep in the concepts.
    2.. I dont know if I could have used the EJB Reference directly (instead of the handle).
    3.. The error was due to me not mapping the servlets with the EJBs that they could use. I continued to get the same error even after using the handle. Once I put the mapping to the EJBs correctly, everything fell in place.
    Thanks a lot!
    Henry

  • Beginner trying to get my beans to work with jsp on tomcat

    Please help me open my eyes!
    I know this is a stupid oversight on my part, but I've been working for days on getting other things to work on my tomcat server, so I'm out of ideas on this one.
    I've followed all the tomcat docs instructions on where to put my jsp and bean files and set my classpath to where my beans are located. jsps work fine for me but when I try to run this jsp that uses my CalcBean, I get this and similar internal server errors:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 1 in the jsp file: /jsp/calc/calculate.jsp
    Generated servlet error:
    C:\jakarta-tomcat-4.0\work\Standalone\localhost\research\jsp\calc\calculate$jsp.java:56: Class org.apache.jsp.CalcBean not found.
    CalcBean calc = null;
    ^
    Do I need to register my bean somewhere like web.xml?
    Thanks so much in advance for any help!!

    rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww

  • Message Driven Bean Reference Problem

    Hi,
    I have problems a MDB referencing other beans, I am getting Class Cast
    exception whenever my MDB tries to use narrow operation after the lookup
    is done.
    The Code is as follows:
    public void ejbCreate () throws CreateException {
    log("ejbCreate called");
    try {
    InitialContext ctx = new InitialContext();
    Object ref = ctx.lookup("java:comp/env/ejb/LoggerCache");
    log("Lookup of Cache done");
    LoggerCacheHome loggerCacheHome = (LoggerCacheHome)
    PortableRemoteObject.narrow(ref, LoggerCacheHome.class);
    } catch(Exception ex) {
    ex.printStackTrace();
    The lookup is successful but when I try to use the narrow..... I get the
    following exception stackk Trace.
    Any help will be appreciated.
    TIA,
    Vikas
    Stack Trace
    java.lang.ClassCastException
    at
    weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteO
    bjectDelegateImpl.java:90)
    at
    javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
    at
    examples.ejb20.message.MessageTraderBean.ejbCreate(MessageTraderBean.
    java:90)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    weblogic.ejb20.internal.MessageDrivenEJBHome.createBean(MessageDriven
    EJBHome.java:290)
    at
    weblogic.ejb20.pool.MessageDrivenPool.createBean(MessageDrivenPool.ja
    va:98)
    at weblogic.ejb20.pool.Pool.createInitialBeans(Pool.java:100)
    at weblogic.ejb20.pool.Pool.<init>(Pool.java:74)
    at weblogic.ejb20.pool.EntityPool.<init>(EntityPool.java:34)
    at
    weblogic.ejb20.pool.MessageDrivenPool.<init>(MessageDrivenPool.java:4
    3)
    at
    weblogic.ejb20.deployer.MessageDrivenBeanInfoImpl.getPool(MessageDriv
    enBeanInfoImpl.java:336)
    at
    weblogic.ejb20.deployer.MessageDrivenBeanInfoImpl.deploy(MessageDrive
    nBeanInfoImpl.java:403)
    at
    weblogic.ejb20.deployer.Deployer.deployDescriptor(Deployer.java:1105)
    at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:908)
    at weblogic.j2ee.EJBComponent.deploy(EJBComponent.java:31)
    at weblogic.j2ee.Application.deploy(Application.java:167)
    at
    weblogic.j2ee.J2EEService.deployApplication(J2EEService.java:173)
    at
    weblogic.management.mbeans.custom.Application.setLocalDeployed(Applic
    ation.java:217)
    at
    weblogic.management.mbeans.custom.Application.setDeployed(Application
    .java:187)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    weblogic.management.internal.DynamicMBeanImpl.invokeSetter(DynamicMBe
    anImpl.java:1136)
    at
    weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBe
    anImpl.java:773)
    at
    weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBe
    anImpl.java:750)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(Conf
    igurationMBeanImpl.java:256)
    at
    com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1356)
    at
    com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1331)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBean
    s(ConfigurationMBeanImpl.java:318)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(Conf
    igurationMBeanImpl.java:259)
    at
    com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1356)
    at
    com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1331)
    at
    weblogic.management.internal.MBeanProxy.setAttribute(MBeanProxy.java:
    291)
    at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:173)
    at $Proxy91.setDeployed(Unknown Source)
    at
    weblogic.management.mbeans.custom.ApplicationManager.autoDeploy(Appli
    cationManager.java:494)
    at
    weblogic.management.mbeans.custom.ApplicationManager.poll(Application
    Manager.java:465)
    at
    weblogic.management.mbeans.custom.ApplicationManager.poll(Application
    Manager.java:380)
    at
    weblogic.management.mbeans.custom.ApplicationManager.update(Applicati
    onManager.java:152)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:562)
    at
    weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    .java:548)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:285)
    at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55)
    at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
    at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:437)
    at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:178)
    at $Proxy2.update(Unknown Source)
    at
    weblogic.management.console.pages._domain._upload_app._jspService(_up
    load_app.java:172)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:213)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:1265)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:1622)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

    Print the class info for the castee and the cast-to classes. They are
    incompatible, and hence the exception. It could be a bug in your code, or
    it could be a classloader issue (resulting from how you
    packaged/deployed/how your app works) or something like that.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com
    +1.617.623.5782
    WebLogic Consulting Available
    "Vikas" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I have problems a MDB referencing other beans, I am getting Class Cast
    exception whenever my MDB tries to use narrow operation after the lookup
    is done.
    The Code is as follows:
    public void ejbCreate () throws CreateException {
    log("ejbCreate called");
    try {
    InitialContext ctx = new InitialContext();
    Object ref = ctx.lookup("java:comp/env/ejb/LoggerCache");
    log("Lookup of Cache done");
    LoggerCacheHome loggerCacheHome = (LoggerCacheHome)
    PortableRemoteObject.narrow(ref, LoggerCacheHome.class);
    } catch(Exception ex) {
    ex.printStackTrace();
    The lookup is successful but when I try to use the narrow..... I get the
    following exception stackk Trace.
    Any help will be appreciated.
    TIA,
    Vikas
    Stack Trace
    java.lang.ClassCastException
    at
    weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteO
    bjectDelegateImpl.java:90)
    at
    javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
    at
    examples.ejb20.message.MessageTraderBean.ejbCreate(MessageTraderBean.
    java:90)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    weblogic.ejb20.internal.MessageDrivenEJBHome.createBean(MessageDriven
    EJBHome.java:290)
    at
    weblogic.ejb20.pool.MessageDrivenPool.createBean(MessageDrivenPool.ja
    va:98)
    at weblogic.ejb20.pool.Pool.createInitialBeans(Pool.java:100)
    at weblogic.ejb20.pool.Pool.<init>(Pool.java:74)
    at weblogic.ejb20.pool.EntityPool.<init>(EntityPool.java:34)
    at
    weblogic.ejb20.pool.MessageDrivenPool.<init>(MessageDrivenPool.java:4
    3)
    at
    weblogic.ejb20.deployer.MessageDrivenBeanInfoImpl.getPool(MessageDriv
    enBeanInfoImpl.java:336)
    at
    weblogic.ejb20.deployer.MessageDrivenBeanInfoImpl.deploy(MessageDrive
    nBeanInfoImpl.java:403)
    at
    weblogic.ejb20.deployer.Deployer.deployDescriptor(Deployer.java:1105)
    at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:908)
    at weblogic.j2ee.EJBComponent.deploy(EJBComponent.java:31)
    at weblogic.j2ee.Application.deploy(Application.java:167)
    at
    weblogic.j2ee.J2EEService.deployApplication(J2EEService.java:173)
    at
    weblogic.management.mbeans.custom.Application.setLocalDeployed(Applic
    ation.java:217)
    at
    weblogic.management.mbeans.custom.Application.setDeployed(Application
    .java:187)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    weblogic.management.internal.DynamicMBeanImpl.invokeSetter(DynamicMBe
    anImpl.java:1136)
    at
    weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBe
    anImpl.java:773)
    at
    weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBe
    anImpl.java:750)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(Conf
    igurationMBeanImpl.java:256)
    at
    com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1356)
    at
    com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1331)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBean
    s(ConfigurationMBeanImpl.java:318)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(Conf
    igurationMBeanImpl.java:259)
    at
    com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1356)
    at
    com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1331)
    at
    weblogic.management.internal.MBeanProxy.setAttribute(MBeanProxy.java:
    291)
    at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:173)
    at $Proxy91.setDeployed(Unknown Source)
    at
    weblogic.management.mbeans.custom.ApplicationManager.autoDeploy(Appli
    cationManager.java:494)
    at
    weblogic.management.mbeans.custom.ApplicationManager.poll(Application
    Manager.java:465)
    at
    weblogic.management.mbeans.custom.ApplicationManager.poll(Application
    Manager.java:380)
    at
    weblogic.management.mbeans.custom.ApplicationManager.update(Applicati
    onManager.java:152)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:562)
    at
    weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    .java:548)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:285)
    at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55)
    at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
    at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:437)
    at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:178)
    at $Proxy2.update(Unknown Source)
    at
    weblogic.management.console.pages._domain._upload_app._jspService(_up
    load_app.java:172)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:213)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:1265)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:1622)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

Maybe you are looking for

  • No BOM explosion in assembly order

    Dear Experts, I am running a assembly order, type PP04 which is directly created from a sales order.  During the creation, the BOM is exploded. My question is that how can I disable the BOM explosion as I want to enter all the components according to

  • Multiple iTunes Accounts Bug?

    Hi, I have an iPad 1 that did belong to my boss but I bought it from him when he had to let me go. So, there are 3 iTunes accounts linked to it. His personal account, a work related account, and my personal account. Apps have been purchased under eac

  • Marine transportation

    Dear all, Is there any table about "marine transportation" in SAP? Thanks regards

  • Sale order smartform driver program

    Hi all      can any one send me the driver program for sale order smartform??? coz i am bit confused with the routines in the driver program! Thanks in advance

  • Flip Video Camera Help

    I'm not sure this is the right forum to ask this question, but this was the closest one I could see with what my issue is. My daughter wants a USB type video camera for Christmas. I have been looking at different ones and really like the Flip one, bu