Jsp bean:setvalue problem

i use bean in my jsp page.but the problem is that i didn't get the value.i doubt whether the value actully passed to data.my bean is follows:
package abc;
public class hai
private int a;
public void sethai(int x)
a=x;
public int gethai()
     return a;
my files are as follows
1) simple.html
<html>
<head>
</head>
<body>
<form action="simple1.jsp" method="post" name="form1" target="_self">
Number:<input name="num" type="text"><br>
<input name="sub" type="submit" value="sub"></form>
</body>
</html>
2)simple1.jsp
<html>
<head></head>
<%@ page import="abc.*" errorPage="" %>
<jsp:useBean id="obj" class="abc.hai" scope="session">
<jsp:setProperty name="obj" property="*"/>
</jsp:useBean>
<% out.println(request.getParameter("num"));%>
<body>number:
<jsp:getProperty name="obj" property="hai" />
</body>
</html>
the output i got is the value 0
pls replay me

Hi Marty,
Here is my portalapp.xml file:
<?xml version="1.0" encoding="utf-8"?>
<application>
  <application-config>
    <property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
    <property name="SharingReference" value="htmlb"/>
  </application-config>
  <components>
    <component name="DynPageOne">
      <component-config>
        <property name="ClassName" value="com.mycompany.basicexample.DynPageOne"/>
        <property name="SecurityZone" value="com.mycompany.basicexample.DynPageOne/low_safety"/>
      </component-config>
      <component-profile>
        <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
        <property name="com.sap.portal.reserved.iview.IsolationMode" value="URL"/>
      </component-profile>
    </component>
  </components>
  <services/>
</application>
I also created a getter method in my bean to return a static value and that value is returned correctly.  Any more ideas?

