JSP, Servlet and RMI

HI,
I have developed a simple interface to start and stop a java application.
In practice I have a command panel (a JSP page) that communicates with a servlet that through RMI is able to start and stop my external java application.
JSP and servlet are under Tomcat.
Here are my codes:
JSP:
<%@ page language="java" session="true" autoFlush="true" isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1" isErrorPage="false" %>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form action="controlpanel" method="get" name="pannello" id="pannello">
<p>
<select name="op" size="1" id="op">
<option value="start" selected>start</option>
<option value="stop">stop</option>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
SERVLET:
* Created on 03-Dec-2003
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import server.Mmce;
* @author root
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
public class CommandPanel extends HttpServlet
     protected void doGet(HttpServletRequest request,
               HttpServletResponse response) throws ServletException, IOException
          String operation = request.getParameter("op");
          log("OPERAZIONE="+operation);
          PrintWriter out = response.getWriter();
          if (System.getSecurityManager() == null)
               System.setSecurityManager(new RMISecurityManager());
          try
               Mmce comp=(Mmce)Naming.lookup("rmi://192.168.1.113/Mmce");               
               if (operation.equalsIgnoreCase("start"))
                    comp.start();
               else
                    comp.stop();
          catch (Exception e)
               log(e.getMessage());
               StackTraceElement[] el = e.getStackTrace();
               String errore = "";
               for (int g = 0; g < el.length; g++)
                    errore += el[g].toString()+"\n";
               log(errore);               
          finally
               response.setContentType("text/html");
               log("Write html");
               RequestDispatcher rd = request.getRequestDispatcher("/panel.jsp");
               rd.forward(request,response);
