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!

Similar Messages

  • 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

  • Problems with drill filters

    Post Author: srinath
    CA Forum: Publishing
    In BO XI, I am facing problems with drill filters. I have a report with eight tabs and each tab has data corresponding to a particular value in the drill filter. A particular value is selected from the drill filter and the corresponding data is displayed in each tab. I need to select a value from the drill filter and display the corresponding data in the tab; while doing so when i save the report and open it again, the data corresponding to the particular filter value is not present instead it displays all the data. The only other way i could solve this problem was by creating a report level filter in each tab but this doesnt seem to work in other reports. What is the proper way of using the drill filter in this case?

    How did you configure the filter?

  • 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

  • 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.

  • JSF page goes blank  when using with servlet filters...

    Hi there,
    I have a JSF page, which shows up fine (in both IE and Firefox) in normal scenarios.
    But as soon as I apply servlet filters onto the faces extension, I get into trouble. So after setting up the filters, when I load the same page(s) in each of the browsers, the filters run fine in the background, but the page comes up blank (in both IE and FF).
    Happening only with JSF / Faces pages.
    Once I removed the filter mapping, the page loads up just fine.
    Would appreciate any feedback on this. TIA!

    More info on the original post...
    Platforms:
    Tomcat 5.5.15
    JSF/Faces - Sun RI 1.2
    Servlet Spec: 2.4
    Portion of the Web.xml code (after applying the filters onto the faces components):
       <listener>
          <listener-class>
             com.sun.faces.config.ConfigureListener
          </listener-class>
       </listener>
       <servlet>
          <servlet-name>Faces Servlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>*.faces</url-pattern>
       </servlet-mapping>
       <filter>
          <filter-name>PreProcessFilter</filter-name>
          <filter-class>.....view.util.PreProcessFilter</filter-class>
       </filter>
       <filter-mapping>
          <filter-name>PreProcessFilter</filter-name>
          <url-pattern>*.html</url-pattern>
       </filter-mapping>
       <filter-mapping>
          <filter-name>PreProcessFilter</filter-name>
          <url-pattern>*.jsp</url-pattern>
       </filter-mapping>
       <filter-mapping>
          <filter-name>PreProcessFilter</filter-name>
          <url-pattern>*.faces</url-pattern>
       </filter-mapping> Thanks for your time!

  • 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)
    =/

  • Problem with Blur filters in effects browser

    Has anyone had a problem with the blur filters? Whenever I try to skim or apply any blur effect it freezes the viewer. Other effects are fine. Other functions of FCPX still work ok. The audio is ok, skimming works etc but the viewer is frozen. FCP then hangs on shutdown and requires a force quit, but relaunches fine. I have trashed FCPX permissions, repaired permissions for the OS, repaired the HD and redownloaded the application all to no avail. I also have FCPX installed on another startup drive and it does the same thing there. My computer is an iMAC 27 inch I7 with 4 gigs of RAM runing 10.6.8. FCPX is version 10.0.3.
    I did open a copy of the zoom blur effect in Motion and the only unusual thing I noticed was that there is a project loop end marker set at frame 1 of the project. Don't know if that is a factor. Any help greatly appreciated!

    I am refering to any of the blur category filters in the effects browser. I think there are like 6 of them sharpen, gaussian, prism, radial, and zoom. What happens is if I select a clip then go to the effects browser and scroll over the filters I will initially see a preview as you are supposed to. But very quickly that stops and if I go back to the timeline the viewer is frozen showing the previously selected clip. All the rest of FCP works normally ie you can scroll the timeline, select clips, use the tools etc. Only the viewer is frozen. You have to force quit FCP and restart to get back to normal. None of the other effects in effects browser cause any problems.
    I said in my first message all the things  I have tried unsuccessfully. This one is a real puzzler for me.

  • 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\
              

Maybe you are looking for

  • Flash sprite in Director: slow, slow!

    It's not a new problem but maybe there's a new solution?... I have a Flash game in a Director projector. The Flash games works fine by itself (not embedded in Director), but inside Director, everything runs much slower. Is there any ways to speed thi

  • Entourage 2008 + Exchange + Certificates

    This is regarding the compatibility with Exchange 2008, Entourage 2004/2008, and mainly the proper way to get a security certificate installed. I have done some research and found that you know that your cert is installed correctly if when you visit

  • Process overdue error

    Hi all, How to reslove the process overdue error and TRFC errors.Plz tell me Rgds Bharath

  • Multiple DB transaction

    Hi Weblogic 8.1sp2 I am planning to have multiple DB (A and B) updates in single transaction in Stateless bean. I know for this scenario i need to use XA drivers or 2phase commit. 1) Say if dont use either and insert to Database B fails. Will both in

  • Cannot connect to Internet neither Airport nor Ethernet

    Have tried many times to correct, do I have to reinstall or restore to factory settings? If so, how?  And will I lose all loaded applications and data?