Similar Messages

  • JSP/beans classpath problems

    I'm runnning Tomcat 3.3 on Solaris 8. I'm writing a JSP application which uses a JavaBean that I wrote. The beans class name is testbeans.CalendarBean. I'm getting ClassNotFoundExceptions when I try to import the bean. My JSP is located at TOMCAT_HOME/webapps/test/jsp/
    My bean is located at TOMCAT_HOME/webapps/test/WEB-INF/classes/testbeans/
    I made sure to put the proper include statement in my jsp file as well. Finally, I put my bean in TOMCAT_HOME/lib/ and modified the CLASSPATH variable in tomcat.sh. This worked, but what do I have to do so I can leave the bean in its original location? Thanks.
    John

    Add the following to your JSP file:
    <%@ page
    import = "testbeans.*"
    %>
    Then you can do this:
    <% testbeans.CalendarBean myCB = new CalendarBean();%>
    also, CalendarBean needs a package statement like:
    package testbeans;

  • NEWBIE SUPER EASY JSP / BEAN

    With about half a dozen books sitting around my desk, I can't get a REAL basic jsp to work. I FINALLY got tomcat to NOT give run time errors, however the web page simply outputs "This is output:" I know I am an idiot, but this JSP / bean stuff is upsetting. Any help on the following code would be great.
    basic.jsp is as follows:
    <jsp:useBean id="myBean" class="basic.basicbean" scope="session"/>
    <html>
    <head>
    <title>
    A Simple JSP
    </title>
    </head>
    <body>
    <%
    myBean.setBasicName("Michelle");
    %>
    This is output: <% myBean.getBasicName();%>
    </body>
    </html>
    basicbean.java is as follows:
    package basic;
    import java.beans.*;
    public class basicbean {
    private String BasicName=null;
    /** Creates new basicbean */
    public basicbean() {}
    public String getBasicName() {
    return this.BasicName;
    public void setBasicName(String value) {
    this.BasicName = value;
    Made the .java into the class put it in the basic directory under the classes/basic directory of the WEB-INF. The JSP page loads, but only output is: "This is output:" I am using Tomcat as the JSP server. "Core JSP" "Core Servlets and JavaServer Pages" "Advanced JavaServer Pages" "JSP, Servlets, and MySQL", and "Java Server Pages for Dummies" and I still can't get it. Thanks for helping out an idiot.
    -Jim

    You are very close; just a small error in the line:
    This is output: <% myBean.getBasicName();%>
    The problem is your just simply calling the method and tossing the return value. You have three ways of outputing the bean property:
    This is output: <% out.print(myBean.getBasicName();%>
    or
    This is output: <%=myBean.getBasicName()%>
    or
    This is output: <jsp:getProperty name="myBean" property="BasicName" />
    If you use the <jsp:getProperty> approach, then you must have a <jsp:useBean> somewhere above the getProperty tag.
    - Chris

  • Create jsp/bean webapp deploy fine...  add JSTL library wont deploy!

    winxp
    SJSE8
    PROBLEM:
    Using the new project wizard, I create a simple jsp/bean webapp using the embedded tomcat 5.5.7 as server... It deploys and runs with now issue
    Then, I right-click on project name (in project tree)... click properties... add library... select "JSTL 1.1".... do clean/build.... do deploy - which fails!
    message is: "Failed to deploy application at context path /bcd" (where bcd is my project name)
    Why does this happen?
    --------------simple app---------------
    ***jsp1.jsp****
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
        <h1>JSP Page</h1>
        <h1>get stuff JSP Page</h1>
        <jsp:useBean id="a" class="bcdpkg.IndexBean" scope="request"/>
        <h3>after1...</h3>
        <!--jsp:setProperty name="a" property="stuff" value="xxx" /-->
        <jsp:getProperty name="a" property="stuff" />
        </body>
    </html>***IndexBean.java***
    package bcdpkg;
    public class IndexBean
        /** Creates a new instance of IndexBean */
        public IndexBean()
        private String stuff = "this is stuff";
        public String getStuff()
            return this.stuff;
        public void setStuff(String s)
            this.stuff = s;
    }

    well.... I restarted SJSE8 (and tomcat 5.5.7) and now I can right-click on the project and click deploy...successfully.
    (Apologies for the "hair trigger" posting)
    I'll reply once more if it happens again.
    thanx

  • Redirect from jsp bean to jsp or html page

    I am facing a problem in redirecting to a jsp page from jsp bean
    How do i redirect from jsp bean to any other page like jsp or html.
    [email protected]

    Hi
    The solution you suggested we tried it long before only but it is not feasible for us as we have to implement it in all web pages which are in thousands.
    My need is like this.
    We have given specific time to each of our registered user , as user logs to our portal we calculate session time in bean and as he logs out is new time gets updated. (its like dial up connection)
    Now what happens consider user has left only 10 minutes balance, I can calculate and keep track for his time in bean.Now as the time becomes zero I want to redirect him to home page.
    As u said i can get return value zero for bean and can do it ,but our webpages are near about thousands.

  • Prob with running jsp Bean

    Hi,
    I am trying to run a bean through a jsp but its giving error at useBean tag of jsp:
    The error is :
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /Quadratic.jsp(7,0) The value for the useBean class attribute com.brainysoftware.Quadratic is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1227)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3272)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    My jsp is:
    <HTML>
    <HEAD>
    <TITLE> JSP BEAN Quadratic Example </TITLE>
    </HEAD>
    <BODY>
    <%@ page language="java" %>
    <jsp:useBean id="quadratic" scope="session" class="com.brainysoftware.Quadratic" />
    <jsp:setProperty name="quadratic" property="ia" param="a" />
    <jsp:setProperty name="quadratic" property="ib" param="b" />
    <jsp:setProperty name="quadratic" property="ic" param="c" />
    X1= <%= quad.getDx1( ) %>
    X2= <%= quad.getDx2( ) %>
    End of program
    </BODY>
    </HTML>my bean is:
    package com.brainysoftware;
    import java.io.*;
    class Quadratic{
    int ia;
    int ib;
    int ic;
    String dx1;
    String dx2;
    public int getIa( ) {
    return ia;
    public void setIa( int ii) {
    ia=ii;
    public int getIb( ) {
    return ib;
    public void setIb(int ii) {
    ib=ii;
    public int getIc( ) {
    return ic;
    public void setIc(int ii) {
    ic=ii;
    public String getDx1( ) {
    double detA;
    double result;
    detA= ib*ib -4*ia*ic;
    if(detA<0.0)
    return "Real Roots not possible";
    else {
    result= -ib - Math.sqrt(detA/(2 * ia));
    Double Dresult=new Double (result);
    return Dresult.toString( );
    public String getDx2( ) {
    double detA;
    double result;
    detA= ib*ib -4*ia*ic;
    if(detA<0.0)
    return "Real Roots not possible";
    else {
    result= -ib + Math.sqrt(detA/(2 * ia));
    Double Dresult=new Double (result);
    return Dresult.toString( );
    my directory structure is given below:
    C:\tomcat-5.0.28\jakarta-tomcat-5.0.28\webapps\jsp-examples\WEB-INF\classes\com\
    brainysoftware>dir
    Volume in drive C has no label.
    Volume Serial Number is 4C50-9542
    Directory of C:\tomcat-5.0.28\jakarta-tomcat-5.0.28\webapps\jsp-examples\WEB-IN
    F\classes\com\brainysoftware
    05/22/2005 11:15 PM <DIR> .
    05/22/2005 11:15 PM <DIR> ..
    05/22/2005 11:18 PM 134 CalculatorBean.java
    05/23/2005 12:12 AM 216 Counter.java
    05/24/2005 10:48 PM 358 SimpleJavaBean.java
    06/14/2005 11:16 PM 1,205 Calculator.java
    06/14/2005 11:16 PM 1,323 Calculator.class
    06/16/2005 06:44 PM 534 CalculatorBean2.java
    06/17/2005 08:53 AM 703 CalculatorBean2.class
    06/16/2005 07:00 PM 352 CalculatorBean2.html
    06/17/2005 08:51 AM 588 CalculatorBean2.jsp
    06/17/2005 04:29 PM 97 UploadBean.java
    06/17/2005 04:43 PM 527 FileUploadBean.java
    06/17/2005 04:43 PM 834 FileUploadBean.class
    06/18/2005 12:21 PM 863 Quadratic.java
    06/18/2005 12:21 PM 1,093 Quadratic.class
    14 File(s) 8,827 bytes
    2 Dir(s) 8,615,821,312 bytes free
    C:\tomcat-5.0.28\jakarta-tomcat-5.0.28\webapps\jsp-examples\WEB-INF\classes\com\
    brainysoftware>
    The above clearly shows the presence of Bean in the reqd directory but still I am getting an error. Can somebody help me:
    Zulfi.

    class QuadraticThe class is not public. It is only visible to other classes in the same package as itself, so the servlet (JSP) trying to instantiate and reference it can't see it.
    Make it public.

  • Jelly Bean Update Problems on Xperia S Tablet

    I think we need a new topic for Jelly Bean update problems and fixes.
    Solved!
    Go to Solution.

    small fonts and icons blurry pixelated in notification or google agenda widget
    browser crashes a lot.
    Missing jelly bean home launcher
    Wifi disconnecting for no reason.
    Animations aren't smooth tough tablet is more responsive then android 4.0.3 release6b

  • Redundant information in JSP bean action

    Class Person:
    public class Person{
    private String name;
    public void setName(String p){
    name=p;
    public String getName(){
    return name;
    }Code in servlet:
    public void doPost(HTTPServletRequest request, HTTPServletResponse response) throws IOException,ServletException{
    foo.Person p= new foo.Person();
    p.setName("New Guy");
    request.setAttribute("person",p);
    RequestDispatcher view = request.getRequestDispatcher("result.jsp");
    view.forward(request,response);
    }Code in JSP:
    <jsp:useBean id="person" class="foo.Person" scope="request">This jsp:useBean tag really is confusing. Why does it need to declare the class="foo.Person"? Why does the JSP need to know that "person" instance is derived from class foo.Person ? (I wonder if I changed this to foo.person --> not Person will result in error). Doesn't the statement request.setAttribute("person",p) from the servlet give enough info already to the JSP? thanks

    The "person" in your servlet has nothing to do with your "person" in your JSP bean tag.

  • Javascript array / jsp Bean Collection

    How can you fill a javascript array with the values of the collection?
    <jsp:useBean id="programs" scope="request" class="java.util.Collection"/>
      How can I create this array?
    <script language="JavaScript" type="text/javascript">
    var programData =
    new Array ( new Array "${programs[1].programId}","${programs[1].programName}", "${programs[1].department}"),  
                 new Array "${programs[2].programId}","${programs[2].programName}", "${programs[2].department}"),
    </script>

    I answered myself. If anyone else would like to know how to fill a javascript array with the values of a jsp beans collection.
    function collectionToArray()
    Array[rows] = [4];  
    var cnt = 0;
    <c:forEach var="sp" items="${programs}">
      rows[cnt][0] = ${sp.programId};
      rows[cnt][1] = ${sp.programName};
      rows[cnt][2] = ${sp.department};
      rows[cnt][3] = ${sp.urlLink1};
      rows[cnt][4] = ${sp.urlLink2};
      cnt++;
    </c:forEach>  
    }

  • JSP Bean problem

    Hi
    I'm having a problem with a very simple bean, I'm using NetBeans 4.1 and I have the following files:
    project/index.jsp
    project/myBeans/Characters.java
    in the index.jsp file I call the bean using the following code
    <jsp:useBean id="charac" class="myBeans.Characters" />but I am getting the following error
    org.apache.jasper.JasperException: /character.jsp(16,8) The value for the useBean class attribute myBeans.Characters is invalid.the code works perfectly if i call it in the jsp file as follows:
    <%@page import="myBeans.*"%>
    Characters charac = new Characters();so I assume the problem lies some where in the useBean call???
    any help appreciated

    Most common cause of this problem
    1 - class file is not up to date.
    2 - bean does not have a public no-args constructor.
    From the example you have it looks like you have a public no-args constructor.
    Check that the class file is in the correct place, and is up to date.
    Try restarting Tomcat/server to see if that helps.

  • Jsp beans problem

    hi all i have some trouble ...
    i`m making a register form in jsp and i want to put the data into bean and then retrieve the data in a servlet
    in the jsp i have:
    <jsp:useBean id="data" class="DataBean">
    <jsp:setProperty name="data" property="*"/>
    </jsp:useBean>
    <form method=post action="/SubmitServlet">
    <input type=text name="message">
    <input type=submit value="submit">
    </form>
    in the bean i have:
    private String message = null;
    public String getMessage() {
    return message;
    public void setMessage(String string) {
    message = string;
    and in the servlet:
    public void doPost(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    HttpSession session = req.getSession();
         DataBean adr = (DataBean)session.getAttribute("data");
         if (adr==null) {
              System.out.println("ada");
         else {
         System.out.println(adr.getMessage());
    .... and the server prints me the null string ... so the bean is not updated when i`m submiting the information from the jsp to the servlet ....
    how could i make it right?

    Oh, I see, when you said 'the Servlet prints the null string', you meant it gets to this line:
    System.out.println(adr.getMessage());
    and prints "null", right?
    Well, that is because you never set the message. The way your JSP works:
    1) Create a DataBean and store it in session (are there paramameters? no, so don't call any set methods)
    2) Display a Form.
    Then when the User presses the submit button, you have an action set to the Servlet /SubmitServlet, not back to the JSP. So, the Servlet has to handle the parameters passed from the form, not JSP. The JSP is done after it displays the page.
    public void doPost(...) ...
      HttpSession session = req.getSession();
      DataBean adr = (DataBean)session.getAttribute("data");
      if (adr==null) {
        adr = new DataBean();
        session.setAttribute("data", adr);
      String message = req.getParameter("message");
      adr.setMessage(message);
      System.out.println("The Message Is: "+message);
      //Maybe do a forward?? or some display??
    }If you want the JSP to handle the parameters sent by the form, then you will have to make the form's action set to the same address, not to the servlet (see my message in the first reply about how to make sure the setProperty gets called...)

  • Bean: define problem in tomcat.But it is working fine in Jdeveloper. Why?

    I am use a logic iterator tag for a dropdown list and bean :define for the show the values of the drop down list in jdeveloper. But in tomcat when i use this same code i got the following errors.
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 152 in the jsp file: /Trip_Consignor_Details_Insert.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    /data/jakarta-tomcat-5.0.19/work/Catalina/localhost/Lost/org/apache/jsp/Trip_005fConsignor_005fDetails_005fInsert_jsp.java:315: cannot find symbol
    symbol : method setValue(java.lang.Object)
    location: class org.apache.struts.taglib.html.OptionTag
    jspxth_html_option_0.setValue(param1);
    ^
    An error occurred at line: 172 in the jsp file: /Trip_Consignor_Details_Insert.jsp
    Generated servlet error:
    /data/jakarta-tomcat-5.0.19/work/Catalina/localhost/Lost/org/apache/jsp/Trip_005fConsignor_005fDetails_005fInsert_jsp.java:414: cannot find symbol
    symbol : method setValue(java.lang.Object)
    location: class org.apache.struts.taglib.html.OptionTag
    jspxth_html_option_1.setValue(param2);
    ^
    Note: /data/jakarta-tomcat-5.0.19/work/Catalina/localhost/Lost/org/apache/jsp/Trip_005fConsignor_005fDetails_005fInsert_jsp.java uses unchecked or unsafe operations.
    An error occurred at line: 172 in the jsp file: /Trip_Consignor_Details_Insert.jsp
    Generated servlet error:
    Note: Recompile with -Xlint:unchecked for details.
    2 errors
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    I think this may caused for the following line of code--
    <html:option value='<%=sUomCode%>'></html:option>
    May i have to add a jar file for this tag in my classpath and keep the jar file in tomcat's [ jakarta-tomcat-5.0.19 ]/ common/lib?.
    i am using ubuntu as os. Please suggest me.

    I set the classpath in enviornment file in /etc folder.
    and in eclipse i did-- right click on project -->properties-->java build path-->Libraries-->Add External jars. [and add the two jars].
    My code is ----
    <html:select property="sLocCode">
    <logic:iterate id="results" name="tripConsignor" property="result">
    <bean:define id="param1" name="results" property="sLocCode"/>
    <html:option value='<%=param1%>'></html:option>
    </logic:iterate>
    </html:select>
    problem in the line ----
    <html:option value='<%=param1%>'></html:option>
    Is their any alternative to set the html values. I tried <bean:write>. But failed.
    So i just want to set the value of <html:option value="-----------"></html:option>.
    please give me the solution or alternative way to set the value. Please Help

  • JSP TableView Sorting Problem

    I have been trying to get a tableview to be sortable by clicking on the header of columns.  I have been reviewing existing threads on the forum in particular the one below.
    https://forums.sdn.sap.com/thread.jspa?threadID=16417
    I seem to understand the concept but for some reason my table does not sort, it just does nothing.  Could someone take a look and see if you can find any problems - I can't wait to give points.
    Here is all my code.
    Here is the Java....
    package MSSPackage;
    import MSSBeanPackage.PositionOverviewBean;
    import MSSPackage.SortTableModel;
    import com.sapportals.htmlb.page.DynPage;
    import com.sapportals.htmlb.page.PageException;
    import com.sapportals.portal.htmlb.page.JSPDynPage;
    import com.sapportals.portal.htmlb.page.PageProcessorComponent;
    import com.sapportals.portal.prt.component.IPortalComponentContext;
    import com.sapportals.portal.prt.component.IPortalComponentProfile;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentSession;
    import com.sapportals.htmlb.event.*;
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.table.*;
    import com.sapportals.htmlb.table.DefaultTableViewModel;
    import javax.servlet.http.*;
    // SAP RFC Imports
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.JCO;
    import com.sapportals.portal.prt.service.jco.IJCOClientPoolEntry;
    import com.sapportals.portal.prt.service.jco.IJCOClientService;
    import com.sapportals.portal.prt.runtime.PortalRuntime;
    import java.util.*;
    public class PositionOverview extends PageProcessorComponent {
      public DynPage getPage(){
         return new PositionOverviewDynPage();
      public static class PositionOverviewDynPage extends JSPDynPage{
         JCO.Repository mRepository;
         public JCO.Table tblRelations;
         public JCO.Table tblPositions;     
         public SortTableModel tableModel;
         public int visibleRow = 1;     
         private boolean OrgUnitSelected = false;
         public void doInitialization(){
              IPortalComponentSession oSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
              PositionOverviewBean oBean = new PositionOverviewBean();
              // Table Start row
              oBean.setvisibleRow(new Integer(this.visibleRow).toString());          
              oSession.putValue("myBean", oBean);
              // Define request, context and profile containers         
              IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
              IPortalComponentContext myContext = request.getComponentContext();
              IPortalComponentProfile myProfile = myContext.getProfile();
              // Define bean reference to bean
              PositionOverviewBean myBean = new PositionOverviewBean();
              // Table Start row
              myBean.setvisibleRow(new Integer(this.visibleRow).toString());
              // Place bean in user profile.          
              myProfile.putValue("myBean", myBean);
         public void doProcessAfterInput() throws PageException {
         public void doProcessBeforeOutput() throws PageException {
              String NavType = "RCORGUNIT";
              String OType = "O";
              //String OBjid = "10004399";
              String OBjid = "";
              String sapSystem = "SAP_R3_HumanResources";          
              IPortalComponentSession oSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
              PositionOverviewBean myBean = (PositionOverviewBean) oSession.getValue("myBean");
              // Define request, context and profile containers         
              IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
    /*          IPortalComponentContext myContext = request.getComponentContext();
              IPortalComponentProfile myProfile = myContext.getProfile();
              //HttpSession session = request.getServletRequest().getSession();          //dmm
              //Get Bean from Profile
              PositionOverviewBean myBean = (PositionOverviewBean) myProfile.getValue("myBean");
              //PositionOverviewBean myDataBean = (PositionOverviewBean) session.getValue("POviewBean");               //dmm
              String ddlbSelection = "";
              String ddlbValue = "";
              DropdownListBox ddlbOrgUnits = (DropdownListBox) getComponentByName("ddlbOrgUnits");
              if (ddlbOrgUnits != null)
                   ddlbSelection = ddlbOrgUnits.getSelection();
                   ddlbValue = ddlbOrgUnits.getValueAsDataType().getValueAsString();
                   OBjid = ddlbValue;
                   myBean.setObjId(OBjid);
              else
                   OBjid = "";
                   myBean.setObjId(OBjid);                 
              IJCOClientService clientService;
              IJCOClientPoolEntry poolEntry;          
              JCO.Client client;          
              try
                   clientService = (IJCOClientService) PortalRuntime.getRuntimeResources().getService(IJCOClientService.KEY);
                   poolEntry = clientService.getJCOClientPoolEntry(sapSystem, request);
                   client = poolEntry.getJCOClient();
                // connect to SAP system, logon
                   client.connect();
                // Create Jco Repository Object
                   mRepository = new JCO.Repository("R3USERMENU", client);
                // Reset function object
                   JCO.Function function = null;
                // Run RFC Module on SAP system
                   function = this.createFunction("HRWPC_GET_NAV_OBJECTS");
                   JCO.ParameterList input = function.getImportParameterList();
                   input.setValue("RCORGUNIT", "NAVTYPE");               
                   client.execute(function);
                   tblRelations = function.getTableParameterList().getTable("RESULT_OBJEC");
                   myBean.setRowcnt(tblRelations.getNumRows());
                   if (tblRelations.getNumRows() != 0)               
                        myBean.setOrgUnits(tblRelations);
                        if (ddlbOrgUnits == null)
                             // check to see if there is not a position id already assigned
                             tblRelations.setRow(0);
                             OBjid = tblRelations.getString("OBJID");
                             myBean.setObjId(OBjid);
                             //myBean.sTemp = OBjid;                         
                   // GET THE POSITION DETAILS
                   function = null;
                   input = null;
                   function = this.createFunction("Z_GET_POSITION_OVERVIEW");
                   input = function.getImportParameterList();               
                   input.setValue(NavType, "NAVTYPE");               
                   input.setValue(OType, "OTYPE");
                   input.setValue(OBjid, "OBJID");               
                   client.execute(function);
                   tblPositions = function.getTableParameterList().getTable("RESULT_OBJEC");
                   myBean.setRowcnt(tblPositions.getNumRows());
                   tableViewFormat();
                   tableModel.setTesting("Startxxxx");
                   myBean.settableModel(tableModel);
                   //tableModel.setTesting("SSSS");               
                   //myDataBean.settableModel(tableModel);                                             //dmm               
                   //session.setAttribute("POviewBean", myDataBean);                                //dmm
                   oSession.putValue("myBean", myBean);
              //Release pool entry
              poolEntry.release();                           
           catch(Exception ex)
                //name = ex.getMessage();                         
           //String sTest = "this is a test";      
           //request.getComponentSession().putValue("Test", sTest);
           //myProfile.putValue("Testx", sTest);
           this.setJspName("PositionOverviewJSP.jsp");
         public void getPositions()
              String NavType;
              String Root_Ot;
              String Root_ObjId;
         public void tableViewFormat()
              // Define the vectors used to build tableView
              Vector tempRec = new Vector();
              Vector dataRec = new Vector();
              String sDate = "";
              String sPosLink = "";
              String sPosVal = "";
              String sENameLink = "";
              String sENameVal = "";
              String sStatus = "";
              // Loop at company code list and add to vectors
              for (int i = 0; i < tblPositions.getNumRows(); i++)
                   tblPositions.setRow(i);
                   tempRec = new Vector();
                   sStatus = (String) tblPositions.getString("STATUS");
                   if (sStatus != null)
                        if (sStatus.equals("0"))                    
                             sDate = tblPositions.getString("ZHR_VACANT_BEGDA");
                             sDate = sDate.substring(5, 7) + "/" + sDate.substring(8, 10) + "/" +  sDate.substring(0, 4);                         
                        else
                             sDate = "";                    
                   sPosVal = tblPositions.getString("STEXT");
                   sENameVal = tblPositions.getString("ENAME");
                   if (sPosVal.equals(""))
                        sPosLink = sPosVal;
                   else
                        sPosLink = "<a HREF="myLink" onclick="return EPCM.doNavigate('ROLES://portal_content/com.sap.portal.migrated/ep_5.0/pages/com.sap.pct.hcm.positionprofile?CKey=000000" + tblPositions.getString("OBJID") + "', 1)">" + tblPositions.getString("STEXT") + "</a>";
                   if (sENameVal.equals(""))
                        sENameLink = sENameVal;
                   else
                        sENameLink = "<a HREF="myLink" onclick="return EPCM.doNavigate('ROLES://portal_content/com.phi/com.phi.mgt/com.phi.mss/com.phi.hr/com.phi.pages/com.phi.mgt.mss.hr.pages.positionholder?CKey=000000" + tblPositions.getString("OBJID") + "', 1)">" + tblPositions.getString("ENAME") + "</a>";
                   tempRec.addElement(sStatus);
                   tempRec.addElement(tblPositions.getString("OBJID"));
                   tempRec.addElement(sPosLink);
                   tempRec.addElement(sENameLink);
                   tempRec.addElement(sDate);               
                   dataRec.addElement(tempRec);
              // Then define the technical column names
              Vector colNames = new Vector();
              colNames.addElement("STATUS");
              colNames.addElement("OBJID");
              colNames.addElement("STEXT");     
              colNames.addElement("ENAME");
              colNames.addElement("ZHR_VACANT_BEGDA");
              // Now we build the actual tableView
              //tableModel = new DefaultTableViewModel(dataRec, colNames);
              tableModel = new SortTableModel(dataRec, colNames, 5);     
              // Define tableView parameters
              tableModel.setKeyColumn(2);
              TableColumn column = tableModel.getColumn("STATUS");
              column.setEncode(false);
              column.setType(com.sapportals.htmlb.enum.TableColumnType.USER);
              column.setTitle("Vacant");
              column = tableModel.getColumn("OBJID");
              column.setTitle("Position Number");
              column = tableModel.getColumn("STEXT");
              column.setTitle("Position");
              column = tableModel.getColumn("ENAME");
              column.setTitle("Holder of Position");          
              column = tableModel.getColumn("ZHR_VACANT_BEGDA");
              column.setTitle("Vacant as of");
         //     * Navigation Button Clicked
         public void myOnNavigate(Event event)
              TableNavigationEvent tne = (TableNavigationEvent) event;
              visibleRow = tne.getFirstVisibleRowAfter();
              // Define request, context and profile containers         
              IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
              IPortalComponentContext myContext = request.getComponentContext();
              IPortalComponentProfile myProfile = myContext.getProfile();
              // Get Bean from profile
              PositionOverviewBean myBean = (PositionOverviewBean) myProfile.getValue("myBean");
              // Table Start row
              myBean.setvisibleRow(new Integer(this.visibleRow).toString());
         public void onHeaderClick(Event event)
              IPortalComponentSession oSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
              PositionOverviewBean myBean = (PositionOverviewBean) oSession.getValue("myBean");
              TableHeaderClickEvent tne = (TableHeaderClickEvent) event; // get the event
              SortTableModel tblModel = myBean.gettableModel();
              //tblModel.sort();
              int col = 3;
              tblModel.sortByColumn(col);
              myBean.settableModel(tblModel);
              oSession.putValue("myBean", myBean);
         // Create Function object for RFC Calls
         public JCO.Function createFunction(String name) throws Exception
              try
                   IFunctionTemplate ft = mRepository.getFunctionTemplate(name.toUpperCase());
                   if (ft == null)
                        return null;
                   return ft.getFunction();
              catch (Exception ex)
                   ex.printStackTrace();
                   throw new Exception("Problem retrieving JCO.Function object");
         public void onSelectddlbOrgUnits(Event event) throws PageException
              OrgUnitSelected = true;          
    Here is the JSP
    <%@ page import="com.sap.mw.jco.*" %>
    <%@ page import="com.sapportals.htmlb.enum.*" %>
    <%@ page import="MSSPackage.TableViewCellRenderer" %>
    <%@ page import="com.sapportals.portal.prt.component.IPortalComponentRequest" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page import="com.sapportals.portal.prt.component.IPortalComponentContext" %>
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <hbj:content id="myContext" >
         <hbj:page title="PageTitle">
              <hbj:form id="myFormId" >  
              <jsp:useBean id="myBean" scope="session" class="MSSBeanPackage.PositionOverviewBean" />     
                   <hbj:gridLayout rowSize="1" columnSize="1" cellSpacing="1">
                        <hbj:gridLayoutCell columnIndex="1" rowIndex="1">
                             <hbj:textView id="ddlbLable" text="Select organizational unit to display positions" design="STANDARD" />
                        </hbj:gridLayoutCell>                         
                        <hbj:gridLayoutCell columnIndex="1" rowIndex="2">
                             <hbj:dropdownListBox id="ddlbOrgUnits" onSelect="onSelectddlbOrgUnits" selection="<%=myBean.getObjId()%>">                                                       
                                  <%                         
                                       JCO.Table org_units = null;                                                       
                                       org_units = myBean.getOrgUnits();
                                       for (int i = 0; i < org_units.getNumRows(); i++)
                                            org_units.setRow(i);
                                            String sUnit = org_units.getString("STEXT");
                                            String Unit_Id = org_units.getString("OBJID");
                                  %>
                                  <hbj:listBoxItem key="<%=Unit_Id%>" value="<%=sUnit%>" />
                                  <%
                                  %>
                             </hbj:dropdownListBox>                                                                                                   
                        </hbj:gridLayoutCell>
                        <hbj:gridLayoutCell columnIndex="1" rowIndex="3">
                             <hbj:textView id="listLable" text="To designate a vacant position, click the icon in the 'Create Form' column" design="STANDARD" />                    
                        </hbj:gridLayoutCell>                    
                        <hbj:gridLayoutCell columnIndex="1" rowIndex="4">     
                             <hbj:tableView
                                  id="myTableView"
                                  headerVisible="true"
                                  footerVisible="true"
                                  fillUpEmptyRows="true"
                                  selectionMode="NONE"                              
                                  navigationMode="BYPAGE"
                                  onNavigate="myOnNavigate"                                        
                                  visibleFirstRow="<%= myBean.getvisibleRow() %>"                                                  
                                  visibleRowCount="5" >                                                            
                                  <%
                                  myTableView.setOnHeaderClick("onHeaderClick");
                                  myTableView.setUserTypeCellRenderer(new TableViewCellRenderer());                                                             
                                  myTableView.setModel(myBean.gettableModel());
                                  myTableView.setColumnType(TableColumnType.LINK, 3);
                                  myTableView.setColumnType(TableColumnType.LINK, 4);                              
                                  %>
                             </hbj:tableView>
                        </hbj:gridLayoutCell>                                        
                   </hbj:gridLayout>   
              </hbj:form>
         </hbj:page>
    </hbj:content>
    Here is the BEAN
    package MSSBeanPackage;
    //import com.sapportals.htmlb.enum.TableColumnType;
    import MSSPackage.SortTableModel;
    import com.sapportals.htmlb.table.DefaultTableViewModel;
    //import com.sapportals.htmlb.table.TableColumn;
    //import com.sapportals.htmlb.table.TableView;
    //import com.sapportals.htmlb.table.TableViewModel;
    import com.sap.mw.jco.JCO;
    import com.sap.mw.jco.JCO.Table;
    public class PositionOverviewBean {
    //     public DefaultTableViewModel tableModel;
         public SortTableModel tableModel;
         public JCO.Table OrgUnits;
         public String ObjId;
         public String visibleRow;
         public int rowcnt;
         public String sTemp;
         // Get and Set methods for table model
    //     public DefaultTableViewModel gettableModel() { return tableModel; }
    //     public void settableModel(DefaultTableViewModel tableModel)     { this.tableModel = tableModel;     }
         public SortTableModel gettableModel() { return tableModel; }
         public void settableModel(SortTableModel IntableModel)     { this.tableModel = IntableModel;     }     
         public JCO.Table getOrgUnits()     { return OrgUnits; }
         public void setOrgUnits(JCO.Table value) { this.OrgUnits = value; }
         // Get and Set methods for visiblerow
         public String getvisibleRow() {     return visibleRow; }
         public void setvisibleRow(String visibleRow) { this.visibleRow = visibleRow; }     
         public int getRowcnt() { return this.rowcnt; }
         public void setRowcnt(int rowcnt) { this.rowcnt = rowcnt; }
         public String getObjId() { return this.ObjId; }
         public void setObjId(String value) { this.ObjId = value; }     
    Here is the sorting class
    package MSSPackage;
    import java.util.Collections;
    import java.util.Comparator;
    import java.util.Vector;
    import com.sapportals.htmlb.table.DefaultTableViewModel;
    public class SortTableModel extends DefaultTableViewModel implements Comparator {
         //protected int currCol;
         public int currCol;
         protected Vector ascendCol; // this vector stores the state (ascending or descending) of each column
         protected Integer one = new Integer(1);
         protected Integer minusOne = new Integer(-1);
         public String testing;
         public SortTableModel()
              super();
              ascendCol = new Vector();
         public SortTableModel(Vector vec)
              super(vec);
              ascendCol = new Vector();
         public SortTableModel(Vector vec, Vector vec2, int numberOfColumns)
              super(vec, vec2);
              ascendCol = new Vector();
              setSortOrder(numberOfColumns);
         public int compare (Object v1, Object v2)
              // the comparison is between 2 vectors, each representing a row
              // the comparison is done between 2 objects from the different rows that are in the column that is being sorted
              int ascending = ((Integer)ascendCol.get(currCol)).intValue();
              if (v1 == null && v2 == null)
                   return 0;
              else if (v2 == null)
              { // Define null less than everything.
                   return 1 * ascending;
              else if (v1 == null)
                   return -1 * ascending;
              Object o1 = ((Vector)v1).get(currCol);
              Object o2 = ((Vector)v2).get(currCol);
              // If both values are null, return 0.
              if (o1 == null && o2 == null)
                   return 0;
              else if (o2 == null)
              { // Define null less than everything.
                   return 1 * ascending;
              else if (o1 == null)
                   return -1 * ascending;
              if (o1 instanceof Number && o2 instanceof Number)
                   Number n1 = (Number)o1;
                   double d1 = n1.doubleValue();
                   Number n2 = (Number)o2;
                   double d2 = n2.doubleValue();
                   if (d1 == d2)
                        return 0;
                   else if (d1 > d2)
                        return 1 * ascending;
                   else {
                        return -1 * ascending;
              else if (o1 instanceof Boolean && o2 instanceof Boolean)
                   Boolean bool1 = (Boolean)o1;
                   boolean b1 = bool1.booleanValue();
                   Boolean bool2 = (Boolean)o2;
                   boolean b2 = bool2.booleanValue();
                   if (b1 == b2)
                        return 0;
                   else if (b1)
                        return 1 * ascending;
                   else
                        return -1 * ascending;
              else
                   // default case
                   if (o1 instanceof Comparable && o2 instanceof Comparable)
                        Comparable c1 = (Comparable)o1;
                        Comparable c2 = (Comparable)o2; // superflous cast, no need for it!
                        try
                             return c1.compareTo(c2) * ascending;
                        catch (ClassCastException cce)
                        // forget it... we'll deal with them like 2 normal objects below.
                   String s1 = o1.toString();
                   String s2 = o2.toString();
                   return s1.compareTo(s2) * ascending;
         * This method sorts the rows using Java's Collections class.
         * After sorting, it changes the state of the column -
         * if the column was ascending, its new state is descending, and vice versa.
         public void sort()
              Collections.sort(dataVector, this);          
              //Collections.sort(dataVector);
              Integer val = (Integer)ascendCol.get(currCol);
              ascendCol.remove(currCol);
              if (val.equals(one)) // change the state of the column
                   ascendCol.add(currCol, minusOne);
              else
                   ascendCol.add(currCol, one);
         public void sortByColumn(int column)
              this.currCol = column;
              sort();
         public void setSortOrder(int numberOfColumns)
              for (int i = 0; i < numberOfColumns; i++)
                   ascendCol.add(one);
         public void setTesting(String inStr)
              testing = inStr;
    Any help would be greatly apprciated and rewarded...

    Hi Don,
    be aware that after the method onHeaderClick(Event event) is executed the method doProcessBeforeOutput() is executed as well.
    I look over your code and found the following:
    1) In method onHeaderClick you sort the table model and store the table model in the bean
    2) In method doProcessBeforeOutput() you create a new table model from scratch (in helper method tableViewFormat())and store it in the bean. Thus you overwrite the sorted model.
    I suggest that you move the initial creation of the table model in method doInitialization(). Do not forget to store the created table in the bean. In method doProcessBeforeOutput() you retrieve the table model from the bean instead of creating a new one for every request.
    Best regards,
    Martin

  • PickList.setValue() problems

    I tried to use a PickList as HTMLFieldRenderer for EditCurrentRecord bean in "Edit a Row" JSP page. I want this PickList to display a list of options provided by some view (it works fine) and to preselect one particular option. According to API setValue() is a method to use, but if I use it the PickList preselects its first option and not the option which was requested.
    Suggestions how to address this problem will be appreciated. Here is a code sample.
    <jsp:useBean id="RowEditor" class="oracle.jbo.html.databeans.EditCurrentRecord" scope="request">
    <%
    RowEditor.setUseJS(true);
    RowEditor.initialize(pageContext, "Bc1Module.RView");
    Bc1ModuleImpl mod = (Bc1ModuleImpl)RowEditor.getRowSet().getApplicationModule();
    PickList pick = new PickList();
    pick.setDataSourceInfo(mod.getAllUsersView(), "Username", "Username");
    pick.setValue("JONES");
    RowEditor.setFieldRenderer("User", pick);
    RowEditor.render();
    %>
    null

    Try to do the setValue after the setFieldRenderer like:
    RowEditor.setFieldRenderer("User", pick);
    pick.setValue("JONES");
    I think the value is initialized in the setFieldRenderer
    null

  • 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

  • Can you move mail from one account to another?

    I Use Bellsouth as my ISP. As other Posters have noted they are one of the ISPs that won't accept outgoing mail when you are on the Edge Network (even more frustrating since they are owned by AT&T!). When I go out, I have to change my outgoing mail s

  • Forgot to click eject ?!?!?! Lost all songs!

    im going crazy! i forgot to click ejectr and now all my songs are gone off my ipod!!! is there anyway to get them back? i have alot of music in my itunes library and only like half were on my ipod so i cant autofill because i will have unneccesary so

  • E-Mailing small photos from iPhoto '09

    E-Mailing small photos from iPhoto ‘09 Hi: We used to have a great way of e-mailing photos from iPhoto: specifically, we just clicked the Entourage e-mail icon at the bottom of the iPhoto window, chose the size of the photos we wished to send (ie, on

  • Travel cost and others in PS

    Hi Experts How can we plan and track travel cost, TA , DA for a person against some project? Suppose this person is at the customer site for some commissioning purpose. Should we do it in CATS or some other way? Pls. help me.

  • From QT to IDvd

    I created a movie in Final Cut Express, and have exported to a QT file to use in IDvd. I figured out how to get the best quality in QT (thanks to the forum!), but am still getting really pixelated quality when I go from QT to IDvd. Any suggestions??