// Follow part is commented
/**out.println("<html>");
               out.println("<head>");
               out.println("<title>Pannello di comando</title>");
               out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
               out.println("</head>");
               out.println("<body>");
               out.println("<form action=\"controlpanel\" method=\"get\" name=\"pannello\" id=\"pannello\">");
               out.println("<p>");
               out.println("<select name=\"op\" size=\"1\" id=\"op\">");
               out.println("<option value=\"start\" selected>start</option>");
               out.println("<option value=\"stop\">stop</option>");
               out.println(" </select>");
               out.println("</p>\n<p>");
               out.println("<input type=\"submit\" name=\"Submit\" value=\"Submit\">\n</p>");     
               out.println("</form>\n</body>\n</html>");
All works fine for two times in that I start and stop application. At the third time, when i start my application from jsp, I receive this Tomcat error:
type Status report
message /panel.jsp
description The requested resource (/panel.jsp) is not available.
like the jsp could not be reachble.
If I try to stop and restart the application from Tomcat Manager panel and go to the url of JSP, I have this exception:
org.apache.jasper.JasperException: Unable to compile class for JSP
     org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:587)
     org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:177)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
     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)
     sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     java.lang.reflect.Method.invoke(Method.java:324)
     org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:284)
     java.security.AccessController.doPrivileged(Native Method)
     javax.security.auth.Subject.doAsPrivileged(Subject.java:499)
     org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
     org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:200)
root cause
java.lang.NullPointerException
     sun.misc.URLClassPath$3.run(URLClassPath.java:311)
     java.security.AccessController.doPrivileged(Native Method)
     sun.misc.URLClassPath.getLoader(URLClassPath.java:308)
     sun.misc.URLClassPath.getLoader(URLClassPath.java:285)
     sun.misc.URLClassPath.getResource(URLClassPath.java:155)
     java.net.URLClassLoader$1.run(URLClassLoader.java:190)
     java.security.AccessController.doPrivileged(Native Method)
     java.net.URLClassLoader.findClass(URLClassLoader.java:186)
     org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:192)
     org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:110)
     org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:582)
     org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:177)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
     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)
     sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     java.lang.reflect.Method.invoke(Method.java:324)
     org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:284)
     java.security.AccessController.doPrivileged(Native Method)
     javax.security.auth.Subject.doAsPrivileged(Subject.java:499)
     org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
     org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:200)
note The full stack trace of the root cause is available in the Tomcat logs.
I need to restart Tomcat and then I have the same proble and then that my JSP works fine for two times and at the third time come unreachble.
If I change the servlet's part in which I do the forward to the JSP and put the commented part, the application works fine.
Anybody can tell me why my JSP come unreachble?
Thanks
Emanuele Pecorari

I add this thing:
if I add in java.policy this permission:
permission java.security.AllPermission;
all works fine.
I want to know what exactly permission I must put in my file in order that the application works fine in the same handle.

Similar Messages

  • Using a single connection for jsp, servlets and classes

    Hi! I'm building a web site that uses JSP, Servlets and some classes. I use database access in all my pages. I want to open a connection and use it for all the pages while the user is in my site, so I don't need to open a connection with every new jsp or servlet page. My software must be capable of connection with various databases, like SQLServer, Oracle, Informix, etc... so the solution must not be database (or OS or web server) dependant.
    Can you help me with this? Some ideas, links, tips? I'll REALLY appreciate your help.
    Regards,
    Raul Medina

    use an initialiation servlet with pooled connection which can be accessed as sesssion object.
    Abrar

  • Deploying the JSPs, Servlets and Java class files

    Hello All,
    I'm very new to the Oracle 9i AS. We are using Version 1.0.2.2.
    How do we deploy the JSPs, Servlets, and Java class files (simple class files, not EJBs)?
    plese give us the procedure and stpes how to deply or the links for the same.
    Thanks,
    Santhosh.

    Hi
    I guess u r running apache-jserv as servlet engine for your jsp and servlets. If its so, jsp files can be run without any additonal configuration by putting the jsp file under document root or any subdirectory and for running servlets u have to add classpath entries for your servlet in jserv.properties file.
    To make sure that your servlet engine is working, try
    http://servername:port/servlet/IsItWorking, if u get success msg that means servlet engine is working fine.
    Hope this will help
    Regards
    Kumaran

  • Examination system using JSP/SErvlet and MySQL

    Hi
    I am new to JSP /servlet.
    I am designing online examination system using JSP/Servlet and MySQL ,where multiple choice questions would be selected randomly from the database. After completion of the examination user gets the results ,also the results would be stored in the database for the future reference.
    Can anyone guide me for this? If possible give me the code for similar type of application.
    Thanks

    Sounds like you want someone else to do your homework for you, did you not read this:
    "This forum works so much better when you try to program the code yourself, then let us know where it doesn't work. Otherwise you learn very little, and we work a whole lot."
    and this
    "If you want free code, have you tried searching Google for it? You may want to consider looking for survey software. It will give you the question/answer capabilities then all you have to do is find a way to grade the survey (if you will)...
    If you are using Tomcat as your server, which you probably are, there is a jdbc tutorial included in the documentation, that is the fastest way to set up your database.
    As for your random selection, have a look at Math.random(), this is one way to generate random numbers, you will need an algorithm to convert this value (between 0.0 and 1.0) into a form that can be used to select information from your database.

  • JSP Servlet and convert the result set of an SQL Query To XML file

    Hi all
    I have a problem to export my SQL query is resulty into an XML file I had fixed my servlet and JSP so that i can display all the records into my database and that the goal .Now I want to get the result set into JSP so that i can create an XML file from that result set from the jsp code.
    thisis my servlet which will call the jsp page and the jsp just behind it.
    //this is the servlet
    import java.io.*;
    import java.lang.reflect.Array;
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.naming.*;
    import javax.sql.*;
    public *class *Campaign *extends *HttpServlet
    *private* *final* *static* Logger +log+ = Logger.+getLogger+(Campaign.*class*.getName());
    *private* *final* *static* String +DATASOURCE_NAME+ = "jdbc/SampleDB";
    *private* DataSource _dataSource;
    *public* *void* setDataSource(DataSource dataSource)
    _dataSource = dataSource;
    *public* DataSource getDataSource()
    *return* _dataSource;
    *public* *void* init()
    *throws* ServletException
    *if* (_dataSource == *null*) {
    *try* {
    Context env = (Context) *new* InitialContext().lookup("java:comp/env");
    _dataSource = (DataSource) env.lookup(+DATASOURCE_NAME+);
    *if* (_dataSource == *null*)
    *throw* *new* ServletException("`" + +DATASOURCE_NAME+ + "' is an unknown DataSource");
    } *catch* (NamingException e) {
    *throw* *new* ServletException(e);
    protected *void *doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    Connection conn = *null*;
    *try* {
    conn = getDataSource().getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select post_id,comments,postname from app.posts");
    // out.println("Le r&eacute;sultat :<br>");
    ArrayList <String> Lescomments= *new* ArrayList<String>();
    ArrayList <String> Lesidentifiant = *new* ArrayList<String>();
    ArrayList <String> Lesnoms = *new* ArrayList <String>();
    *while* (rs.next()) {
    Lescomments.add(rs.getString("comments"));
    request.setAttribute("comments",Lescomments);
    Lesidentifiant.add(rs.getString("post_id"));
    request.setAttribute("id",Lesidentifiant);
    Lesnoms.add(rs.getString("postname"));
    request.setAttribute("nom",Lesnoms);
    rs.close();
    stmt.close();
    *catch* (SQLException e) {
    *finally* {
    *try* {
    *if* (conn != *null*)
    conn.close();
    *catch* (SQLException e) {
    // les param&egrave;tres sont corrects - on envoie la page r&eacute;ponse
    getServletContext().getRequestDispatcher("/Campaign.jsp").forward(request,response);
    }///end of servlet
    }///this is the jsp page called
    <%@ page import="java.util.ArrayList" %>
    <%
    // on r&eacute;cup&egrave;re les donn&eacute;es
    ArrayList nom=(ArrayList)request.getAttribute("nom");
    ArrayList id=(ArrayList)request.getAttribute("id");
    ArrayList comments=(ArrayList) request.getAttribute("comments");
    %>
    <html>
    <head>
    <title></title>
    </head>
    <body>
    Liste des campagnes here i will create the xml file the problem is to display all rows
    <hr>
    <table>
    <tr>
    </tr>
    <tr>
    <td>Comment</td>
    <td>
    <%
    for( int i=0;i<comments.size();i++){
    out.print("<li>" + (String) comments.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>nom</td>
    <td>
    <%
    for( int i=0;i<nom.size();i++){
    out.print("<li>" + (String) nom.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>id</td>
    <td>
    <%
    for( int i=0;i<id.size();i++){
    out.print("<li>" + (String) id.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    </table>
    </body>
    </html>
    This is how i used to create an XML file in a JSP page only without JSP/SERVLET concept:
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%
    // Identify a carriage return character for each output line
    int iLf = 10;
    char cLf = (*char*)iLf;
    // Create a new empty binary file, which will content XML output
    File outputFile = *new* File("C:\\Users\\user\\workspace1\\demo\\WebContent\\YourFileName.xml");
    //outputFile.createNewFile();
    FileWriter outfile = *new* FileWriter(outputFile);
    // the header for XML file
    outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
    try {
    // Define connection string and make a connection to database
    Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/SAMPLE","app","app");
    Statement stat = conn.createStatement();
    // Create a recordset
    ResultSet rset = stat.executeQuery("Select * From posts");
    // Expecting at least one record
    *if*( !rset.next() ) {
    *throw* *new* IllegalArgumentException("No data found for the posts table");
    outfile.write("<Table>"+cLf);
    // Parse our recordset
    // Parse our recordset
    *while*(rset.next()) {
    outfile.write("<posts>"+cLf);
    outfile.write("<postname>" + rset.getString("postname") +"</postname>"+cLf);
    outfile.write("<comments>" + rset.getString("comments") +"</comments>"+cLf);
    outfile.write("</posts>"+cLf);
    outfile.write("</Table>"+cLf);
    // Everything must be closed
    rset.close();
    stat.close();
    conn.close();
    outfile.close();
    catch( Exception er ) {
    %>

    Please state your problem that you are having more clearly so we can help.
    I looked at your code I here are a few things you might consider:
    It looks like you are putting freely typed-in comments from end-users into an xml document.
    The problem with this is that the user may enter characters in his text that have special meaning
    to xml and will have to be escaped correctly. Some of these characters are less than character, greater than character and ampersand character.
    You may also have a similiar problem displaying them on your JSP page since there may be special characters that JSP has.
    You will have to read up on how to deal with these special characters (I dont remember what the rules are). I seem to recall
    if you use CDATA in your xml, you dont have to deal with those characters (I may be wrong).
    When you finish writing your code, test it by entering all keyboard characters to make sure they are processed, stored in the database,
    and re-displayed correctly.
    Also, it looks like you are putting business logic in your JSP page (creating an xml file).
    The JSP page is for displaying data ONLY and submitting back to a servlet. Put all your business logic in the servlet. Putting business logic in JSP is considered bad coding and will cause you many hours of headache trying to debug it. Also note: java scriptlets in a JSP page are only run when the JSP page is compiled into a servlet by java. It does not run after its compiled and therefore you cant call java functions after the JSP page is displayed to the client.

  • JSP, Servlet, and Java Classes location in Tomcat

    In tomcat, I want to know JSP files, Servlets, and Java classes
    should put in different locations:
    I put web.xml in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF
    I put all JSP files in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1
    I put all servlet files in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes
    I put all Java classes in the following with package proj1:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes\proj1
    When I execute JSP files, it has HTTP error 404, file not found.
    The content of web.xml is:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>proj1</display-name>
    <description>
         proj1
    </description>
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    </web-app>
    Please advise. thanks!!!

    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    </web-app>Where's the servlet definition that maps to "invoker"?

  • Java Controls, JSPs, Servlets and Filters

    Hi, everybody.
    How can i invoke a custom java control from a JSP ?
    How can i invoke a custom java control from a Servlet or Filter ?
    I've tried using WlwProxy.create(controlInterfaceClass, request) but i don't know if this is the "official and recommended" way of do it. By the way, invocation is falling because Workshop is trying to find a .jcx file (i have only a .jcs).
    Thanks in advance.

    Hi Vimala.
    All the business logic of my project will be implemented as Java Controls (that's the reason of my questions about Controls' accessibility):
    1. From a JSP
    A) I can use netui tag <netui-data:callControl>
    B) I can call a page flow to execute Java Control and to populate http request (or session) within some Java Beans. After this, the JSP will "consume" these Java Beans.
    2. From init method of a startup Servlet
    I can't call a Java Control from here. Can i implement analogous feature using Builtin Timer Control ?
    3. From service (doGet/doPost) method of a "ordinary" Servlet
    I can call a page flow to execute Java Control and to populate http request (or session) within some Java Beans. After this, the Servlet will "consume" these Java Beans.
    4. From filter method of a Servlet Filter
    This is the "trickest" one, but i really need to access business logic from here.
    I've found an way (and i'm not proud of how i'm doing this):
    i) The filter will populate a request attribute within information about which method of which control will be executed. Method parameters values will be stored too;
    ii) The filter will "forward" request to a Page Flow, using a HttpServletRequestWrapper and a "dummy/empty" HttpServletResponseWrapper. This is really odd. I'm not sure if a filter should try to "forward" or to "include" another webapp resources. When doing this, you should be aware about issues like "recursion" and configurations like filter-dispatched-requests-enabled (http://edocs.bea.com/wls/docs90/webapp/progservlet.html#160016);
    iii) The Page Flow will receive the new request, "unpack" invocation data, execute appropriate Java Control, "pack" the result in the http request and forward to an "empty" JSP;
    iv) The "execution control" will be returned to the filter. This filter will "discard" the contents of HttpServletResponseWrapper, "unpack" the result data out of the http request and use it.
    To "hide" all this mess of my filters and Page Flows, the filters will use a "dynamic proxy" to act as "Page Flow clients" (this proxy will look like as an ordinary Java Control to my filters). The Page Flows will use an helper class to store Java Controls (at onCreate lifecycle method), to use them (at begin method) and to discard/release them (at onDestroy lifecycle method).
    I've tested this and it has worked. I'm not sure about performance and multithread behaviour of this solution.
    I'm accepting any suggestion (official or "unofficial") about how to make this easier.
    Thanks !!!
    Sample code:
    == JavaControlClientProxy.java ==
    public Object invoke(Object proxy, Method method, Object[] parameters)
        throws Throwable {
        Object result = null;
        if (LOG.isDebugEnabled()) {
            LOG.debug("before: " + method.getName());
        try {
            HttpServletRequestWrapper newRequest =
                 new HttpServletRequestWrapper(this.request);
            HttpServletResponseWrapper newResponse =
                 new HttpServletResponseWrapper(this.response);
            InvocationData invocationData = new InvocationData();
            invocationData.setCaller(this.javaControlCaller);
            invocationData.setTarget(this.javaControlInterface);
            invocationData.setTargetMethod(method);
            invocationData.setParameters(parameters);
            newRequest.setAttribute(InvocationData.ATT_NAME, invocationData);
            try {
                RequestDispatcher dispatcher = this.request
                    .getRequestDispatcher(this.javaControlServerPath);
                /* include doesn't work (.jpf ?) */
                dispatcher.forward(newRequest, newResponse);
                invocationData = (InvocationData) newRequest
                    .getAttribute(InvocationData.ATT_NAME);
                if (invocationData.getException() != null) {
                    throw invocationData.getException();
                } else {
                    if (invocationData.getReturnValue() != null) {
                        result = invocationData.getReturnValue();
            } finally {
                newResponse.getWriter().close();
                newResponse.getOutputStream().close();
            return result;
        } finally {
            if (LOG.isDebugEnabled()) {
                LOG.debug("after: " + method.getName());
    }== ControlCallController.jpf ==
    * This method represents the point of entry into the pageflow
    * @jpf:action
    * @jpf:forward name="success" path="empty.jsp"
    protected Forward begin()
        try {
            this.controlServer.execute(getRequest());
        } catch (IllegalArgumentException e) {
            try {
                /* Avoid external access to this resource. */
                getResponse().sendError(HttpServletResponse.SC_NOT_FOUND);
            } catch (IOException e1) {
                throw new UnhandledException(e1);
            throw e;
        return new Forward("success");
    protected void onCreate() throws Exception {
        super.onCreate();
        this.controlServer = new JavaControlServer();
        this.controlServer.addControl(MyControl1.class, this.myControl1);
        this.controlServer.addControl(MyControl2.class, this.myControl2);
    protected void onDestroy(HttpSession arg0) {
        this.controlServer = null;
        super.onDestroy(arg0);
    }== JavaControlServer.java ==
    public void execute(final HttpServletRequest request)
        throws IllegalArgumentException {
        InvocationData invocationData = (InvocationData) request
            .getAttribute(InvocationData.ATT_NAME);
        if (LOG.isDebugEnabled()) {
            LOG.debug("InvocationData " + invocationData + ".");
        if (invocationData == null) {
            throw new IllegalArgumentException("Http request doesn't contain "
                                               + InvocationData.ATT_NAME + ".");
        Control targetControl = (Control) this.controlMap.get(invocationData
                                                              .getTarget());
        if (targetControl == null) {
            throw new IllegalArgumentException("Missing control "
                                               + invocationData.getTarget() + ".");
        Method method = invocationData.getTargetMethod();
        try {
            Object returnValue = method.invoke(targetControl, invocationData
                                               .getParameters());
            invocationData.setReturnValue(returnValue);
        } catch (IllegalArgumentException e) {
            LOG.error("Could not invoke method", e);
            throw new UnhandledException(e);
        } catch (IllegalAccessException e) {
            LOG.error("Could not invoke method", e);
            throw new UnhandledException(e);
        } catch (InvocationTargetException e) {
            LOG.debug("An error has ocurred when invoking method", e);
            invocationData.setException(e.getCause());
        request.setAttribute(InvocationData.ATT_NAME, invocationData);
    }

  • Same JSP/Servlet is executing again and again

    Hello,
    We have some JSPs which do a lot of processing and is 'alive' for a long period
    of time. If we use the JSP with small amouts of data, it is fine. But when we
    use the JSP with lot of data, it seems to 'go in a loop'.
    It is processing the data again and again and again and brings down our server.
    We do not think it is the code that is wrong - as it processes perfectly if the
    data is small or when our server is not busy. This problem happens if the data
    is lot and the server is also busy. The JSP seems to be executing again and again.
    Is there some type of 'refresh' logic in weblogic that refreshes the JSP/servlet
    and makes it 'execute' again and again.
    We are using WL 6.1
    Thanks,
    Oleg.

    Hi Oleg,
    Could you tell us how you find out that there is an additional request?
    Regards,
    Slava Imeshev
    "Oleg" <[email protected]> wrote in message
    news:[email protected]...
    >
    Thank you Varad and Slava,
    We don't use plagin for iplanet,
    but our problem is very similar:
    Weblogic generate additional request if the previous request toservlet/jsp is
    taking long time.
    Where I can configure JSP timeout to fix this problem?
    Thank you very much.
    Oleg.
    "Varadharajan" <[email protected]> wrote:
    Hi Oleg,
    Are you using weblogic plugin for iplanet webserver ?
    In weblogic server 6.1 sp3 there is a problem with this plugin. It would
    generate
    additional request if the previous request to servlet/jsp is taking more
    than
    the configurable timeout set in the obj.conf file of iplanet webserver.
    This plugin problem is fixed in wls6.1 sp4.
    Rgds,
    Varad
    "Slava Imeshev" <[email protected]> wrote:
    Hi Oleg,
    See my answers inline.
    "Oleg" <[email protected]> wrote in message
    news:[email protected]...
    Hello,
    We have some JSPs which do a lot of processing and is 'alive' for
    a
    long
    period
    of time. If we use the JSP with small amouts of data, it is fine.But
    when we
    use the JSP with lot of data, it seems to 'go in a loop'.I guess you need to figure out if "seems" really "does".
    It is processing the data again and again and again and brings downour
    server.
    How do you know that a JSP goes into a loop?
    We do not think it is the code that is wrong - as it processes
    perfectly
    if the
    data is small or when our server is not busy. This problem happensif the
    data
    is lot and the server is also busy. The JSP seems to be executingagain
    and again.
    What load is considered to be high/low for you
    application? Are you running a load test?
    Is there some type of 'refresh' logic in weblogic that refreshes
    the
    JSP/servlet
    and makes it 'execute' again and again.Normally Servlet/JSP enters service() method when
    there is an incoming request. It should not be happening
    at JSP's will.
    Regards,
    Slava Imeshev

  • How can I call EJB from JSP/Servlets in iWS?

    Hi!!
    My JSP/Servlets are on iWS, and I deploy EJB on iAS.
    In this case, I don't know how JSP/Servlet call EJb on iAS.
    I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
    I will thank you if you give me a simple example source using JSP/Servlet
    and EJB.
    Thanks in advance!!!
    - Park-

    Park,
    Why Are you running your JSP/Servlets in iWS instead of iAS? For whatever
    reason,
    look at the Converter sample from iAS. You will be doing RMI/IIOP in this
    case and the sample explains in detail what to do.
    hth,
    -robert
    "SungHyun, Park" <[email protected]> wrote in message
    news:9jpfmt$[email protected]..
    Hi!!
    My JSP/Servlets are on iWS, and I deploy EJB on iAS.
    In this case, I don't know how JSP/Servlet call EJb on iAS.
    I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
    I will thank you if you give me a simple example source using JSP/Servlet
    and EJB.
    Thanks in advance!!!
    - Park-

  • Jsp,servlet,bean question,please help

    The Tomcat Web server set up like this.......
    The directory structure is
    e:/sampleapp/WEB-INF/classes
    /lib
    And the web.xml is in the WEB-INF for the use of ay potential servlet.
    The basic understanding is that all the .java files go into the WEB-INF directory and the .class files go into the classes directory.
    All the .jsp files go into the sampleapp directory.Till here is correct I feel.
    Now for my qustion......
    I plan to use jsp,servlet and beans for a potential web application...,where do all these files go?,just the same as above or is there a difference.
    Hope that I have given a reasonable explaination to my question.
    Thanks for any replies
    AS

    All of your compiled servlet and java bean (java
    classes in general) will be placed into the following
    directory (under a directory structure matching the
    java package they are in):
    e:/sampleapp/WEB-INF/classesAll of your .jar files that are used as libraries (not
    your .jar files for applets):
    e:/sampleapp/WEB-INF/libAll of the rest of your JSP files, javascript files,
    HTML files, JAR files, images files, etc. will go into
    the following directory:
    e:/sampleappYou must make sure you put your sampleapp directory
    where tomcat can load it. Or use the admin tool to
    load it. If you make a .WAR file with a corresponding
    web.xml file in it, it will simplify loading it into
    tomcat. It also will help you do your servlet
    mappings, etc. I hope this helps.Thanks for your timely response.To add to it,let me tell you.
    The <b>bean</b> files are put into a package right,so they should be put into the WEB-INF/classes/<package name>
    What about The <b> servlet </b> files...... they are just put into the WEB-INF/classes/ directory????
    Kindly let me know.
    Thanks
    AS

  • Applet-Servlet or RMI - which is better

    We are in the process of developing a swing-applet based system that requires regular interaction with multiple databases residing on more than one database server.
    The options available before us, as we evaluate are:
    a. Use "signed" applets ( as this is going to be essentially an intra-net application) and use JDBC connection to connect to more than one database ( which reside on servers other than the web server).
    b. Use applet - servlet communication - basically, the servlet would establish connection to the databases, directly or through EJB, retrieve necessary database information and pass on the objects to the applet - the front end GUI would be controlled by the applet.
    c. Use RMI
    We would like to have your perspective of the three options, with your experience in this line.
    The questions that come to us are:
    a. If the system is essentially an intra-net application, is it okay to design with "signed" applet mechanism - how far is this method common in the market and acceptable to the clients? Is it true that the signed applet would be able to establish connection to various "identified servers" that are allowed permissions in the security file?
    b. Between applet-servlet and RMI, which is a better method? What should be the factors that need to be considered? Is RMI being widely used or should we be thinking in terms of EJB, eventhough the current project is purely a Java based solution.
    Your input is highly appreciated - thanking in advance for any suggestions and inputs that you may provide.
    Thanks
    Dixie

    Dixie,
    1) IMHO signed applets are not widely used, but you can use
    ordinary applets, which are accessing other resources through
    redirector servlet on server side - I mean ordinary applets
    are prohibited to establish connect to other than it's own server.
    So you will be forced to have special servlet on your server,
    which have access to other resources on other servers - this is a
    way how to avoid applets limitation.
    2) RMI is a heavy solution, because all parameters/objects should
    be serialized over net and if network connection is unreliable
    working with system will be just a nighmare.
    3) If you think that your network connection is unreliable, you can use HTTP protocol between client and server instead of RMI. In this case
    you will have following benefits:
    i) You can still use all of powerness of thick client
    ii) Network unreliability will be defeated
    iii) Sometime if you would like to port your application to a thin
    client it will be done much more easier than in case of RMI
    4) If you would like to use thin client your only problem will
    be poorness of UI - if you can go with it - go ahead! Otherwise
    use thick client with RMI or HTTP depending on quality of network.
    Paul

  • JSP/Servlets & XML - suggestion needed

    Hi everyone,
    I don't have any coding issues, I'm really just looking for some help on deciding how to go with a project I want to make. First off, I wrote a Java library that builds messages in a special format. I wanted to come up with a pretty frontend for it, so I decided I'd try my hand at a webapp since I've been interested in them for a while. So far my web app consists of jsps, servlets and my library.
    At this point I'd like to add the ability for the webapp to store created messages in an XML file (read / write). The XML library I want to use is JAXB. I have it setup to read/write my XML file fine in a test servlet, however I'd like to implement this in a kind of "best practice" approach. So I'm looking for suggestions on how I should do this.
    A few of my ideas:
    1) Use a jsp page to call a "MessagesBean" which retrieves my data from my xml file. I could then format this nicely in the jsp page. The problem with this however is that I can't find any way to open a file relative to the webapp from within a Bean. ie. when I try to open "messages.xml", I can see from tomcat errors that it attempts to open it in tomcats bin folder (or if i run from within eclipse, eclipses bin folder). I know I could get around this by using an absolute path but I want this to be portable. Any suggestions?
    2) To solve the above problem I found "getServletContext().getRealPath("")" in the Servlet API. Using this method I'm able to open my XML file relative to my webapp. The only issue I have here is that I'm now using a servlet to display the page, making it harder for me to format the output.
    I'm very new to JSP/Servlets/etc so I really don't know how I should be doing this. I'm just trying to make sure I don't start out on the wrong foot. Can someone please give some suggestions on what I could do?
    Cheers.

    I suggested not putting business logic in the servlet, but instead instansiating a business logic object in the servlet and calling one of its functions to do the work.
    There is nothing wrong with putting the business logic in the servlet on first try. Just later on, you might want to refactor the code to more conform to the above.
    In your code, you mentioned that the MessagesBean in the JSP page doesnt seem to call the constructor. The <useBean> tag first looks to
    see if the object is in request scope. If it is, it uses it (doesnt call constructor). If its not, it creates its own (calls constructor). You should always
    have it in request scope ready for useBean to use.
    I think this line:
    <jsp:useBean id="messages" class="my.package.MessagesBean" />
    should be changed to something like:
    <jsp:useBean id="messages" class="my.package.MessagesBean" scope="request" />
    The MessagesBean should only have get/set methods to get data out of its object (its a very simple object that holds data). None of its functions
    should perform business logic such as hitting the database.
    Therefore these items in your JSP page should be in the servlet or business logic:
    messages.setPath( getServletContext().getRealPath("") ); // Pass in relative PATH
    messages.processXML(); // Process XML file
    While this should be in your JSP:
    java.util.List<TEXT> TextFiles = messages.getTEXTFiles(); // Return a List of TEXT objects
    Question: The JSP calls my Bean "MessagesBean". It then passes in the current relative path. This seems fairly hackish to me, is there a better way to give the relative path to my bean?
    Answer: Hard code the relative path to the JSP page in the servlet or business logic. There is no need for the JSP page to pass its path back to the servlet or business logic. Your servlet
    'knows' the path to all the JSP pages it needs to dispatch to.
    The best way to learn MVC is to continually refactor your code until it looks more and more like MVC (separation of concerns).

  • URGENT Servlet with RMI ConnectionException

    i have an object with two personalities: Servlet and RMI.
    However when i invoke it using the web browser, the following exceptions pop out:
    <!--
    java.rmi.ConnectException: Connection refused to host: 172.20.134.24; nested exc
    eption is:
    java.net.ConnectException: Connection refused: connect
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at IncomingSMSController.init(IncomingSMSController.java:43)
    at IncomingSMSController.init(IncomingSMSController.java:35)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
    java:916)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.jav
    -->
    the way i code my program is as follow:
    <!--
         protected void init()throws ServletException{
              try{
                   System.out.println("\n<<IN>>");
                   Registry reg=LocateRegistry.getRegistry();
                   System.out.println("\n<<"+reg+">>");
                   reg.rebind("ControllerInterface",this);
                   bound=true;
                   System.out.println("Server now bound to IncomingSMSController");
              }catch(Exception e){
                   System.out.println("Error binding");
                   e.printStackTrace();     
    public static void main(String[] args)throws RemoteException,ServletException{
    Controller con=new Controller();
    con.init();
    -->
    Anyone please help thanks. i have been asking this question here for many time and no one reply may i know at least why?
    thanks.

    Hi,
    I see the java doc of LocateRegsitry and you can read :
    LocateRegistry is used to obtain a reference to a bootstrap remote object registry on a particular host (including the local host), or
    to create a remote object registry that accepts calls on a specific port.
    Note that a getRegistry call does not actually make a
    connection to the remote host. It simply creates a local reference to
    the remote registry and will succeed even if no registry is running on
    the remote host. Therefore, a subsequent method invocation to a remote
    registry returned as a result of this method may fail.
    So may be the exception, throw when you call rebind, is due to non active registry in local machine. You can try to execute your servlet
    after activate your registry via LocateRegistry.createRegistry(int port)
    Hope this help

  • Sample jsp servlet bean (MVC) code

    We want to look into the JSP/Servlet/Bean area for our next project. We wish to understand the technology and as such want to hand build simple applications, and as such do not want to use JDeveloper just yet.
    We have searched and searched for suitable material but cannot anywhere find a sample application that :
    A. Lists contents of a databse table
    B. Each item in trhe list is a link to a page that allows that item, to be edited.
    C. A new item can be added.
    D. Uses the MVC model of JSP/Servlet and bean (preferably with no custom tags)
    There are examples that are too simplistic and do not cover the whole picture. Having spent over 100 GBP on books lately, only to be disappointed with the examples provided, we need to see some sample code.
    The samples provided by Oracle are too simplistic. They should really have provided ones built around the EMP and DEPT tables.
    Anyone know where we can get hold of this sample code.

    At the risk of sounding really dumb the examples are just too complex. There does not appear to be anywhere on the web where I can find a simple JSP/servlet/bean example of the type I described. There is enouigh material describing each individual component, but what I need is an example to cement the ideas, but the ones suggested are too much for a newbie. Even the much vaunted Pet Store thingy causes my eyes to glaze over.
    I dont expect anyone to have written something with my exact requirements, but surely to goodness there must be something that:
    1. On entry presents a search form on a table (e.g. EMP)
    2. On submission list all rows in EMp matchiung the criteria.
    3. The user can either click the link 'Edit' which opens up a form dispalying the row allowing the user to edit and save the changes, or click the 'New' button to show a blank form to create a new EMP.
    All this via a Controller servlet, with the database logic handled by a java bean, and all the presentation done via JSP.
    To me this is the most obvious and instructive example of this technology, but after days of trawling the web, and looking through a number of books, I cannot find such a thing.
    CGI with Perl DBI/DBD was a breeze to work with compared to this stuff ..... maybe ASP with SQL/Server would be a more fruitful use of time.

  • Change Drop Down from Other JSP/Servlet/Bean

    I am wanting to have a select box populate from a database query based on the information pulled from another select box as the user chooses it (ie a user chooses a state and the city choices populate or something like that). I am using JSP, Servlets and Beans. Seems that I need to us JSF, but I was wondering if there is another way or better way.
    Thanks for the thoughts.

    user12081556 wrote:
    I meant to put in my question above, aren't jsf tags just imbedded in some jsp/html code?Not jsp code no. I don't know whether it's possible to use jsf and jsp together, but I wouldn't try.
    While JSP has evolved over time from Html and Java code mixed together to standard tags responsible mostly for displaying the data, it's still an old "hack" that compiles jsp pages into servlets.
    JSF at least alleviates some of those problems and works nicely with proper xhtml formatted views too (and there's facelets etc. etc. etc.).
    Granted, if you're shown some jsp tags and jsf tags, you might not appreciate the difference in the technologies.

Maybe you are looking for

  • Photostream photos lost after IOS 8 update

    Hello, I was wondering if anyone could please help me... every since updating to IOS 8 recently, I can't seem to find my photos that were in my photostream. Can anyone recommend a good photo recovery software or advice on how to retrieve lost photost

  • How do i give money from one account to another.

    I put a gift card into the wrong account ( I still own it though. ) and I want to know how I can put it into my new account. Thank you, if you need more info, please ask.

  • Calling Z function module from BSP page

    hi,   i am calling a z function module from BSP application ROS_SELF_REG ,The z function module is inside a z function group,It does not give any sytnax error..but while running BSP application ,it is going into dump saying that Z function module is

  • Hp dm4 will not boot up have no recovery disc

    hp dm4-2191us windows 7 64-bit When turning on computer error message "A disk read error occured" start up test 0 memory

  • Submit button disabed, when uploading eGate.sar

    Hi, I am facing a problem when installing Jcaps 5.1 on Solaris 10 sparc. Following are the steps. 1) Successfully installed Repository 2) Successfully logged into web-admin page.(with username and password) 3) From the "browse" button able to add /ca