Problem with Servlets

Hi,
I am Tejas , a newbie with servlets. Now, I have a servlet which contains a Javascript method. On clicking a link , the Javascript method is called.
But however, I find that there is some trouble. I created a class called MainFrames.java, the object of which I am instantiating in the Javascript method.
But this code doesnt work properly. I have given the snippet below
out.println("<script type='text/javascript'>");
out.println("function threader()");
out.println("{");
out.println("alert('Inside Threader');");
out.println("<%@ page import=\"XcForm.MainFrames\"%>"); //I have a hunch that this statement is the problem
out.println("<%");
out.println("MainFrames mainframes = new MainFrames();"); //without the import statement above, the MainFrames.java class is not being recognised
out.println("%>");
out.println("}");
out.println("</script>");
Thanks in advance,
Tejas

Do not put presentation code in servlets. Put them in JSPs. And mixing serverside code (scriptlets) and clientside code (javascript) this way is indeed not going to work. That code will certainly not be executed in the order as you write. Serverside code is executed at the server and is finished when the response is completed. So any serverside code inside clientside code is alreay executed. Clientside code is executed at the client and will only execute when the response is completed (onload, etc) or when the client invokes it (onclick, onsubmit, etc). Further on, do not put business code in presentation code. Put them in servlets.

Similar Messages

  • Problems with servlet mapping in 10g AS

    Hi There,
    i have a web application consisting of 2 controller servlets and use url mapping to send requests to the appropriate servlet, but i have a strange issue with 10g where it seems to be alternating between serlvets when handling requests!!!!
    the web.xml is like as follows (with the app having the root context '/app'):
    <servlet>
    <servlet-name>control1</servlet-name>
    <servlet-class>com.package1.class.name</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>control2</servlet-name>
    <servlet-class>com.package2.class.name</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>control2</servlet-name>
    <url-pattern>/special/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>control1</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    therefore i'd expect a request like http://domain.name/app/special/content to be handled by the control2 servlet and http://domain.name/app/normal/content or http://domain.name/app/normal/special/content to be handled by the control1 servlet...
    but what seems to happen when requesting http://domain.name/app/special/content oc4j seems to alternate which servlet it passes it to...
    is there any reason why this might be happening (like some app server configuration), as i have other applications that are configured in the same way, and there's no problems with requests going to the wrong servlet.
    many thanks for your help,
    Andy

    In your integration process, define the import parameter under Configurable Parameters category.
    http://help.sap.com/saphelp_nwpi71/helpdata/en/44/1f1a5c932d0d19e10000000a114a6b/frameset.htm
    Regards,
    Prateek

  • Oracle.adf.view.rich.pprNavigation.OPTIONS on give problem with servlets

    I recentrly fix ADF_FACES-60058 using in web.xml:
    <context-param>
    <param-name>oracle.adf.view.rich.newWindowDetect.OPTIONS</param-name>
    <param-value>on</param-value>
    </context-param>
    and now bc this change, when i call a sevlet using ajax.. all my servlets stop working...
    =( This mean this is not good fix...

    Hi i am getting now after fix problem with my servlet( Delete servlet and use Backing bean instead)
    javax.servlet.ServletException: java.lang.InternalError: name is too long to represent
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:266)
    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
    at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java:267)
    at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:473)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:141)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
    at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:685)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:261)
    =/

  • Problems with servlet filters

    Hello,
    I'm trying to implement filters for some of the examples presented in the j2ee tutorial. Thus, I've realized a very simple filter that works very well for the Converter example (mapped to the index.jsp URL). But this filter doesn't work with the Duke's Bank application and I don't understand why. I've tried to map this filter to the Dispatcher servlet and also to different URLs, the filter is actually executed, but the client gets no response from the server.
    Here's the source code for my filter :
    package com.sun.ebank.web.filters;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public final class MyFilter implements Filter {
    private FilterConfig filterConfig = null;
    public void init(FilterConfig filterConfig) throws ServletException {
    this.filterConfig = filterConfig;
    public void destroy() {
    this.filterConfig = null;
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    if (filterConfig == null) return;
    HttpServletRequest hr = (HttpServletRequest)request;
    System.out.println ("MyFilter : " + hr.getMethod () +      " URL=" + hr.getRequestURL () +          " QueryString={" + hr.getQueryString () + "}");
    chain.doFilter(request, response);
    public String toString() {
    if (filterConfig ==null) return ("MyFilter()");
    StringBuffer sb = new StringBuffer("MyFilter(");
    sb.append(filterConfig);
    sb.append(")");
    return (sb.toString());
    Can anybody help me?
    Thanks,
    B.F.

    As you're not actually doing anything in this filter but a quick System.out.print, there doesn't appear to be a problem with the filter code.
    What does your web.xml file look like?
    Does your IDE allow you to trace through the filter to the next target in the chain? If so, where does the code die? If not, use System.out.print statements to determine how far into the code you get.
    No response to the client usually means that the response didn't have any content set. You can verify this by checking the state of the response object after doFilter has been called; if the headers haven't been set then something crashed in a bad way.
    Good luck!

  • Some problems with servlet.jar and tomcat 4.1.27

    Hello everybody,
    I used to work with tomcat 3.3.1 and i've decided to use tomcat 4.1.27 now. The manual explains that we have to change de version of servlet.jar, it's done with servlet-2.3.jar but on tomcat starting i have this message:
    jar not loaded. See servlet spec [...]. Offending class: javax/servlet/Servlet.class
    what can i do, i've red all de documentation and i think all versions a OK??
    thanks per advance
    antoine

    I am running Tomcat 4.1.18, so your configuration may be slightly different. I found the Servlet.class file you are missing residing in the Tomcat/common/lib directory in the Servlet.jar file. Check your path and also make sure your Servlet.jar file contains the missing class.

  • Help needed. Problem with servlet.

    Hello ppl. Ok. I've never really needed to implement servlets in my projects before but I experimented by writing a simple helloworld servlet. It compiled successfully and I tested it in the examples servlet dir and it worked. To test it in the ROOT dir, I placed the servlet in the ROOT/WEB-INF/classes folder and edited the web.xml file with:
    <servlet>
              <servlet-name>HelloWorldExample</servlet-name>
              <servlet-class>HelloWorldExample</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>HelloWorldExample</servlet-name>
              <url-pattern>servlet/*</url-pattern>
         </servlet-mapping>
    When I try and execute the servlet by using this URL: localhost:8080/servlet/helloworld I get an internal server error and the server crashes. I removed the entry from the web.xml file and Tomcat started up again. What went wrong? Can someone enlighten me in how to get my test servlet working becuase i may use them in the future. Thanks.

    Nope, Still didnt work. As soon as I put in:
    <servlet>
         <servlet-name>HelloWorldExample</servlet-name>
         <servlet-class>HelloWorldExample</servlet-class>
         </servlet>
         <servlet-mapping>
         <servlet-name>HelloWorldExample</servlet-name>
         <url-pattern>servlet/HelloWorldExample</url-pattern>
         </servlet-mapping>
    Tomcat went offline!
    I have another entry which is:
    <servlet>
              <servlet-name>org.apache.jsp.index_jsp</servlet-name>
              <servlet-class>org.apache.jsp.index_jsp</servlet-clas
    >
         </servlet>
         <servlet-mapping>
              <servlet-name>org.apache.jsp.index_jsp</servlet-name>
              <url-pattern>/index.jsp</url-pattern>
         </servlet-mapping>
    Do you think they may be conflicting? Thanks.Tomcat going offline is quite weird. However,
    <url-pattern>/index.jsp</url-pattern>
    this is perfectly valid. Lemme ask you this: did u come up with this stuff on your own or was it generated for you by the container? It looks like it was generated upon compilation of the jsp. If that is the case it should cause any conflicts. However now if you want to invoke the servlet/jsp you must use a URL like:
    http://localhost:<PORT_NO>/index.jsp
    Cheers

  • Problem with servlet and application program

    i have this error appearing in my browser...
    i have this feeling it is about the application, but if application alone, i now having some trouble running it, once i bind it with an applet i always have this message:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.NullPointerException
         exString.triming(exString.java:12)
         exString.geta(exString.java:113)
         forplay.play(forplay.java:9)
         textServe.doGet(textServe.java:14)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)
         org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
    i know this is a simple problem...
    how come my application is having some difficulty in running my application...
    this servlet by the way is a get parameter base...

    Its caused cuz ur exString is null..
    rgds
    shanu

  • A problem with servlet  mapping , using a servlet to produce some chart in

    Hi
    Thank you for reading my post.
    My problem is about using a Chart library which works well in jsf application but it does not works in JSF portlets.
    I think i find the problem but i do not know the solution.
    to use this charting library we should add a servlet to web.xml
    something like :
    <servlet>
    <servlet-name>Jenia internal servlet</servlet-name>
    <servlet-class>org.jenia.faces.util.Servlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Jenia internal servlet</servlet-name>
    <url-pattern>/jenia4faces/*</url-pattern>
    </servlet-mapping>
    so , when we try to load a chart , it will make the chart image source
    something like
    http://localhost:28080/Adv/jenia4faces/chart/OAReport.jspBarChart3d_id0.png
    in the above sample , adv is the name of web application which is
    deployed in a servlet container.
    and filter applied to make the chart render-able.
    to use the chart library in jsf portlet , i add the servlet
    description as i did for web application , so i add
    <servlet>
    <servlet-name>Jenia internal servlet</servlet-name>
    <servlet-class>org.jenia.faces.util.Servlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Jenia internal servlet</servlet-name>
    <url-pattern>/jenia4faces/*</url-pattern>
    </servlet-mapping>
    to my portlet web.xml file.
    when we have portlet , the url to access that portlet (which indeed is a
    web application) changes
    for example
    url for a sample portlet with same web application name
    will be like
    http:// localhost:28080/pluto/portal/Adv/
    as you can see there are some prefix to web application name in the url
    , but when i use chart component to show
    same chart , it still look for the chart in url like :
    http://localhost:28080/Adv/jenia4faces/chart/OAReport.jspBarChart3d_id0.png
    As you may already sugest , the image will not render because browser is
    looking in wrong place.
    now i
    think if i find some way to map that servlet to correct url
    pattern it will works.
    my question is :
    1-what will be new servlet url pattern ?
    2-is my assumption correct ?
    Thank you very much for reading such a long post

    i wrote an app i.e servlet which would select the data from the database and retrive the data.but i want to send this data to normal java file(which is not a servlet) and i want to display results in the normal java file.
    can any body help this concept........
    send me mail:[email protected]

  • A problem with servlets with  WebLogic 4.5.1 SP11

              Hello,
              We have developed a client that connects to servlets in WebLogic 4.5.1. Some of the servlets use sessions to store data, and they receive some parameters from the client to retrieve information from a database.
              When we use WebLogic 4.5.1, everything works fine. However, when we upgrade it to Service Pack 11, we find a problem. If we make a servlet that receives some parameters, but it does no use sessions, everything is correct. If we make a servlet that does not receive any parameter, and we use sessions, we find no problem either. But if we make a servlet that receives parameters and uses sessions within the doPost() method, there is an exception when we call the method Request.getSession(true).
              I would thank any help about this point, since I'm not sure if this is the result of a bug, or if there is a new parameter that we have to set in the file weblogic.properties, or any other reason.
              The code of our servlet is as simple as follows:
              public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
                   ObjectInputStream in = new ObjectInputStream(request.getInputStream());
                   String arg = null;
                   String arg2 = null;
                   String arg3 = null;
                   try{
                        arg = (String)in.readObject();
                        arg2 = (String)in.readObject();
                        arg3 = (String)in.readObject();
                   }catch(Exception e){
                   // Get the session and the counter param attribute
                   HttpSession session = request.getSession(true);
              // WE GET THE EXCEPTION AT THIS POINT.
                   Integer ival = (Integer) session.getValue("simplesession.counter");
                   if (ival == null)
                        // Initialize the counter
                        ival = new Integer(1);
                   else
                        // Increment the counter
                        ival = new Integer(ival.intValue() + 1);
                   // Set the new attribute value in the session
                   session.putValue("simplesession.counter", ival);
                   // Output data
                   ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream());
                   out.writeObject(ival);
                   out.close();
              On the other hand, the client invokes the serlvets using the following code:
              public int servletClient(String usuario,String password) {
                   int numero = 0;     
                   try{
                        // Input parameters
                        Serializable[] objs = {"login",usuario, password};
                        // Invokes the servlet
                        ObjectInputStream in = ServletWriter.postObjects(urlServlet, objs); // SEE BELOW...
                        // Get the results
                        numero = ((Integer)in.readObject()).intValue();
                        in.close();
                   }catch(Exception e){
                        e.printStackTrace();
              static public ObjectInputStream postObjects(URL servlet, Serializable objs[]) throws Exception
                        URLConnection con = servlet.openConnection();
                        con.setDoInput(true);
                        con.setDoOutput(true);
                        con.setUseCaches(false);
                        con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                        // Write the arguments as post data
                        ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
                        int numObjects = objs.length;
                        for (int x = 0; x < numObjects; x++) {
                             out.writeObject(objs[x]);
                        out.flush();
                        out.close();
                        return new ObjectInputStream( con.getInputStream() );
              // THE CLIENT CODE FINISHES HERE
              The exception we get is the following:
              Mon Feb 21 13:47:41 GMT-02:00 2000:<E> <ServletContext-Servlets> Servlet failed with RuntimeException
              Mon Feb 21 13:47:41 GMT-02:00 2000:<E> <ServletContext-Servlets> java.io.IOException: Unexpected end of POST data. Read 0 bytes. Content-length = 20
              at java.lang.Throwable.<init>(Compiled Code)
              at java.lang.Exception.<init>(Compiled Code)
              at java.io.IOException.<init>(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getParameter(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.initSessionInfo(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getSession(Compiled Code)
              at SGBA.servlets.HelloWorldServlet.doPost(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
              at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)
              --------------- nested within: ------------------
              weblogic.utils.NestedRuntimeException: cannot parse POST parameters of request /HelloWorldServlet
              - with nested exception:
              [java.io.IOException: Unexpected end of POST data. Read 0 bytes. Content-length = 20]
              at java.lang.Throwable.<init>(Compiled Code)
              at java.lang.Exception.<init>(Compiled Code)
              at java.lang.RuntimeException.<init>(Compiled Code)
              at weblogic.utils.NestedRuntimeException.<init>(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getParameter(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.initSessionInfo(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getSession(Compiled Code)
              at SGBA.servlets.HelloWorldServlet.doPost(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
              at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)
              I hope all this information can help you making an idea of our problem. We will be looking forward to receiving your answer.
              Thanks in advance,
              Frankie Carrero.
              

              Hello,
              We have developed a client that connects to servlets in WebLogic 4.5.1. Some of the servlets use sessions to store data, and they receive some parameters from the client to retrieve information from a database.
              When we use WebLogic 4.5.1, everything works fine. However, when we upgrade it to Service Pack 11, we find a problem. If we make a servlet that receives some parameters, but it does no use sessions, everything is correct. If we make a servlet that does not receive any parameter, and we use sessions, we find no problem either. But if we make a servlet that receives parameters and uses sessions within the doPost() method, there is an exception when we call the method Request.getSession(true).
              I would thank any help about this point, since I'm not sure if this is the result of a bug, or if there is a new parameter that we have to set in the file weblogic.properties, or any other reason.
              The code of our servlet is as simple as follows:
              public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
                   ObjectInputStream in = new ObjectInputStream(request.getInputStream());
                   String arg = null;
                   String arg2 = null;
                   String arg3 = null;
                   try{
                        arg = (String)in.readObject();
                        arg2 = (String)in.readObject();
                        arg3 = (String)in.readObject();
                   }catch(Exception e){
                   // Get the session and the counter param attribute
                   HttpSession session = request.getSession(true);
              // WE GET THE EXCEPTION AT THIS POINT.
                   Integer ival = (Integer) session.getValue("simplesession.counter");
                   if (ival == null)
                        // Initialize the counter
                        ival = new Integer(1);
                   else
                        // Increment the counter
                        ival = new Integer(ival.intValue() + 1);
                   // Set the new attribute value in the session
                   session.putValue("simplesession.counter", ival);
                   // Output data
                   ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream());
                   out.writeObject(ival);
                   out.close();
              On the other hand, the client invokes the serlvets using the following code:
              public int servletClient(String usuario,String password) {
                   int numero = 0;     
                   try{
                        // Input parameters
                        Serializable[] objs = {"login",usuario, password};
                        // Invokes the servlet
                        ObjectInputStream in = ServletWriter.postObjects(urlServlet, objs); // SEE BELOW...
                        // Get the results
                        numero = ((Integer)in.readObject()).intValue();
                        in.close();
                   }catch(Exception e){
                        e.printStackTrace();
              static public ObjectInputStream postObjects(URL servlet, Serializable objs[]) throws Exception
                        URLConnection con = servlet.openConnection();
                        con.setDoInput(true);
                        con.setDoOutput(true);
                        con.setUseCaches(false);
                        con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                        // Write the arguments as post data
                        ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
                        int numObjects = objs.length;
                        for (int x = 0; x < numObjects; x++) {
                             out.writeObject(objs[x]);
                        out.flush();
                        out.close();
                        return new ObjectInputStream( con.getInputStream() );
              // THE CLIENT CODE FINISHES HERE
              The exception we get is the following:
              Mon Feb 21 13:47:41 GMT-02:00 2000:<E> <ServletContext-Servlets> Servlet failed with RuntimeException
              Mon Feb 21 13:47:41 GMT-02:00 2000:<E> <ServletContext-Servlets> java.io.IOException: Unexpected end of POST data. Read 0 bytes. Content-length = 20
              at java.lang.Throwable.<init>(Compiled Code)
              at java.lang.Exception.<init>(Compiled Code)
              at java.io.IOException.<init>(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getParameter(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.initSessionInfo(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getSession(Compiled Code)
              at SGBA.servlets.HelloWorldServlet.doPost(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
              at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)
              --------------- nested within: ------------------
              weblogic.utils.NestedRuntimeException: cannot parse POST parameters of request /HelloWorldServlet
              - with nested exception:
              [java.io.IOException: Unexpected end of POST data. Read 0 bytes. Content-length = 20]
              at java.lang.Throwable.<init>(Compiled Code)
              at java.lang.Exception.<init>(Compiled Code)
              at java.lang.RuntimeException.<init>(Compiled Code)
              at weblogic.utils.NestedRuntimeException.<init>(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getParameter(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.initSessionInfo(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getSession(Compiled Code)
              at SGBA.servlets.HelloWorldServlet.doPost(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
              at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)
              I hope all this information can help you making an idea of our problem. We will be looking forward to receiving your answer.
              Thanks in advance,
              Frankie Carrero.
              

  • Problem with Servlet that generates HTML

    Hello,
    I have a servlet that connects to a database to get some information which it displays in a HTML file generated by the same servlet.
    For each line that I want to display from the Database I create the following in my servlet:
    <input type="hidden" value="Ajax-Chelsea" name="bet_1_choice"/>
    However, when I test it in Tomcat it doesn't work, and I realised in Firefox that it gets the above line as follows with the bold part added:
    <input type="hidden" )="" value="Ajax-Chelsea" name="bet_1_choice"/>
    I also use a javascript to add the DB information in another area of the HTML page, another table, but I don't know if this is relevant.
    I don't understand what is wrong. Can someone help me please?

    Thanks for your responses.
    Actually the problem was my javascript. Now it is sorted out.

  • Problems with servlets and packages

    "im trying to use a package called C:\Acme which includes a GifEncoder C:\Acme\JPM\Encoders the problem is that weblogic 6.1 doesnt seem to find it, this is the error i get in the console
              <Dec 8, 2001 2:46:20 PM PST> <Error> <HTTP> <[WebAppServletContext(1074531,learning,/learning)] Se
              rvlet failed with ServletException
              javax.servlet.ServletException: Servlet class: 'HelloWorldGraphics' could not be resolved - a clas
              s upon which this class depends wasn't found
              at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:600)
              at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:368)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:
              2456)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              and i have included the following in the classpath, in the path and in the .cmd file that starts weblogic
              C:\Acme;C:\Acme\JPM\Encoders;C:\Acme\JPM;C:\bea\
              

    See if there's an Acme.jar - if so, add that to your classpath...
              Hope this helps
              Rob
              "isaac" <[email protected]> wrote in message
              news:[email protected]...
              > "im trying to use a package called C:\Acme which includes a GifEncoder
              C:\Acme\JPM\Encoders the problem is that weblogic 6.1 doesnt seem to find
              it, this is the error i get in the console
              >
              > <Dec 8, 2001 2:46:20 PM PST> <Error> <HTTP>
              <[WebAppServletContext(1074531,learning,/learning)] Se
              > rvlet failed with ServletException
              > javax.servlet.ServletException: Servlet class: 'HelloWorldGraphics' could
              not be resolved - a clas
              > s upon which this class depends wasn't found
              > at
              weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.jav
              a:600)
              > at
              weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:36
              8)
              > at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :242)
              > at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :200)
              > at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
              ntext.java:
              > 2456)
              > at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
              :2039)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              > >
              >
              > and i have included the following in the classpath, in the path and in the
              .cmd file that starts weblogic
              >
              > C:\Acme;C:\Acme\JPM\Encoders;C:\Acme\JPM;C:\bea\
              

  • Problem with servlet call within servlet

    I have already a servlet that generates a jpeg images that works fine.
    a second servlet generates an pdf document via the iText library and works also fine.
    the problem or question is how to call the first servlet to insert an
    image into the generated pdf??
    tia
    marky

    Have a look to HttpURLConnection object (in java.net package). A example of the code :
    URL url = "http://myServer/myJpegServlet";
    HttpURLConnection uc = (HttpURLConnection) url.openConnection();
    uc.setDoInput(true);
    uc.setUseCaches(false);
    uc.setAllowUserInteraction(false);
    InputStream dataIn = uc.getInputStream();
    byte[] buf = new byte[512];
    while( (dataIn.read(buf)) != -1 ) {
    //Do what you want with the data
    datain.close();
    uc.close;
    Hope this helps!
    Simon Pierre NOLIN

  • Urgent : Problem with Servlet Filters in Weblogic6.1

    Hi,
    We have developed an application using Tomcat4.1.24 with Weblogic6.1 Service Pack2.
    Now we are removing the Tomcat and moving the web layer into weblogic. We have implemented Servlet Filters and Listeners.
    When I converted .jar and .war files into .ear file and deployed into Weblogic6.1. But that application is not deploying. I found that Weblogic6.1 does not support Filters and Listeners from Servlet2.3.
    When I tried to deploy in the Weblogic6.1, it is giving the error as " java.lang.reflect.UndeclaredThrowableException".
    Could somebody please give me a solution how my filters and listeners can make working with weblogic6.1.
    Is there any solution.. My application is successfully working with Weblogic8.1. But I want the solution in weblogic6.1. It would be great if somebody can give me solution how to make Filters n Listeners working with Weblogic6.1.
    Thanks in advance.

    Hi Prasanna,
    Thank you for the timely reply.
    I have already done according to the process given in the url which u have given me.
    set and getFilterConfig methods are implemented in my AuthenticationFilter class. But still I could not be able deploy the application and I am not able to get the ServletContext object from Session. When I tried commenting the Filters and Listeners in my web.xml file then my .ear file was successfully deployed but I could not get the ServletContext from Session.
    Below code is from my web.xml:
    <filter>
    <filter-name>HRSuthenticationFilter</filter-name>
    <filter-class>com.peramb.hrs.servlet.AuthenticationFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>HRSAuthenticationFilter</filter-name>
    <url-pattern>/jsp/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>HRSAuthenticationFilter</filter-name>
    <servlet-name>action</servlet-name>
    </filter-mapping>
    <listener>
    <listener-class>com.peramb.hrs.servlet.HRSContextListener</listener-class>
    </listener>
    When I comment the above code from web.xml it is deploying with out errors.. but I am not getting the servlet context, hence my application is not working.
    When tried uncommenting the listerns part or Filters part or bothe, My application is deploying with an error on the console. I.e,
    “<Sep 22, 2005 12:20:36 PM IST> <Error> <Management> <Error deploying application
    .\config\mydomain\applications\hrsgb.ear: java.lang.reflect.UndeclaredThrowable
    Exception>”.
    And the error in Weblogic logs is below:
    ####<Sep 22, 2005 12:20:36 PM IST> <Info> <HTTP> <spacker> <myserver> <ExecuteThread: '0' for queue: '__weblogic_admin_html_queue'> <system> <> <101047> <[WebAppServletContext(6387482,hrsgb,/hrsgb)] registering JSPServlet with initArgs '[JspConfig: verbose=true,packagePrefix=jsp_servlet,-compiler=javac,compileFlags=,workingDir=E:\bea\wlserver6.1\config\mydomain\applications\.wlnotdelete\wlap36546\WEB-INF\_tmp_war_mydomain_myserver_hrsgb,pageCheckSeconds=1,superclass=weblogic.servlet.jsp.JspBase,keepgenerated=false,precompileContinue=false,compilerSupportsEncoding=true,encoding=null,defaultfilename=index.jsp,compilerclass=null,noTryBlocks=false]'>
    ####<Sep 22, 2005 12:20:36 PM IST> <Debug> <HTTP> < spacker > <myserver> <ExecuteThread: '0' for queue: '__weblogic_admin_html_queue'> <system> <> <101158> <Exception thrown while loading hrsgb: java.lang.SecurityException: sealing violation>
    java.lang.SecurityException: sealing violation
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:229)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:51)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
    at weblogic.servlet.internal.WebAppServletContext.registerEventListener(WebAppServletContext.java:2031)
    at weblogic.servlet.internal.WebAppServletContext.initFromDescriptors(WebAppServletContext.java:1471)
    at weblogic.servlet.internal.WebAppServletContext.init(WebAppServletContext.java:943)
    at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:878)
    at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:515)
    at weblogic.j2ee.WebAppComponent.deploy(WebAppComponent.java:77)
    at weblogic.j2ee.Application.addComponent(Application.java:176)
    at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:117)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:364)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:150)
    at weblogic.management.mbeans.custom.WebServer.addWebDeployment(WebServer.java:76)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:374)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy37.addWebDeployment(Unknown Source)
    at weblogic.management.configuration.WebServerMBean_CachingStub.addWebDeployment(WebServerMBean_CachingStub.java:1337)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:350)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:150)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:374)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBeans(ConfigurationMBeanImpl.java:507)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:376)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.DynamicMBeanImpl.addDeployment(DynamicMBeanImpl.java:997)
    at weblogic.management.internal.DynamicMBeanImpl.addDeployment(DynamicMBeanImpl.java:984)
    at weblogic.management.internal.DynamicMBeanImpl.add(DynamicMBeanImpl.java:969)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:648)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:374)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy88.addTarget(Unknown Source)
    at weblogic.management.mbeans.custom.ApplicationManager.autoDeploy(ApplicationManager.java:930)
    at weblogic.management.mbeans.custom.ApplicationManager.addApplication(ApplicationManager.java:1039)
    at weblogic.management.mbeans.custom.ApplicationManager.addApplication(ApplicationManager.java:954)
    at weblogic.management.mbeans.custom.ApplicationManager.poll(ApplicationManager.java:851)
    at weblogic.management.mbeans.custom.ApplicationManager.poll(ApplicationManager.java:781)
    at weblogic.management.mbeans.custom.ApplicationManager.update(ApplicationManager.java:210)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:374)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy5.update(Unknown Source)
    at weblogic.management.console.webapp._domain.__upload_app._jspService(__upload_app.java:150)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:284)
    at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:119)
    at weblogic.management.console.actions.ForwardAction.perform(ForwardAction.java:35)
    at weblogic.management.console.actions.internal.ActionServlet.doAction(ActionServlet.java:171)
    at weblogic.management.console.actions.internal.ActionServlet.doPost(ActionServlet.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:616)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2678)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2412)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:140)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:121)
    ####<Sep 22, 2005 12:20:36 PM IST> <Error> <J2EE> < spacker> <myserver> <ExecuteThread: '0' for queue: '__weblogic_admin_html_queue'> <system> <> <160001> <Error deploying application hrsgb: Could not load hrsgb>
    ####<Sep 22, 2005 12:20:36 PM IST> <Error> <Management> < spacker> <myserver> <ExecuteThread: '0' for queue: '__weblogic_admin_html_queue'> <system> <> <141042> <Error deploying application .\config\mydomain\applications\hrsgb.ear: java.lang.reflect.UndeclaredThrowableException>
    I could not trace the problem. Please help me with some solution for the above problem

  • Problem with Servlet Tutorial

    I am going through the servlet tutorial with a specific end in mind. I found a section that I think relates exactly to what I want to do. I want to have servlet redirect the user to another URL. The following code is given as an example.
    public class Dispatcher extends HttpServlet {     
       public void doGet(HttpServletRequest request,      
          HttpServletResponse response) {     
          request.setAttribute("selectedScreen",     
             request.getServletPath());     
          RequestDispatcher dispatcher = request.     
             getRequestDispatcher("/template.jsp");     
          if (dispatcher != null)     
             dispatcher.forward(request, response);     
       public void doPost(HttpServletRequest request,      
    }The problem is that I can't compile this. There is no HttpServletRequest.getRequestDispatcher(String) method. Am I misssing something here? Am I even on the right track?

    An extract from one of my servlets that redirects to
    another URL is
    this:response.sendRedirect(response.encodeRedirec
    URL("NoLogon"));But it appears you want to
    forward, rather than redirect. There's a difference,
    but I don't exactly know what it is. The forwarding
    example in my servlets book looks like
    this:RequestDispatcher dispatcher =
    getServletContext().getRequestDispatcher(address);
    dispatcher.forward(request, response);
    I tried pasting your first example into my code and got the follwoing error:
    Method encodeDirectURL(java.lang.String) not found in interface javax.servlet.ServletResponse
    It seems like there is still something missing here. When I look at the API I only see four methods for this class.

  • Problems with Servlet  to JSP communication please help!!!

    Hello All ,
    we have different web applications running
    e.g.
    We have 2 webApp named A and B are running and there URL are
    http://localhost:8080/A and
    http://localhost:8080/B
    and we have one common WebApp running at
    http://localhost:8080/common
    Our problem is that whenever a user log in to the system he/she will first call the
    common URL and then enter his user name and password
    and depending on his username we have redirect user to either A or B with his pasword and username as parameter to the request.
    i.e. in common module whenever i get userName and password we call a Servlet to authenticate the user and to detemine which webapp to forward to..
    i have to call jsp accordingly from servlet in common webApp to JSP in different webapp.
    I m wonderning how it is possilble.
    As
    i don't know how to call another webApp using
    RequestDispatcher.forward () method and
    also
    i am not able to set paramters with the request whenever i user response.sendRedirect() method
    I am wondering what could be the way to pass paramer to the request from servlet in one webApp to JSP in another webApp
    Please help its urgent!!!
    thankx in advance

    forward() can't call another webapp.
    There are several ways you could do this.
    1) Share the session object across both webapps and set something as an attribute of the session.
    2) Use a database or file storage to record the transaction, then go to the second webapp, which picks up that info.

Maybe you are looking for

  • To show Local Currency row total in FC documents

    Hi All is there any possible to show LC row total on the screen when I enter a FC document in SAP B1? Thanks in advance. Regards, Catea k Edited by: Catea k on Aug 31, 2010 6:55 AM

  • Balance sheet evaluation

    Dear All, 1) May I know balance sheet evaluation monthly activity will be reversed whereas year end will not be reversed? The practice is just like F101 balance sheet evaluation on open item? 2) Also the balance sheet currency only in local currency

  • I need to know how i sync my iphone 4s with itunes when i already have my ipod touch synced to it??

    my ipod touch is already synced to my itunes. i want to sync my iphone 4s. when i plug it in it says there is already an ios device synced to this computer, do you want to 1. set up as new phone or 2. restore from the back up of my ipod....what do i

  • Can't record sound on HP Pavilion Elite HPE

    I have Windows 7 installed and am trying to get Dragon Premium to work on my computer.   Unfortunately, I've tried two different mikes and neither can record on my system.   I've gone through all the standard troubleshooting for sound recording.  The

  • Here's another one for ya......

    New Mother Board = 848P Neo (MS-6788 v1.x ATX) New CPU =  P4 2.8 Ghz 533Mhz New Memory = Infineon DDram400 256 New APG Card = Ati All-in-wonder Pro 9800 Problem = Power on to standby mode with the fan running and the d-Bracket with left side red, rig