Problem with Session Beans in JSP

Hi,
          I'm testing Weblogic for our company's IT department and just ran into a
          strange error. I wrote a simple JSP script to use a bean that works fine
          except when trying to set the bean scope to session. I looked at the the log
          file and the only exception recorded was a ClassCastException. Could anyone
          please clarify this to me? Is this a current bug in Weblogic?
          Thank you for your attention,
          Paul Visan
          

          classcastexception are generally due to bad classpaths...
          can you provide more information like what is the code trying to do..stack trace etc..
          "Paul Visan" <[email protected]> wrote:
          >Hi,
          >
          >I'm testing Weblogic for our company's IT department and just ran into a
          >strange error. I wrote a simple JSP script to use a bean that works fine
          >except when trying to set the bean scope to session. I looked at the the log
          >file and the only exception recorded was a ClassCastException. Could anyone
          >please clarify this to me? Is this a current bug in Weblogic?
          >
          >Thank you for your attention,
          >Paul Visan
          >
          >
          

Similar Messages

  • Problem with java beans and jsp on web logic 6.0 sp1

              HI ,
              I am using weblogic6.0 sp1.
              i have problem with jsp and java beans.
              i am using very simple java bean which stores name and email
              from a html form.
              but i am getting following errors:
              Full compiler error(s):
              D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:89:
              cannot resolve symbol
              symbol : class userbn
              location: class jsp_servlet._savename2
              userbn ud = (userbn) //[ /SaveName2.jsp; Line: 7]
              ^
              D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:89:
              cannot resolve symbol
              symbol : class userbn
              location: class jsp_servlet._savename2
              userbn ud = (userbn) //[ /SaveName2.jsp; Line: 7]
              ^
              D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:94:
              cannot resolve symbol
              symbol : class userbn
              location: class jsp_servlet._savename2
              ud = (userbn) java.beans.Beans.instantiate(getClass().getClassLoader(),
              "userbn"); //[ /SaveName2.jsp; Line: 7]
              ^
              3 errors
              in which directory should i place java bean source file(.java file)
              here is my jsp file:
              <%@ page language = "java" contentType = "text/html" %>
              <html>
              <head>
              <title>bean2</title>
              </head>
              <body>
              <jsp:usebean id = "ud" class = "userbn" >
              <jsp:setProperty name = "ud" property = "*" />
              </jsp:usebean>
              <ul>
              <li> name: <jsp:getProperty name = "ud" property = "name" />
              <li> email : <jsp:getProperty name = "ud" property = "email" />
              </ul>
              </body>
              <html>
              here is my bean :
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              import java.io.*;
              public class userbn implements Serializable
                   private String name ;
                   private String email;
                   public void setName(String n)
                        name = n;
                   public void setEmail(String e)
                        email = e;
                   public String getName()
                        return name;
                   public String getEmail()
                        return email;
                   public userbn(){}
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              pls help me.
              Thanks
              sravana.
              

              You realy can do it like Xiang says, but the better way is to use packages. That's
              the way BEA is designed for. If you use packages you can but your bean classes
              in every subfolder beneath Classes. Here for example we have the subfolders test
              and beans:
              You have to declare the package on top of your Bean Source Code:
              package test.beans;
              In your JSP you don't need the import code of Xiang. You only have to refer the
              path of your bean class:
              <jsp:useBean id="testBean" scope="session" class="test.beans.TestBean" />
              There are some other AppServers that only can deploy Java Beans in packages. So
              if you use packages you are always on the right side.
              ciao bernd
              "sravana" <[email protected]> wrote:
              >
              >Thank you very much Xiang Rao, It worked fine.
              >Thanks again
              >sravana.
              >
              >"Xiang Rao" <[email protected]> wrote:
              >>
              >><%@ page import="userbn" language = "java" contentType = "text/html"
              >>%> should
              >>work for you.
              >>
              >>
              >>"sravana" <[email protected]> wrote:
              >>>
              >>>HI ,
              >>>
              >>>I am using weblogic6.0 sp1.
              >>>
              >>>i have problem with jsp and java beans.
              >>>
              >>>i am using very simple java bean which stores name and email
              >>>
              >>>from a html form.
              >>>
              >>>but i am getting following errors:
              >>>
              >>>________________________________________________________________
              >>>
              >>>Full compiler error(s):
              >>>D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:89:
              >>>cannot resolve symbol
              >>>symbol : class userbn
              >>>location: class jsp_servlet._savename2
              >>> userbn ud = (userbn) //[ /SaveName2.jsp; Line: 7]
              >>> ^
              >>>D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:89:
              >>>cannot resolve symbol
              >>>symbol : class userbn
              >>>location: class jsp_servlet._savename2
              >>> userbn ud = (userbn) //[ /SaveName2.jsp; Line: 7]
              >>> ^
              >>>D:\bea4\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\_tmp_war_myserver_myserver_DefaultWebApp_myserver\jsp_servlet\_savename2.java:94:
              >>>cannot resolve symbol
              >>>symbol : class userbn
              >>>location: class jsp_servlet._savename2
              >>> ud = (userbn) java.beans.Beans.instantiate(getClass().getClassLoader(),
              >>>"userbn"); //[ /SaveName2.jsp; Line: 7]
              >>> ^
              >>>3 errors
              >>>
              >>>____________________________________________________________
              >>>
              >>>in which directory should i place java bean source file(.java file)
              >>>
              >>>here is my jsp file:
              >>>--------------------------------------------------------
              >>>
              >>><%@ page language = "java" contentType = "text/html" %>
              >>><html>
              >>><head>
              >>><title>bean2</title>
              >>></head>
              >>><body>
              >>><jsp:usebean id = "ud" class = "userbn" >
              >>><jsp:setProperty name = "ud" property = "*" />
              >>></jsp:usebean>
              >>><ul>
              >>><li> name: <jsp:getProperty name = "ud" property = "name" />
              >>><li> email : <jsp:getProperty name = "ud" property = "email" />
              >>></ul>
              >>></body>
              >>><html>
              >>>
              >>>-------------------------------------------------------------
              >>>
              >>>here is my bean :
              >>>
              >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              >>>
              >>>import java.io.*;
              >>>
              >>>public class userbn implements Serializable
              >>>{
              >>>
              >>>     private String name ;
              >>>
              >>>     private String email;
              >>>
              >>>     public void setName(String n)
              >>>     {
              >>>
              >>>          name = n;
              >>>     }
              >>>
              >>>     public void setEmail(String e)
              >>>     {
              >>>
              >>>          email = e;
              >>>     }
              >>>
              >>>     public String getName()
              >>>     {
              >>>
              >>>          return name;
              >>>     }
              >>>
              >>>     public String getEmail()
              >>>     {
              >>>
              >>>          return email;
              >>>     }
              >>>
              >>>     public userbn(){}
              >>>}
              >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              >>>
              >>>pls help me.
              >>>Thanks
              >>>sravana.
              >>>
              >>
              >
              

  • Problem with Sessions in JSP

    Hi,
    I am working on a JSP based website, where I am facing problem with sessions. The user is asked to login by providing her id and password. If found correct, a bean is created and populated with all her details and placed in session scope. I plan to use the information stored in the bean on other related pages until she logs out.
    <jsp:useBean id="validUser" scope="session" class="UserBean" >
    <c:set target="${validUser}" property="userId" value="${fn:trim(dbValues.UserId)}" />
    <c:set target="${validUser}" property="userName" value="${fn:trim(dbValues.UserName)}" />
    </jsp:useBean>
    <c:redirect url="userHome.jsp" /> The user is presented her homepage - 'userHome.jsp', where she can find various links, like 'Update Profile', 'Pay Registration Fees', 'Book Room' etc. The information stored in the bean is available on 'userHome.jsp'page.
    <A HREF='userHome.jsp'>Home</A>
    <A HREF='editPersonal.jsp'>Update Profile</A>
    <A HREF='registrationFee.jsp'>Pay Registration Fees</A>
    <A HREF='bookRoom.jsp'>Book Room</A>
    <A HREF='logout.jsp'>Logout</A> The problems are:
    1. Whenever user clicks on any of the above mentioned links and moves to any page, the bean comes out as null.
    <%-- Verify that the user is logged in --%>
    <c:if test="${validUser == null}">
    <jsp:forward page="loginForm.jsp">
    <jsp:param name="origURL" value="${pageContext.request.requestURL}" />
    <jsp:param name="errorMsg" value="You must be logged in to access this site." />
    </jsp:forward>
    </c:if> 2. The URL shows an additional jsessionid, which my client doesn't want to see.
    3. On every click on any link, the value of this jsessionid changes.
    What I presume, when I am clicking on different links, my session changes, and so I am seeing a different jsessionid. And since session is changing, therefore the bean is not available in a different session.
    All this works fine with localhost, problem comes into picture, when I upload my pages to the server.
    Puzzled, can anyone help, where am I going wrong? Let me add here, I am new to JSP and hence don't have much resources with me.

    There are several ways sessions can be exchanged between the browser and the server in a j2ee web application.
    1. The default is through cookies. However when the client does not accept cookies, the server appends the session id to the url.
    2. Some servers also facilitate session information exchange using session id in the url even if the client does accept cookies. This is usually ahieved through a setting in some server configuration file.
    You will have to find out why the server in your application is appending the session id to the url.
    Whatever be the case, the server should be able to look up the session from the incoming request (be it from the session id in the url or a session cookie).
    When session information is exchanged through the JSESSIONID in the url, you should ensure that each and every url that goes to the server has this input parameter. To do that all links and form post urls in your servlet/jsp should be treated with a call to encodeURL().
    For example, in a jsp
       <a href = "<%=response.encodeURL("/nextJsp.jsp")%>">Click here </a>
    or
       <form action = "<%=response.encodeURL("/nextJsp.jsp")%>">
       </form>etc.
    ram.

  • Problems with managed beans on included JSPs

    I've got a problem with managed beans within an included JSP
    The included page looks as follows:
    <f:subview id="includedPage" binding="#{testBean.component}">
         <h:outputText value="Hallo from the included page"/>
         <h:outputText value="#{testBean.msg}" />
    </f:subview>The including page is also very simple
    <f:view>
         <html>
              <head>
                   <title>Test include</title>
              </head>
              <body>
                   <h:outputText value="Hello from the including page"/>               
                   <jsp:include page="included.jsp"/>
              </body>
         </html>
    </f:view>The testBean is a managed bean with page scope and looks as follows:
    public class TestBean {
        public UIComponent fComponent;
        public TestBean() {
            System.out.println("TestBean Constructor called " + toString() );
        public String getMsg() {
            return "Component = " + fComponent ;
        public void setComponent(UIComponent component) {
            System.out.println("setComponent called " + component);       
            fComponent = component;
        public UIComponent getComponent() {
            System.out.println("getComponent called " + fComponent);
            return fComponent;
    }The output to the console is:
    TestBean Constructor called de.kvb.athena.web.beans.TestBean@1bc16f0
    getComponent called null
    TestBean Constructor called de.kvb.athena.web.beans.TestBean@18622f3
    setComponent called javax.faces.component.UINamingContainer@160877b
    TestBean Constructor called de.kvb.athena.web.beans.TestBean@5eb489
    and the page displays
    Hello from the include page
    Hello from the included page Component = null
    Can anyone explain this behavior ? What's the reason that the page displays
    Component = null
    and is it possible to display the parent naming container (subview) this way ?
    how ?
    Thanks

    By "page scope" I assume you mean "none"? If so JSF creates a new bean for each place it's referenced. The closest to the behavior you want, once per "page", is really request scope.
    (I'm not sure why the constructor is being called thrice, though. I should look into this.)
    I assume you want a bean-per-subview scenario. This should be doable, and one way that allows a dynamic number of subviews would be as follows:
    --create a "manager" bean in request scope
    --give it get/set methods that retrieves a Map of "TestBean" instances; the idea is that each subview use a different key "s1", "s2", etc
    back the manager method with Map implementation that checks if there's already a TestBean associated with the key returns it if yes, else null.
    If that seems messy, the component solution is hairy :-) See http://forum.java.sun.com/thread.jspa?threadID=568937&messageID=2812561
    --A                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can this be done only with Session Beans ?

    Hi all,
    suppose I have an airline web selling ticket application.
    This is the web flow:
    -The user chooses destinations & date
    -The user chooses seats
    -The user confirms to buy
    If it's NOT required to persist itineraries until the user confirms to buy,
    can this be done ONLY with Session Beans ?
    I think that there aren't cuncurrency problems because even if two persons will book the same flight, they'll get different sequence Id (if the sequence is generated by the DataBase).
    I think the worst scenario is if two person book the last seat at the same time, one will get an error.......
    What do you say to it ?
    Thanks
    Francesco

    If it's NOT required to persist itineraries until the
    user confirms to buy,
    can this be done ONLY with Session Beans ?Yes. Even if persistence is required, you can use only session beans with some persistence mechanism.

  • Problem with sessions in Kate Editor

    Hey guys!
    I'm using Kate Editor to code and i'm having problems with sessions. If kate is open and I logout KDE, when I come back to KDE all my customizations in Kate's session (activated plugins, font size, etc) are lost.
    If I manually close Kate before logout from KDE, all the customizations are kept when a manually start Kate. I tried a lot of workarounds, but none worked.
    Is this a bug? Someone else with this issue?
    Thanks in advance!

    The Warning errors are simply because you don't have the tablespaces, users, and roles defined in your application system under the DB Admin tab. Unless it is important to you to capture the physical implementation of your tables exactly as well as the table definitions, you can safely ignore these. If the physical implementation IS important to you, then you need to create these tablespaces, roles and users under the database that you created under the DB Admin tab before you start the capture.
    The Error is because in the set of objects you are capturing there is a foreign key that references the table named "PLEASANT". This table must be among the objects that you are capturing, or must already be in a Table Definition in your application system in the repository.

  • Calling Session Beans in JSP ?

    Hi Folks,
    I am new to EJB3, I am doing simple applicatuions.
    Can any one please tell me how to call session beans in jsp page.
    for example my case is.. iam entering two diffrent data, lets say user name and password in jsp page and this should go in data base thru JPA (entity beans)
    Iam able to enter data from JPA in data base but if the same i have to fetch from JSP page.. iam not getting..!
    I would really appretiate for your help i need it urgent...!
    thanks in advance.

    abishek1983 wrote:
    Hi Folks,
    I am new to EJB3, I am doing simple applicatuions.
    Can any one please tell me how to call session beans in jsp page.
    Not. You can, technically, but you shouldn't. JSP should be for display purposes only, containing no Java code whatsoever.
    for example my case is.. iam entering two diffrent data,Wrong. You cannot possibly have "2 data", the very concept is impossible.
    You can have "2 data items" which is probably what you intended to say?
    lets say user name and password in jsp page and this should go in data base thru JPA (entity beans)
    Iam able to enter data from JPA in data base but if the same i have to fetch from JSP page.. iam not getting..!
    Same way you insert them. Of course JPA entities are distinctly different from entity beans. The very concept of entity beans no longer exists in the context of JPA, it's solely used to mean EJB 2.1 or earlier entity beans.
    I would really appretiate for your help i need it urgent...!
    It's not urgent.

  • I have a problem with session manager session files because of the invalid json storage data submited by firefox

    Hi, i have problem with session manager's session files. The problem is: the submitted storage data from firefox which is put between "storage":{ and its matching closing brace } But in some of my session files there is non equal { and } under storage's braces. I need to get storage data but in my case it is very hard to do. My question is there any char put before or after { and } like /{ or \{ to avoid confusion? If there is not such thing, i think there could be different solution but i am not sure: i look couple of my session files; after "storage":{...} there is ,_"formDataSaved" so i can get storage data in this example ... by looking between "storage":{ and ,"_formDataSaved" easily. Is there every time ,"_formDataSaved" after "storage":{ ?  Thank you.

    Well, it seems waiting is not my strong suit..! I renamed a javascript file called recovery to sessionstore. This file was in the folder sessionstore-backups I had copied from mozilla 3 days ago, when my tabs were still in place. I replaced the sessionstore in mozilla's default folder with the renamed file and then started mozilla. And the tabs reappeared as they were 3 days ago!
    So there goes the tab problem. But again when I started mozilla the window saying "a script has stopped responding" appeared, this time the script being: chrome//browser/contenttabbrowser.xml2542
    If someone knows how to fix this and make firefox launch normally, please reply! Thank you

  • Looking up a EJB 3.0 Session Bean in JSP Scriptlet

    Hello There,
    Somebody please enlighten me. I have a bean named
    a.b.MyBeanextending local interface
    a.b.MyLocalNow I want to use this bean in a JSP (Maybe just for fun, but the point is I am not using resource injection).
    So the question is, What is the default JNDI name of the session bean with only a local interface, which I can use to look-it-up in jsp scriptlet code.
    Cheers. Am trying for last hour, nothings turned up
    Bye

    It's the classname under the initial context or a.b.MyLocal in your case.
         <% MyLocal intf = null;
              try {
                   InitialContext context = new InitialContext();
                   intf = (MyLocal) context.lookup(MyLocal.class.getName());
              } catch (Exception ex) {
                   System.err.println("Error looking up MyLocal: " + ex.getMessage());
              } %>

  • Toplink Optimistic Locking not working with Session Bean facade.

    I am working on Oracle JDeveloper v 10.1.2 and connecting to an Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit
    The application is based on J2EE architecture and the technology stack uses Struts for presentation/controller framework, Stateless Session EJBs as session facade for custom business services, Simple java classes for the business services, Toplink implementation of DAO layer, Domain objects are mapped to database tables using Toplink Workbench that ships with JDeveloper. The transaction is managed by the session bean and hence the toplink session is configured to use external transaction controller and a named datasource as follows.
    <session xsi:type="server-session">
    <name>DBSession</name>
    <server-platform xsi:type="oc4j-1012-platform"/>
    <event-listener-classes/>
    <logging xsi:type="toplink-log">
    <log-level>fine</log-level>
    <file-name>D:/ToplinkLog.log</file-name>
    </logging>
    <primary-project xsi:type="xml">META-INF/toplink-descriptor.xml</primary-project>
    <login xsi:type="database-login">
    <platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class>
    <external-connection-pooling>true</external-connection-pooling>
    <external-transaction-controller>true</external-transaction-controller>
    <sequencing>
    <default-sequence xsi:type="native-sequence">
    <name>Native</name>
    <preallocation-size>1</preallocation-size>
    </default-sequence>
    </sequencing>
    <datasource>jdbc/ORADS</datasource>
    </login>
    </session>
    We intend to use Optimistic Locking based on Timestamp-version locking through an audit field "last_modification_date" of type java.sql.Timestamp. The corresponding database field is also of type Timestamp(6). We are not storing the version in cache.
    The problem we are facing is as follows.. we have an edit screen from where user can edit values for a domain object which are then persisted using Toplink...we expect Toplink to check the database record version (modification_date timestamp) before it applies the update. In DAO implementation, we register the object in a unitOfWork, then set the modified values, however we leave the modification_date (version field) unedited. Now when the application is running, on edit, an exception is thrown by the Session bean before ending the transaction.
    com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: Error in transaction: java.lang.NullPointerException
         at TrackingMediator_StatelessSessionBeanWrapper2.editOverheadExpenditure(TrackingMediator_StatelessSessionBeanWrapper2.java:1597)
         at com.enbridge.dsm.web.action.TrackingPortfolioAction.editOverheadExpenditure(TrackingPortfolioAction.java:264)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java)
         at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:278)
         at com.enbridge.dsm.web.shared.BaseAction.execute(BaseAction.java:90)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
         at com.enbridge.dsm.web.shared.DSMPojoRequestProcessor.process(DSMPojoRequestProcessor.java:182)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1425)
         at com.sourcebeat.strutslive.common.SLActionServlet.process(SLActionServlet.java:44)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.enbridge.dsm.web.shared.security.SecurityFilter.doFilter(SecurityFilter.java:142)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:645)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
         Nested exception is:
    java.lang.NullPointerException
         at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:1190)
         at com.evermind.sql.FilterConnection.commit(FilterConnection.java:209)
         at com.evermind.sql.DriverManagerXAConnection.commit(DriverManagerXAConnection.java:203)
         at com.evermind.server.TransactionEnlistment.commit(TransactionEnlistment.java:251)
         at com.evermind.server.ApplicationServerTransaction.singlePhaseCommit(ApplicationServerTransaction.java:745)
         at com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:690)
         at com.evermind.server.ApplicationServerTransaction.end(ApplicationServerTransaction.java:1035)
         at TrackingMediator_StatelessSessionBeanWrapper2.editOverheadExpenditure(TrackingMediator_StatelessSessionBeanWrapper2.java:1593)
         at com.enbridge.dsm.web.action.TrackingPortfolioAction.editOverheadExpenditure(TrackingPortfolioAction.java:264)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java)
         at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:278)
         at com.enbridge.dsm.web.shared.BaseAction.execute(BaseAction.java:90)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
         at com.enbridge.dsm.web.shared.DSMPojoRequestProcessor.process(DSMPojoRequestProcessor.java:182)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1425)
         at com.sourcebeat.strutslive.common.SLActionServlet.process(SLActionServlet.java:44)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.enbridge.dsm.web.shared.security.SecurityFilter.doFilter(SecurityFilter.java:142)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:645)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    Note that the exception is thrown at the time when the session bean is about to commit the transaction. i.e. the DAO code did not throw any exception and was able to check the optimistic locking and submit the update transaction.
    I am not able to understand why is the the EJB throwing this weird error with Optimistic locking implementation. The application is working fine when the optimistic locking is disabled.
    I am facing another problem due to this problem... since the session bean throws this exception after exiting the bean implemented method, when trying to commit the transaction, I am not able to mark the session context to setRollbackOnly. Hence if I continue on to another transaction by navigating to another screen in the application, mysteriously the previous transaction gets committed!!... again... weird...

    I am using JDBC driver version 10.1.2.
    I saw this additional error message in JDeveloper console, which for some reason was not logged to my log4j log file... if it helps...
    06/09/22 18:32:10 Thr[thread 6]-TransactionEnlistment.TransactionEnlistment.Caught forgetandRollback XAException e null
    Here are the logs from my Toplink log file....
    [TopLink Info]: 2006.09.22 06:31:46.546--ServerSession(989)--Thread(Thread[HttpRequestHandler-86,5,main])--TopLink, version: Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)
    [TopLink Info]: 2006.09.22 06:31:46.578--ServerSession(989)--Thread(Thread[HttpRequestHandler-86,5,main])--Server: Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)
    [TopLink Config]: 2006.09.22 06:31:46.593--ServerSession(989)--Connection(991)--Thread(Thread[HttpRequestHandler-86,5,main])--connecting(DatabaseLogin(
         platform=>Oracle10Platform
         user name=> ""
         connector=>JNDIConnector datasource name=>jdbc/ORADS
    [TopLink Config]: 2006.09.22 06:31:47.484--ServerSession(989)--Connection(1432)--Thread(Thread[HttpRequestHandler-86,5,main])--Connected: jdbc:oracle:thin:@10.210.16.37:1521:orabld
         User: APP_USR
         Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
         Driver: Oracle JDBC driver Version: 10.1.0.3.0
    [TopLink Config]: 2006.09.22 06:31:47.500--ServerSession(989)--Connection(1433)--Thread(Thread[HttpRequestHandler-86,5,main])--connecting(DatabaseLogin(
         platform=>Oracle10Platform
         user name=> ""
         connector=>JNDIConnector datasource name=>jdbc/ORADS
    [TopLink Config]: 2006.09.22 06:31:47.500--ServerSession(989)--Connection(1434)--Thread(Thread[HttpRequestHandler-86,5,main])--Connected: jdbc:oracle:thin:@10.210.16.37:1521:orabld
         User: APP_USR
         Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
         Driver: Oracle JDBC driver Version: 10.1.0.3.0
    [TopLink Info]: 2006.09.22 06:31:47.671--ServerSession(989)--Thread(Thread[HttpRequestHandler-86,5,main])--DBSession login successful
    [TopLink Fine]: 2006.09.22 06:31:47.703--ServerSession(989)--Connection(1554)--Thread(Thread[HttpRequestHandler-86,5,main])--select * from user_role ur, app_resource ar, role_resource rr where rr.APP_RESOURCE_ID = ar.APP_RESOURCE_ID and rr.USER_ROLE_ID = ur.USER_ROLE_ID
    [TopLink Fine]: 2006.09.22 06:31:49.937--ServerSession(989)--Connection(10245)--Thread(Thread[HttpRequestHandler-86,5,main])--SELECT * FROM PROGRAM_SUB_CAT
    [TopLink Fine]: 2006.09.22 06:31:50.015--ServerSession(989)--Connection(10332)--Thread(Thread[HttpRequestHandler-86,5,main])--SELECT PROGRAM_ID, CREATED_BY_USERID FROM (SELECT CREATED_BY_USERID, ROWNUM PROGRAM_ID FROM (SELECT DISTINCT(CREATED_BY_USERID) CREATED_BY_USERID, 1 AS PROGRAM_ID FROM PROGRAM))
    (I only see my application specific queries after this... no exceptions or debug logs)... as I said before.. the application gives exception in the session bean at the time of commit, and there's no exception raised from Toplink code in DAO...

  • Weird problem with session in webapp

    I am currently developing some web app and I'm stuck. Here is my problem: I have two frames (left for navigation and right as main frame for content). When I click on some button in navigation frame, it should open somepage.jsp in content frame via ajax (prototype ajax.updater). This is the way I have to do it because in content frame I also have other objects I want to leave intact. Problem is that page, that I want to open, doesn't see the session bean (the value I stored in it). It always returns null. I have stored my lines in init() method.
    But, when I click the button to retrieve the value that I previously stored it, everything is ok - I can see my value...
    Code is something like this:
    - in navigation frame:
    <rich:panelMenuItem binding="#{PanelMeni.newJspLink}" action="#{PanelMeni.setValueInSession}" oncomplete="new Ajax.Updater('myDivId', linkToPage, {method:'get', evalScripts:true})">
    <f:param name="idClick" value="myValue" />
    </rich:panelMenuItem>
    Backing bean is something like:
    public String setValueInSession() {
    FacesContext ctx = FacesContext.getCurrentInstance();
    HttpSession ses = (HttpSession) ctx.getExternalContext().getSession(true);
    ses.setAttribute("action", ctx.getExternalContext().getRequesParameterMap().get("idClick"));
    So far, so good. Attribute really is set in session. I've checked...
    Now, when i try to read this value in referenced page (during initialization - set in init method), it returns null. Here is code from backing bean of that page:
    FacesContext ctx = FacesContext.getCurrentInstance();
    HttpSession ses = (HttpSession) ctx.getExternalContext().getSession(false);
    Systen.out.println(ses.getAttribute("action")); ---> result is null!!!
    But, when I press the button that I implemented on that page for test purposes (that is executing same methods as above) it returns correct value!!!
    Am I missing something here? Why is my value visible "onclick" and not "onload"?
    Thanks..

    getAttribute() is not called before setAttribute. I have tried setting two buttons: one for setting value in session and second for invoking somepage.jsp (second button is not located inside somepage.jsp!!!). Result is the same: null value.
    RaymondDeCampo, I'm using url rewriting to track session. But you got me thinking! Maybe I have to manually set session id when I'm using Ajax.Updater. It is probably working on button click because those components sends session id by themselves (a4j:button is probably programmed in that way). I'll give it a shot and let you know.
    Thanks...
    Correction: I did not implement url rewritting mechanism by myself - Netbeans and SJSAS takes care for that, but I THINK they use url rewritting mechanism
    Edited by: goxy on Jul 1, 2008 7:49 AM

  • JNDI Naming Problem accessing Session Bean from Message Driven Bean

    Hi,
         I am facing a very strange problem in JNDI look up accessing a Session Bean from a Message Driven Bean. I have a session fa�ade bean(Remote Bean) which is being called from Struts Action class getting the home reference from the ServiceLocator (I have implemented ServiceLocator pattern to obtain JNDI reference for all EJBs). When I am calling the session fa�ade EJB from the Struts Action class everything is working fine.
         But when I am trying to call the same EJB from my Message Driven Bean, I am getting a JNDI exception (NameNotFoundException - No Object bound to name �java:comp/env/ejb/EJBJNDIName�). I am trying to get the remote reference from the same ServiceLocator which is successfully providing me a reference while calling from the struts action class. But the same ServiceLocator is not able to provide me a reference while calling from the Message Driven Bean. If I use the JNDI name directly like �EJBJNDIName� in the lookup it is working fine. The lookup for the name is working fine and I am able to call the Session Fa�ade bean with that reference.
         I am really not sure what exactly the problem is. If I have any problem in the ServiceLocator, it should have given me the same error while calling from Struts Action class. But it is working fine with the full name �java:comp/env/ejb/EJBJNDIName� calling from the struts action class. I am not sure whether Message Driven Bean has something to do with it. Why I am not able to get a reference of the EJB with the full name? Please Help.
    Thanks
    Amit

    Hi Bhagya,
    Thanks for your response. I think from EJB container we can call Local EJBs with the full JNDI name. The session facade bean which is being called is a remote bean. From the session facade bean I am calling a local stateless session bean for database access. I am getting the reference of the local EJB from my session facade bean with full JNDI name "java:comp/env/ejb/EJBJNDIName". It is working fine with out any problem. My servicelocator is able to provide me the reference of the local EJB from the session facade remote bean with Full JNDI name. I am only having this problem calling from the MDB. I am really not sure whether what is causing it?
    Thanks
    Amit

  • Servlets - problem with session

    Hi there ppl,
    I have a login servlet which is called form a link in a static html page. The doGet() method is as below:
    public void doGet(HttpServletRequest request,
              HttpServletResponse response)
         throws ServletException, java.io.IOException
         HttpSession session = public void doGet(HttpServletRequest request,
                                  HttpServletResponse response)
                                  throws ServletException, java.io.IOException
              HttpSession session = request.getSession(false);
              RequestDispatcher rd = request.getRequestDispatcher("/login.jsp");
              response.setContentType("text/html");
              //PrintWriter out = response.getWriter();
              if(session != null){
                   //display members page(with users name as a welcome)
                   System.out.println("in login servletb");
              else{
                   System.out.println("in login servlet");
                   request.setAttribute("membersName", "adom");
                   rd.forward(request, response);
                   //out.close();
         RequestDispatcher rd = request.getRequestDispatcher("/login.jsp");
         if(session != null){
         //display members page(with users name as a welcome)
         System.out.println("session exists");
         else{
         System.out.println("session not exisit");
         request.setAttribute("membersName", "adom");
         rd.forward(request, response);
    Problem is when i click on the link in the html page it goes into tthe else statement and displays the login.jsp page fine. But when i click bak on the browser and then click the link agian it goes into the if statemtn..as if a session exists. But why does a session exisit???...if i use request.getSession(false) this shouldnt create a session if one doent already exists so where is this mysterious session being created??
    any ideas would be greatly appreaciated
    Mycall

    yer i do need the session because in my doPost() method of the servlet i create a session once the user logs on with there login/pass. The doGet() method is only to direct the person to the login page. But i want to check for the session in the doGet() incase they have already login in...if so direct them to the main page rather than to the login page agian.
    I stuffed up the code in my previous post...everything compiles and works fine apart from the fact that a session is created when it shouldnt be. I did a test println with session.getCreationTime() and it was created the same time the servlet was initial called. However im not sure if it was created by my servlet or if the broswer somehow had something to do with it....hmm is a worry.
    Heres the code again...hopefully a bit neater for u :D
    public void doGet(HttpServletRequest request, HttpServletResponse reponse)throws ServletException, java.io.IOException{
    HttpSession session = request.getSession(false);
    RequestDispatcher rd = request.getRequestDispatcher("/login.jsp");
    if(session != null){
    //display members page(with users name as a welcome)
    System.out.println("session exists");
    else{
    System.out.println("no session");
    request.setAttribute("membersName", "adom");
    rd.forward(request, response);
    thanks agian :)

  • Using session bean in JSP

    Dear All
    I write a BorrowList session bean and tested OK in console mode. I can't use it in the JSP, Dose any body tell me How can I create this bean in the JSP and when should I place the bean classes(Home, Bean and Remote).
    I'm now using the BEA Weblogic 7.0
    I'm appreicate if anybody can help me.
    Best Regards
    YU

    U may be used the code similar to following :
    Context context = new InitialContext.();
    Object obj = (Object)context.lookup("Your JNDI name");
    YourHome home = (YourHome)obj.portableRemoteObject.narrow(obj,
    YourHome.class);
    YourRemote remote = home.create();
    System.out.println("your Business methods : "+remote.businessMethod1());
    Put this code or whatever code used in ur console client in JSP and invoke the businessMethods using remote object.
    I worked with BEAWeblogic 5.1, I think similar case may be there with BEA Weblogic7 also.
    First, make a jar file with ome.Remote and Bean by using the deploymenttool, then compile with ejb compiler, the new Jar is the complete deployable file. Take this file and register in weblogic.properties file that is specify the path of the Jar file in the weblogic.properties file. and put the JSP in public-html directory and start the server. if the bean is deployed successfully, open JSP file in a browser then it will work.... if the bean is not deployed you won't get any result.
    I can say, just placing the initialContext part of code on the JSP and running the JSP. I think, this may helps u...
    Ramana

  • What role can ejb Session Beans  play  jsp session tracking

     

              I am also looking for a way to use JSP as ejb client with WLS5.1. i would appreciate any help.
              -Girish
              Prasad Peddada <[email protected]> wrote:
              >David,
              >     The beans which are refered in jsp specs are java beans and not EJB.
              >
              >Prasad
              >
              >David Levy wrote:
              >>
              >> Hello,
              >>
              >> We are using Jsp/Servlets which will hold session state and subsequently
              >> call ejb Session Beans for transaction/persistence coordination . We are
              >> not sure if we are using the correct techniques to control object memory.
              >>
              >> Summary of what we have:
              >>
              >> A jsp with the "useBean" directive:
              >> <jsp:useBean id="MySession" class="com....MySession"
              >> scope="session"></jsp:useBean>
              >>
              >> The class MySession holds other classes ( all serializable).
              >> The class MySession is NOT an ejb Session Bean
              >>
              >> Questions:
              >> We are considering making class MySession an ejb Session Bean so (via it's
              >> passivate/activate feature) we can control instances in memory as more web
              >> clients start the session from the jsp page. I.E. all web clients will have
              >> their own HttpSession instance which holds on to an ejb Session Bean object
              >> "MySession"( or a passivated representation of it)
              >>
              >> 1) Is this a sufficient approach or will there be other memory concerns?
              >> I.E. What about all the HttpSession objects out there? Do they need to be
              >> passivated as well?
              >>
              >> 2) If its a good idea to passivate the HttpSessions as well, then what
              >> mechanism should be used ( servlet session persistence)? Also, if we are
              >> passivating the HttpSession (which holds on to the MySession object graph)
              >> , then why bother with the SessionBean for passivation
              >>
              >> 3) Currently, we only have a single instance of a servlet handling all
              >> requests. Will multiple instances buy us anything?
              >>
              >> 4) How does clustering relate to this topic?
              >>
              >> 5) Can we change the "jsp:useBean" directive so MySession is an ejb Session
              >> Bean or do we have to do the "home.create()" within a jsp script?
              >>
              >> thanks,
              >> dave
              

Maybe you are looking for