Session from JSP
Is there any way I can access a session variable of a JSP page from APEX page?
THanks
I open a JDBC connection in each JSP page
which inturn creates Oracle SessionAn oracle session is only really created if you make set autocommit to false for your connection.
How are you obtaining the connections?
Using the Drivermanager to get a connection on every page?
Or a JNDI lookup of a Datasource?
Do you call connection.setAutoCommit() for a connection? (Defaults to true)
How do you close your statements? Should be in a finally statement.
Once java closes the connection, it should no longer be there in oracle. Unless of course you are using connection pooling in some way shape or form.
Cheers,
evnafets
Similar Messages
-
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. -
How to get an ArrayList Object in servlet from JSP?
How to get an ArrayList Object in servlet from JSP?
hi all
please give the solution for this without using session and application...
In test1.jsp file
i am setting values for my setter methods using <jsp:usebean> <jsp:setproperty> tags as shown below.
After that i am adding the usebean object to array list, then using request.setAttribute("arraylist object")
---------Code----------
<jsp:useBean id="payment" class="com.common.PaymentHandler" scope="request" />
<jsp:setProperty name="payment" property="strCreditCardNo" param="creditCardNumber" />
<%-- <jsp:setProperty name="payment" property="iCsc" param="securityCode" /> --%>
<jsp:setProperty name="payment" property="strDate" param="expirationDate" />
<jsp:setProperty name="payment" property="strCardType" param="creditCardType" />
<%--<jsp:setProperty name="payment" property="cDeactivate" param="deactivateBox" />
<jsp:setProperty name="payment" property="fAmount" param="depositAmt" />
<jsp:setProperty name="payment" property="fAmount" param="totalAmtDue" /> --%>
<jsp:useBean id="lis" class="java.util.ArrayList" scope="request">
<%
lis.add(payment);
%>
</jsp:useBean>
<%
request.setAttribute("lis1",lis);
%>
-----------Code in JSP-----------------
In testServlet.java
i tried to get the arraylist object in servlet using request.getAttribute
But I unable to get that arrayObject in servlet.....
So if any one help me out in this, it will be very helpfull to me..
Thanks in Advance
EdwardHi,
Im also facing the similar problen
pls anybody help..
thax in advance....
Litty -
Insert data into table from JSP page using Entity Beans(EJB 3.0)
I want to insert data into a database table from JSP page using Entity Beans(EJB 3.0).
1. I have a table 'FRIENDS', (in Oracle 10g database).
2. It has two columns, 'NAME' and 'CITY'. Both have datatype strings(varchar2).
3. Now from a JSP page, having two textfields, 'NAME' and 'CITY', I want to insert data into table 'FRIENDS'.
4. In between JSP and database is a Entity Bean(EJB 3.0) and a stateless session bean.
5. I am using JDev as editor.
Please provide me code ASAP or link with similar example.
Thank you.
AnuragHi,
I am also trying that scenario. So u can
Post the jsp form data to a Servlet which will act as a Controller.
In the servlet invoke the business method.
Similar kind of app is in www.roseindia.net
Hope this would help u.
Meanwhile if u get any optimal solution, pls post it.
Thanks,
Happy Java Coding. -
Hi all,
i built a web application now i want to use session in JSP pages to remember some variable such as password and entered date because i need them in later pages and i also don't want to send them via HTML hidden field. I actually don't know how to use session. Can anyone please just tell me how to create a session and store a variable and also how to retrieve the data from the session.
Another thing is guys can anyone tell me please that say i am user and i selected some items from a HTML select list and i submitted that and logged off the system now when i login later again i want to see those choices selected by default , i know it might have been done by sessions can anyone please tell me.
THANKS VERY MUCHThis is the way u can set and retrieve values from session
<% session.setAttribute("key","value"); %>
<% String user=(String)session.getAttribute("user");
%>
regards
Shanu -
I want to send email from jsp,
i want to send email from jsp, i dont know smtp:host, how to send mail?
plz carify this doubt sir.OK thanks sir but i installed alredy. i write this code. plz send any error's are there. and i dont know smtp:host name. i put my port address?
try{
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", "//10/0/6/252");
// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
msg.setFrom(new InternetAddress("[email protected]"));
msg.addRecipient(Message.RecipientType.To,new InternetAddress("[email protected]"));
// Setting the Subject and Content Type
msg.setSubject("hi..");
msg.setText("hi bharath how are you");
Transport.send(msg);
catch(Exception e)
out.println(e);
} -
UNABLE TO ACCESS SECURED EJB USING IIOP FROM JSP
Following codes does not work with IIOP when called from jsp returns an
com.sap.engine.services.iiop.CORBA.CORBAObject:com.sap.engine.services.iiop.server.portable.Delegate_1_1@8312b1 step2 RemoteException occurred in server thread; nested exception is: java.rmi.RemoteException: com.sap.engine.services.ejb.exceptions.BaseRemoteException: User Guest does not have access to method create(). at
Following codes does not work with IIOP when called from a fat client returns an
org.omg.CORBA.UNKNOWN: vmcid: 0x0 minor code: 0 completed: Maybe
at com.sun.corba.se.internal.core.UEInfoServiceContext.<init>(UEInfoServ
iceContext.java:33)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.sun.corba.se.internal.core.ServiceContextData.makeServiceContext(
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.cosnaming.CNCtxFactory");
p.put(Context.PROVIDER_URL, "iiop://hostname:50007");
p.put(Context.SECURITY_PRINCIPAL, "User");
p.put(Context.SECURITY_CREDENTIALS, "pass");
I have add java option to add IIOP filer
-Dorg.omg.PortableInterceptor.ORBInitializerClass.com.sap.engine.services.iiop.csiv2.interceptors.SecurityInitializer
Solution Required: Could you please detail me what steps in need to perform in order for me to access secure ejb using iiop protocol.
FYI -- How ever ejb security works with P4 protocol, If required i can send you the test case ear.
Thanks
Vijay
Following are the server side logs
java.rmi.RemoteException: com.sap.engine.services.ejb.exceptions.BaseRemoteException: User Guest does not have access to method create().
at test.TestEJBHomeImpl0.create(TestEJBHomeImpl0.java:91)
at test._TestEJBHome_Stub.create(_TestEJBHome_Stub.java:214)
at jsp_testIIOP1199698887113._jspService(jsp_testIIOP1199698887113.java:33)
at com.sap.engine.services.servlets_jsp.server.jsp.JspBase.service(JspBase.java:112)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:544)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:186)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: com.sap.engine.services.security.exceptions.BaseSecurityException: Caller not authorized.
at com.sap.engine.services.security.resource.ResourceHandleImpl.checkPermission(ResourceHandleImpl.java:608)
at com.sap.engine.services.security.resource.ResourceHandleImpl.checkPermission(ResourceHandleImpl.java:505)
at com.sap.engine.services.security.resource.ResourceContextImpl.checkPermission(ResourceContextImpl.java:45)
at test.TestEJBHomeImpl0.create(TestEJBHomeImpl0.java:89)
... 20 more
; nested exception is:
java.lang.SecurityException: com.sap.engine.services.security.exceptions.BaseSecurityException: Caller not authorized.
at com.sap.engine.services.security.resource.ResourceHandleImpl.checkPermission(ResourceHandleImpl.java:608)
at com.sap.engine.services.security.resource.ResourceHandleImpl.checkPermission(ResourceHandleImpl.java:505)
at com.sap.engine.services.security.resource.ResourceContextImpl.checkPermission(ResourceContextImpl.java:45)
at test.TestEJBHomeImpl0.create(TestEJBHomeImpl0.java:89)
at test._TestEJBHome_Stub.create(_TestEJBHome_Stub.java:214)
at jsp_testIIOP1199698887113._jspService(jsp_testIIOP1199698887113.java:33)
at com.sap.engine.services.servlets_jsp.server.jsp.JspBase.service(JspBase.java:112)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:544)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:186)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)That's the code that you need to execute but you should
probably encapsulate that code in Custom Action.
Orion has a EJB Tag Library that is free to distribute that
does all that stuff you just set some attributes.
Go to their site and look at their Tag Libraries.
Also look for other Tag Libraries Freely Available for EJB Access. -
Passing value from JSP to scriptlet
Hi
I am trying to find a way to pass a value from jsp to the scriptlets, i.e.
<c:set var="testValue" value="123" />
<%
System.out.println(testValue);
%>
the above code just demonstrates what I was trying to achieve, by passing the value from the jsp into the scriptlet.
Can someone tell me if there's an easy way to do this?
Thank you.Note, using scriptlet code on your page is generally something to be avoided. 99% of what you should be doing on a JSP page can be done with EL/JSTL. If you can't do it with EL/JSTL then it probably belongs in a servlet/bean.
I always aim for 100% scriptlet free jsp pages.
Having said that, I can still answer your question: EL attributes are stored in the scope - page, request, session, application
${testValue} is equivalent to pageContext.findAttribute("testValue").
The <c:set> tag example doesn't specify a scope, so therefore you could get it like this:
<c:set var="testValue" value="123" />
<%
String testValue = (String)pageContext.getAttribute("testValue");
System.out.println(testValue);
%>alternatively exploit the feature of the useBean tag that creates a scriptlet variable:
<c:set var="testValue" value="123" />
<jsp:useBean id="testValue" type="java.lang.String"/>
<%
System.out.println(testValue);
%>Note that the EL variable and the Scriptlet variable are initially pointing at the same String.
But changing the string in scriptlet code will change the value it is pointing at, while leaving the EL variable untouched.
If you have a List in scope, and sharing it between EL and scriptlet variables then any changes to the list would be reflected because they both point at the same List object.
cheers,
evnafets -
Printing Problem in Crystal Report From JSP
Hi,
I m calling crystal report from JSP.Report is parameterized.I m passing parameters from JSP.Report is displaying on the page,but when I try to print or export the report by pressing Print or export Button ,it displays an error message "Some parameters are missing values".
Please guide my,what should I do? Following is the code.
Good Bye
AQ
Vector fieldVector = new Vector();
SPParameters spParams = new SPParameters();
ReportFactory reportFactory = new ReportFactory();
// Setteing the report Name (Path Appended)
reportFactory.setReportName(ReportsCoreDataConstants.REPORT_PATH.concat("Test_Rep2.rpt"));
//Setting the parameters for the report
ParameterField paramFeilds = null;
System.out.println("fiscalYearCode:"+fiscalYearCode);
paramFeilds = spParams.createParams("IPFISCALCODE",fiscalYearCode);
paramFeilds.setReportName("");
fieldVector.add(paramFeilds);
//Creating the ReportSourceInstance
reportFactory.setFields(fieldVector);
String exp = "";
try {
ReportFactory l_reportFactory=null;
l_reportFactory = reportFactory;
if (l_reportFactory != null) {
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.setParameterFields(l_reportFactory.getFields());
viewer.setOwnPage(true);
viewer.setDisplayGroupTree(false);
viewer.setHasZoomFactorList(false);
viewer.setHasLogo(false);
viewer.setHasPrintButton(true);
viewer.setHasRefreshButton(true);
viewer.setHasToggleGroupTreeButton(false);
viewer.setHasViewList(false);
viewer.setPrintMode(CrPrintMode.ACTIVEX);
viewer.setSeparatePages(true);
viewer.setEnableParameterPrompt(false);
viewer.setReuseParameterValuesOnRefresh(true);
viewer.setReportSource(l_reportFactory.createReport( request.getLocale() ));
viewer.refresh();
viewer.processHttpRequest(request, response, getServletConfig().getServletContext(),out);
viewer.dispose();
} catch(Exception e) {
exp = e.toString();
System.out.println("Exception in JSP : " + e.toString());
e.printStackTrace();
}I think ScreenRaghu is right. If you look at the generated source, your jsp becomes an action and processHttpRequest() method is invoked everytime some action happens. So when you click the export button, request object no longer has the values your report needs. Either put the values in session or via link or db or whatelse.
-
How to Handle user Session in JSP
Help me,
How to handle user session in JSP.......Prakash_Pune wrote:
tell me some Debugging tech. so i can overcome from my problem.....Do you use an IDE? Any IDE ships with a decent debugger where in you can just execute the code step by step, explore the current variable values and check what exactly is happening. For example Eclipse or IntelliJ. If you don´t use an IDE, then just place some System.out.println() or Logger.debug() statements at strategic locations printing the variables of relevance so that you can track in logs what exactly is happening.
or tell any other way to find is my page is thread safe or not...Just write correct code and narrow the scope of the variables as much as possible. If you for example assigned the user object to a static variable or as a servlet´s instance variable, then exactly the same user object would be used everywhere in the application. That kind of logical things. -
hello
i want to send email from jsp
the following is that code
and i also downloaded the mail.jar and activation.jar
and there is no error in the code
but the email is not sent
kindly tell me that what can be the reason
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="[email protected]";
String to="[email protected]";
try{
SmtpClient client = new SmtpClient("xx.xxx.xx.xx");//replace with the reqiured smtp
client.from(from);
client.to(to);
PrintStream message = client.startMessage();
message.println("To: " + to);
message.println("Subject: Sending email from JSP!");
message.println("This was sent from a JSP page!");
message.println();
message.println();
message.println();
client.closeServer();
catch (IOException e){
System.out.println("ERROR SENDING EMAIL:"+e);
%>try this:
<html>
<body>
<form action="enviaremail.jsp" method="post">
<table border="0" align="center" bgcolor="tan">
<tr>
<td><b>Para..:</b></td>
<td><input type="Text" name="para"</td>
</tr>
<tr>
<td><b>De..:</b></td>
<td><input type="Text" name="de"</td>
</tr>
<tr>
<td><b>Assunnto..:</b></td>
<td><input type="Text" name="assunto"</td>
</tr>
<tr>
<td colspan="2">
<textarea name="mensagem" rows=10 cols=45></textarea>
</td>
</tr>
</table>
<center> <input type="Submit" value="Enviar Email"></center>
</form>
</body>
</html>
<html>
<body>
<%@ page import="jspbrasil.Email" %>
<jsp:useBean id="email" class="jspbrasil.Email"/>
<%
try {
String mailServer = "mail.seumailserver.com.br"
String assunto = request.getParameter("assunto")
String para = { request.getParameter("para") };
String de = request.getParameter("de");
String mensagem =request.getParameter("mensagem");
email.sendSimpleMail(mailServer, assunto, para, de, mensagem);
%>
<p>Email enviado com Sucesso !!!</p>
<%
catch (AddressException e) { %>
<p>Endere�o de Email inv�lido</p>
<%}%>
<%
catch (MessagingException e) { %>
<p>Imposs�vel enviar o email.</p>
<%}%>
</body>
</html>
package jspbrasil;
import javax.mail.*;
import javax.mail.internet.*;
import.java.util.*;
public class Email {
public void sendSimpleMail (String mailServer, String subject,
String to,String from, String mensagem)
throws AddressException, MessagingException {
Properties mailProps = new Properties();
//defini��o do mailserver
mailProps.put("mail.smtp.host", mailServer)
Session mailSession = Session.getDefaultInstance(mailProps, null);
//As duas linhas seguintes de c�digo, colocam no
//formato de endere�os,
//supostamente v�lidos, de email os dados
//passados pelos par�metros to e from.
InternetAddress destinatario = new InternetAddress (to);
InternetAddress remetente = new InternetAddress (from);
//As duas linhas de c�digo a seguir, s�o
//respons�veis por setar os atributos e
//propriedas necess�rias do objeto message
//para que o email seja enviado.
//inicializa��o do objeto Message
Message message = new MimeMessage (mailSession);
//Defini��o de quem est� enviando o email
message.setFrom(remetente);
//define o(s) destinat�rio(s) e qual o tipo do
//destinat�rio.
//os poss�veis tipos de destinat�rio: TO, CC, BCC
message.setRecipient( Message.RecipientType.TO, destinat�rio );
//defini��o do assunto do email
message.setSubject (subject);
//defini��o do conte�do da mensagem e do
//tipo da mensagem
message.setContent (mensagem.toString(), "text/plain");
//a linha de c�digo seguinte � a respons�vel
//pelo envio do email
Transport.send (message); -
Calling JSP from Forms and going back from JSP to Forms
Hi,
We are calling JSP from Forms 6i using show_document
I'd like to go back to tha calling Form from the JSP.
How can I construct the URL that would lead me back to the same Form and Forms session where the JSP was called from?
Thanks,
ArpadThanks Shay,
works for me too...
Now:
when I use the "Back" button of my IE to go back from JSP to the Forms session, it works for Jinitiator 1.1.8.19, but if I use Jinitiator 1.3 I got hung...
Any ideas how could I make it work from Jinit 1.3?
Thanks again/
Regards,
Arpad -
Cant call localejbbean from jsp
hi all,
i try to call my LocalEjbBean from Jsp file , but i got this exception
this is my jsp file
<%
com.dcons.iss.HelloLocalHome home =null;
com.dcons.iss.HelloLocal hello=null;
Context ctx = new InitialContext();
Object obj=ctx.lookup("HelloLocalBean");
home = (com.dcons.iss.HelloLocalHome)obj;
hello = home.create();
hello.display();
%>
this is my ejb-jar xml
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Hello</ejb-name>
<local-home>com.dcons.iss.HelloLocalHome</local-home>
<local>com.dcons.iss.HelloLocal</local>
<ejb-class>com.dcons.iss.HelloLocalBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>HelloLocalBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>HelloLocal</local-home>
<local>HelloLocalHome</local>
<ejb-link>HelloLocalBean</ejb-link>
</ejb-local-ref>
</session>
</enterprise-beans>
</ejb-jar>
this is my weblogic -ejb-jar.xml
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>Hello</ejb-name>
<stateless-session-descriptor>
</stateless-session-descriptor>
<reference-descriptor>
<ejb-local-reference-description>
<ejb-ref-name>HelloLocalBean</ejb-ref-name>
<jndi-name>HelloLocalBean</jndi-name>
</ejb-local-reference-description>
</reference-descriptor>
<local-jndi-name>HelloLocalBean</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
Exception is
<May 17, 2004 12:53:00 PM GMT+05:30> <Error> <HTTP> <BEA-101017> <[ServletContex
t(id=14238425,name=TestServerPro,context-path=/TestServerPro)] Root cause of Ser
vletException.
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundExcept
ion: While trying to look up /app/ejb/LocalEJBProject.jar#Hello/local-home in /a
pp/webapp/TestServerPro/26623105.; remaining name '/app/ejb/LocalEJBProject/jar#
Hello/local-home'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(Basic
NamingNode.java:858)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNaming
Node.java:150)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.j
ava:237)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:336)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyCo
ntextWrapper.java:45)
at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.j
ava:130)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at weblogic.jndi.internal.WLNamingManager.getObjectInstance(WLNamingMana
ger.java:96)
at weblogic.jndi.internal.ServerNamingNode.resolveObject(ServerNamingNod
e.java:265)
at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.
java:732)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
1)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.j
ava:237)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:336)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at jsp_servlet.__index._jspService(index.jsp:20)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:402)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at com.bea.wlw.netui.pageflow.PageFlowJspFilter.doFilter(PageFlowJspFilt
er.java:208)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispat
cherImpl.java:305)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.superForward(Page
FlowRequestProcessor.java:1304)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor$DefaultHttpRedire
ctor.forward(PageFlowRequestProcessor.java:1320)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.doForward(PageFlo
wRequestProcessor.java:1200)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.processForwardCon
fig(PageFlowRequestProcessor.java:1094)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:279)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.process(PageFlowR
equestProcessor.java:651)
at com.bea.wlw.netui.pageflow.AutoRegisterActionServlet.process(AutoRegi
sterActionServlet.java:527)
at com.bea.wlw.netui.pageflow.PageFlowActionServlet.process(PageFlowActi
onServlet.java:152)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:402)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:305)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispat
cherImpl.java:307)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.superForward(Page
FlowRequestProcessor.java:1304)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor$DefaultHttpRedire
ctor.forward(PageFlowRequestProcessor.java:1320)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.doForward(PageFlo
wRequestProcessor.java:1200)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.process(PageFlowR
equestProcessor.java:638)
at com.bea.wlw.netui.pageflow.AutoRegisterActionServlet.process(AutoRegi
sterActionServlet.java:527)
at com.bea.wlw.netui.pageflow.PageFlowActionServlet.process(PageFlowActi
onServlet.java:152)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:402)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6354)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3635)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2585)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException: While trying to look up /app/ejb/LocalEJBProject.jar#Hello/local-home in /app/webapp/TestServerPro/26623105.; remaining name '/app/ejb/LocalEJBProject/jar#Hello/local-home'
plz help me to solve this problemHi,
The portable way to lookup any resources within a J2EE component is to the private component namespace located under java:comp/env. Even though some products allow you to do a "global" lookup, that's not the preferred approach since it's not portable. Your deployment descriptors need to be changed since you need to define the ejb-local-ref within the descriptor of the client component, which in this case is the jsp. So, you would need to define the ejb-local-ref within the web.xml associated with the jsp. The ejb-ref-name within the ejb-local-ref should be appended to the java:comp/env lookup in your code. So, for your example, the jsp would ctx.lookup("java:comp/env/HelloLocalBean")
--ken -
Calling custom OAF page from JSP page in Oracle apps
Hi,
I am working on a requirement to call a Custom OAF page from a JSP page in Oracle apps 11.5.10.
I have registered the OAF page and defined a function for it. When we call this OAF page from JSP (without parameter), the page opens up
URL: http://APPSURL:8020/OA_HTML/RF.jsp?function_id=27221&resp_id=50312&resp_appl_id=515&security_group_id=0&lang_code=US
but as soon as I am trying to pass a parameter sr_id in the URL:
http://APPSURL:8020/OA_HTML/RF.jsp?function_id=27221&resp_id=50312&resp_appl_id=515&security_group_id=0&lang_code=US&sr_id=106
we are getting following error:
You are trying to access a page that is no longer active.
- The referring page may have come from a previous session. Please select Home to proceed.
Please let me know if someone has faced the same problem...
Thanks!!!Hi,
Before calling a OAF page..from external JSP page...u need to set certain mandatory parameter like transaction Id and context.
Regards,
Gyan -
How to call a method of an Action class from JSP on load?
Hi guys
Due to bad design pattern, i am forced to do something which i have not tried before.
I need to call a method of a struts action class which invalidated the user session FROM the JSP itself on load. Which means it would not require user input.
We have a subclass of a DispatchAction that handles all the incoming .dos.
So http://blarblarblar:7001/blar/blar/doSomething.do?method=logout will dispatch to an Action class called DoSomething, into a method called logout().
So when the webapp throws an exception, the ActionMapping actually displays an error.jsp and i have to invalidate the user at this stage.
I can't change the most top level code in the base action class so i got to do it this way.
Any help is much appreciated.
Thanks.hi :-) DispatchAction is quite cool ;-)
dont get much of your question but hope
the suggestion below could help.
A. use redirect?
or
B. autosubmit the form
1. create your form in a jsp
<html:form action="/doSomething" />
<html:hidden name="method" value="logout" />
</html:form>2. auto submit the form with method = logout
put the function autosubmit in the "onLoad" event of the body
<script>
function autosubmit(){
var form = document.yourformname;
form.submit();
<script>regards,
Maybe you are looking for
-
My iPad 3 bettery life is very poor, and it doesn't chrage when it's plugged in and I'm using it, only when it's plugged in and turned off. I'm beginning to be sorry I bought this iPad and that I should have stuck with the iPad 2.
-
How do I deactivate a copy on a computer that no longer exists
I am trying to use the program, and the last time I used it, must have been on my old computer. It is telling me to deactivate the other copy but I no longer have the computer. Help please!
-
I have a zes lmg500 that I use. It has the option of continues measuring data, with a user control cycle loop (still using a while loop but the delay is coming from the instrument). The problem is that the loop time is not constant. Can I use a very
-
How to do an earthquake effect in final cut pro?
I know you can do one on imovie is there a way I can do something incredibly similiar in final cut pro?
-
Spry Tabbed Panels set to use the Opacity fade out / in
can the Spry Tabbed Panels be set to use the Opacity fade out / in similar to the Spry Image SlideShow effects?