Servlet API
I believe the servlet APIs are outdated in the Oracle 9i AS Portal 3.0.7 distribution, i.e. Servlet 2.0 API. Can anyone confirm or deny this? An application that runs on a 2.1 Servlet API bombs on 9i with the following error:
[18/01/2001 13:47:11:490 CST] java.lang.NoSuchMethodError: javax.servlet.ServletContext: method getRequestDispatcher(Ljava/lang/String;)Ljavax/servlet/RequestDispatcher; not found
at com.agrifusion.cart.Cart.doPost(Cart.java:91)
at com.agrifusion.cart.Cart.doGet(Cart.java:46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java)
at org.apache.jserv.JServConnection.run(JServConnection.java)
at java.lang.Thread.run(Thread.java:479)
The method getRequestDispatcher() was added in the 2.1 Servlet APIs.
Any suggestions? When commenting out the wrapper.classpath=d:\iSuites\Apache\Jsdk\lib\jsdk.jar line and inserting a 2.1 Servlet API the app still fails, same error. Is the API bundled in another jar file?
Still investigating myself, if anyone has run upon error please post a solution.
Thanks,
Jason
Jason,
Are you trying to develop a portlet? If so, please direct your question to the Portal Development Kit forum.
If this is a general question about iAS servlets, we hope to have an iAS forum available by the end of January. In the meantime, I'll request that someone from iAS product management respond to your question.
Regards,
Jerry
Similar Messages
-
I need to install servlet-api.jar in the libext folder.
Hi I am doing a tutorial on struts 2.0.11.
i need to install servlet-api.jar in the libext folder which I have created inside WEB-INF
Now I have downloaded servlet.api which is in the zip form.
When I extract the files. Its giving me two folders
1. javax
2. META-INF
Inside javax there is a folder called servlet. Inside servlet folder there are
a) bunch of call files
b) http folder
c) resources folder
Inside http folder there are
a) class files
b) properties files
Inside the resources folder there are
a) dtd files
b) xsd files
Inside the META-INF folder there is the manifest.mf file
I just need servlet-api.jar
I think that I have extracted the contents of servlet-api.jar by using the extract feature of winzip.
Do you think that by just changing the extension of the file from servlet-api.zip to servlet-api.jar it will do the trick or do i need to do something else.
Please guidepksingh79 wrote:
Hi ^^,
your replies were very helpful. I did try to check the lib folder of the webserver and there was not servlet-api.jar. However I downloaded a dummy project and it did have servlet-api.jar in it, so I am ok for now.
thanks and regards,
PrashantYou should not be doing that. Always use the one from the application server which you're going to use. Otherwise you will possibly get in runtime trouble due to version differences.
The actual location and filename of the servlet API might differ per application server implementation. If it was for example Tomcat 6, it is the servlet-api.jar in the /lib directory. If it was for example Glassfish (the current release), then it is the javaee.jar in the /lib directory. -
How to insert the new Servlet Api Class files?
Hi,
I need to know how do I add the Servlet Api Class to my java directory
after i download it from the net? Thanks for your help in advance!niceguyme,
If you downloaded the J2EE 1.3.1 API and installed it to (for example) c:\j2ee131, then what you need to add to your class path is:
c:\j2ee131\lib\j2ee.jar
I also add c:\j2ee131\lib\ejb10deployment.jar to the classpath, but it is not necessary.
there are several ways to add these to your classpath. It depends on what Operating System you are using. On windows 98 type OS, you can edit the autoexec.bat and add these directly to your already existing classpath. Windows NT,2000, and XP: you can add them to the system environment variables classpath. Hopefully you know how to do this on your machine. What I like to do on the windows machine is create a batch file that will start it from within a command prompt. I do this because there are times when I need to compile my code using different versions of the Java api. I am enclosing an example of one for J2se1.4.1 and j2ee1.3.1.
contents of java141.bat
@ECHO OFF
ECHO JDK 1.4.1 and J2EE 1.3.1 are current versions
set HOLD_CP = %CLASSPATH%
set HOLD_PATH = %PATH%
set CLASSPATH=.
set CLASSPATH=%CLASSPATH%;e:\jdk14\jre\lib\rt.jar
set CLASSPATH=%CLASSPATH%;e:\jdk14\lib\dt.jar
set CLASSPATH=%CLASSPATH%;e:\jdk14\lib\tools.jar
set CLASSPATH=%CLASSPATH%;e:\jdk14\lib\htmlconverter.jar
rem **** J2EE STUFF ****
set CLASSPATH=%CLASSPATH%;e:\j2ee131\lib\j2ee.jar
set CLASSPATH=%CLASSPATH%;e:\j2ee131\lib\ejb10deployment.jar
set CLASSPATH=%CLASSPATH%;%HOLD_CP%
set PATH=e:\jdk14\bin
set PATH=%PATH%;"C:\Program Files\TextPad 4"
set PATH=%PATH%;c:\windows\command
set PATH=%PATH%;%HOLD_PATH%I hope this helps.
TJJ -
IllegalStateException: strict servlet API: cannot call getWriter()
I am getting an exception in Weblogic when I am trying to display a pdf file in a web page.
java.lang.IllegalStateException: strict servlet API: cannot call getWriter() after getOutputStream()
I am using the following code code
ByteArrayOutputStream baos;
ServletOutputStream out = response.getOutputStream();
baos.writeTo(out);
I have seen this error in so many discussion forum and there is no proper solution for this error.
I am able to see the pdf page even with this exception. But I want to get rid of this exception also from Weblogic.I just did a quick (and dirty!) test with the following to display a jpg image and it worked for me without any trace of an exception:
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("image/jpg");
File f = new File("/Users/me/Desktop/IMG_0032.JPG");
byte[] bits = new byte[(int) f.length()];
FileInputStream fos = new FileInputStream(f);
fos.read(bits);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(bits, 0, bits.length);
baos.writeTo(response.getOutputStream());
baos.close();
fos.close();
}Note that there is no call anywhere to response.getWriter() in that.
I'd guess the exception is directing you at what the problem is, at least as the server is seeing it -- somewhere in the execution of the request path there would appear to be call to response.getWriter() occurring after a call to response.getOutputStream() has been called, which is not permitted on WLS according to the error message.
Do you use filters on this app? If response.getWriter() has been called on the same response object in a post request filter phase, that would be on the same call path with the same response object and would result in the exception.
-steve- -
I can't compile servlet code because it doesn't recognize the http... classes.
I downloaded the servlet api but don't know what to do with it (unziped it but no installation!)
please helpI can't compile servlet code because it doesn't
recognize the http... classes.
I downloaded the servlet api but don't know what to do
with it (unziped it but no installation!)
please helpI am having the same problem... i am running windows 95 (unfortunately) and have installed the jsdk1.3.
These are my autoexec.bat entries
SET PATH=c:\jdk1.3\bin
SET JAVA_HOME=C:\jdk1.3
set classpath=c:\jdk1.3\lib;c:\jdk1.3\jre\lib\ext\servlet.jar%classpath%
I am still not able to compile a servlet program though.
Any ideas?
Much appreciated!!!!
-Charlie -
Setting session timeout in servlet API 2.0 - based JSP (Apache/JServ)
I'm using Apache/JServ (servlet API 2.0) to run JSPs. At present, a session becomes invalid after 30 minutes of inactivity. How can I increase or decrease this time?
Thanks.You can set by using this command in JSP or servlet
session.setMaxInactiveInterval(1800);
replace 1800 (this is in seconds) with the number you want
Suresh -
SAP Netweaver 7 - Supported Servlet API version?
For SAP Netweaver 7 platform, please let me know the supported Servlet API version?
Specifically, is Servlet API 2.4 supported?Hi,
It isn't supported by 7.0, the version of 7.0 is 2.3 (JEE 3)
Best regards -
Strict servlet API: cannot call getOutputStream() after getWriter()
i have an applet which will communicate with a servet , but got following error in the servlet
java.lang.IllegalStateException: strict servlet API: cannot call getOutputStream() after getWriter()
at weblogic.servlet.internal.ServletResponseImpl.getOutputStream(ServletResponseImpl.java:280)
at oracle.osl.lt.web.servlets.AudioServlet._processGetPlayList(AudioServlet.java:235)
at oracle.osl.lt.web.servlets.AudioServlet.doPost(AudioServlet.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.wls.filter.SSOSessionSynchronizationFilter.doFilter(SSOSessionSynchronizationFilter.java:276)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
SUBSYSTEM = HTTP USERID = <WLS Kernel> SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)' MSGID = BEA-101020 MACHINE = p1dvosl02 TXID = CONTEXTID = TIMESTAMP = 1318836952580
WatchAlarmType: AutomaticReset
WatchAlarmResetPeriod: 30000
>
*below _processGetPlayList() is called by doPost() of the servlet.*
seems the exception is thrown due to response.getOutputStream()?
any idea? thanks!!
private void _processGetPlayList(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
try {
ObjectOutputStream objectOut =
new ObjectOutputStream(new BufferedOutputStream(response.getOutputStream()));
try {
RichDataDTOExt richData = _getRichData(request);
if (richData == null) {
Log.web().debug(s7);
throw new ServletException(s7);
objectOut.writeObject(richData.getAudioRecordings().getAll(new ContentRefDTO[0]));
finally {
objectOut.close();
catch (IOException e) {
Log.web().error(e.getMessage());
throw new ServletException();
}thanks for you reply. but seems we don't call getWriter() at all in our code.
actually this error only happen in our customer's env, no this issue in our development env.
besides using getOutputStream() and getWriter() simultaneously for same response, is this maybe related with some web server configuration? -
Once i set classpath to servlet-api.jar, it doesnt Instantiate DbBean.
I am using notepad editor. I am trying to instantiate a DbBean class inside the servlet's init() method.
once i set (C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar) this path to compile the Controller servlet.
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF\classes>set classpath=C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF\classes>javac Controller.java
Controller.java:5: package bean does not exist
import bean.DbBean;
^
Controller.java:14: cannot find symbol
symbol : class DbBean
location: class Controller
DbBean dbbean = new DbBean();
^
Controller.java:14: cannot find symbol
symbol : class DbBean
location: class Controller
DbBean dbbean = new DbBean();
^
3 errors
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF\classes>
this is my servlet
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import bean.DbBean;
public class Controller extends HttpServlet
public void init(ServletConfig config)throws ServletException
ServletContext context = config.getServletContext();
context.setAttribute("base_url",config.getInitParameter("base_url"));
{color:#ff0000}DbBean dbbean = new DbBean();{color} {color:#0000ff}error showing in this line
{color}dbbean.setDburl(config.getInitParameter("dburl"));
dbbean.setUserName(config.getInitParameter("username"));
dbbean.setPassward(config.getInitParameter("pwd"));
/// database bean can be access from jsp page
context.setAttribute("dbbean",dbbean);
/// Load the data base driver
try{
Class.forName(config.getInitParameter("jdbcDriver"));
catch(ClassNotFoundException e)
System.out.println(e.toString());
super.init(config);
public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException,IOException
doPost(req,res);
public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException,IOException
String base = "/onlinetest1/";
String url = base + "login.jsp";
String action = req.getParameter("action");
if(action!=null)
if(action.equals("successlogin.jsp"));
url = base + "successlogin.jsp";
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
dispatcher.forward(req,res);
public void destroy()
System.out.println("Servlet stopped");
This below class can be put inside bean folder( (ie)sub dir of controller servlet)
package bean;
import java.sql.*;
import java.util.*;
import java.io.*;
public class DbBean
String dburl="";
String dbuser="";
String dbpass="";
public void setDburl(String url)
dburl = url;
public void setUserName(String uname)
dbuser = uname;
public void setPassward(String pwd)
dbpass = pwd;
What to do to rectify this, please help me why this error coming,hi,
Actually i did my ordinary package compilation example below, its run correctly, but after set classpath to %tomcat-home%\common\lib\servlet-api.jar(for same programs its not working) this kinds of error coming.
F:\shyam\test>javac first.java
F:\shyam\test>java first
main class
DB Set Correctly
F:\shyam\test>set classpath=C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar
F:\shyam\test>javac first.java
first.java:1: package bean does not exist
import bean.DbBean;
^
first.java:10: cannot find symbol
symbol : class DbBean
location: class first
DbBean dbbean = new DbBean();
^
first.java:10: cannot find symbol
symbol : class DbBean
location: class first
DbBean dbbean = new DbBean();
^
3 errors
F:\shyam\test>
In compilation it wont take DbBean class, please help me.
thanks in advance,
S.Shyam -
I would like to download a copy of Servlet API 2.4 class files. I know that Servlet API 2.4 is part of the J2EE 1.4 download, but I really don't want (or need) the entire J2EE. So far, all I've been able to do is download the specification.
There is a link to download Servlet API 2.3 class files, which I am currently using with NetBeans 4.1. I would like to add v2.4 to my NetBeans library.
Does a link exist to download the Servlet API 2.4 class files and dox? If so, where can I find it? Any help would be appreciated.Hi Martin,
Ivo is right. Web AS 6.40 is J2EE 1.3 compliant and implements Servlet 2.3 specification. In Servlet 2.3 API its not explicitly said that the contextInitialized() method in ServletContextListener interface should be called before any servlet or filter is initialized. In this release the ServletContextListeners are notified of context initialization after servlet and filter initialization and thus informing them that web application is ready to process requests.
Unfortunately there is no workaround as it is implementation dependent, and of course of reasons for backwards compatibility such changes could not be done.
What concerns your second question is that the J2EE 1.4 (hence, servlet 2.4 API) support is planned for the next release of the Web AS. In that release the contextInitialized event will be thrown before any servlet or filter is initialized.
Regards,
Diyan -
How to find the servlet API version
hi
can u please help me to find out servlet API version?
Thanks.can u please help me to find out servlet API
API version?Look at the documentation, it usually features the version number. -
Strict servlet API: cannot call getWriter() after getOutputStream()
Hi,
Am getting below exception when i click on create report button.
It was successfully running in development machine, when we deploy the same application into the testing server.
what could be problem..
am using JSF 2.0, Primefaces 3.5, Jdeveloper and Weblogic 12 C server..
java.lang.IllegalStateException: strict servlet API: cannot call getWriter() after getOutputStream()
at weblogic.servlet.internal.ServletResponseImpl.getWriter(ServletResponseImpl.java:299)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:362)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:155)Issue resolved, because testing machine doesn't have specified font in font directory.
recompiled the jrxml file with arial font its working both the env machine.. -
IllegalStateException: strict servlet API:
Hello All,
I'm trying to do a simple rpc webservice. The wsgen process runs to a successful
completion and I deploy the result to Weblogic 6.1 sp1, which is also successful.
When accessing this new service, everything runs fine until the response is generated
and I get following stack trace:
<br>
java.lang.IllegalStateException: strict servlet API: cannot call getWriter() after
getOutputStream() <br>
at weblogic.servlet.internal.ServletResponseImpl.getWriter(ServletResponseImpl.java:160)
<br>
at weblogic.soap.server.servlet.StatelessBeanAdapter.reportFault(StatelessBeanAdapter.java:238)
<br>
etc...
It would appear that this is being generated in a Weblogic class. There is no
mention of my EJB in the stack trace.
Has anyone seen this error? Or, better yet, what causes it and what is the solution?
Thanks,
KrisKris,
I too have run into this problem with Weblogic 6.1. The first time I
got this exception was when I had java.util.Date attributes within my
serializable data object that I was returning from my WebService interface.
When those date attributes were set with values, I would get the exception
outlined below. Then I set those date values to null, and everything worked
fine.
Coincidentally, I'm currently have the same problem with a serializable
object that has another serializable object defined as an attribute. I'm
not wondering if Weblogic can't handle Serializable objects within other
Serializable objects?
I guess my suggestion would be to look at the values you are returning
and passing in as parameters to your WebService interface, are there any
Serializable objects that have other Serializable objects defined as
attributes ( Strings don't count )? If so, set them to null and try your
WebService again. ( Does that make sense?? )
Hope this helps?
Jeff
"Kris W. Keener" <[email protected]> wrote in message
news:3bd71794$[email protected]..
>
Hello All,
I'm trying to do a simple rpc webservice. The wsgen process runs to asuccessful
completion and I deploy the result to Weblogic 6.1 sp1, which is alsosuccessful.
When accessing this new service, everything runs fine until the responseis generated
and I get following stack trace:
<br>
java.lang.IllegalStateException: strict servlet API: cannot callgetWriter() after
getOutputStream() <br>
atweblogic.servlet.internal.ServletResponseImpl.getWriter(ServletResponseImpl.
java:160)
<br>
atweblogic.soap.server.servlet.StatelessBeanAdapter.reportFault(StatelessBeanA
dapter.java:238)
<br>
etc...
It would appear that this is being generated in a Weblogic class. There isno
mention of my EJB in the stack trace.
Has anyone seen this error? Or, better yet, what causes it and what is thesolution?
>
Thanks,
Kris -
How do I install the servlet api?
The servlet api gets installed with any web server that you install. For example if you are installing Jeeves(Java Web Server) you will find a file called servlet.jar which contains all the servlet classes. The path is ./JavaWebServer2.0/lib/servlet.jar.
Hope that helps.
Regards
Jaydeep -
Can someone tell me which Servlet API Specification
is supported in JDeveloper 3.1?
2.0, 2.1, or 2.2?
Thanks a lot,
Raymond<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by John - JDeveloper Team:
You can determine this easily by adding
the following lines of code to your
Servlet's doGet() method.
Add...
ServletContext sc = this.getServletConfig().getServletContext();
out.println( "Servlet Engine Version is " +
sc.getMajorVersion() + "." + sc.getMinorVersion() );
This is ofcourse the runtime server environment's version, you can still develop
servlets for other versions, but can not
rely on the new features when running and
debugging in JDeveloper.
However, the real need is for the target
host.
But to answer your question directly,
On JDeveloper 3.1, when I run a servlet
containing the above code,
I see the result:
Servlet Engine Version is 2.1
John - JDeveloper Team<HR></BLOCKQUOTE>
Thanks for your informaiton!
Maybe you are looking for
-
Should I delete iPhoto now that I've updated the OS and have Photos?
I opened Photos and it seemed to import a lot of photographs, but did it take everything from iPhoto?
-
Final Cut Pro Randomly Shutting off after Minutes
Every time I open FCPX and begin editing it randomly shuts off after about 3-4 minutes. Regardless of what I am doing. I get no wheel or anything, it just shuts off clean. I am running the most recent update to Lion, FCPX 10.1 with 8GB of ram... this
-
Sun Java Comm Suite - Need Clarification of Licensing
Now that Sun has stripped out the email services from JES 5 and thrown them into another product, must I now pay to USE Sun Java Communication Suite or is the "licensing" strictly for support? I must be a blithering idiot because for the life of me I
-
Output_link and Page Navigation
Is it possible to use output_link with JSP Page Navigation Model? At first sight, the answer is no. The value attribute is mandatory and rendered into href attribute. So, I have to point to the next page directly, bypassing the Page Navigation Defini
-
I was having probems with updating my Ipod Classic, I decided to restore the iPod and now when I try to add everything back on it is only averaging about 650 tracks then I get the following message: 'Attempting to copy to the disk.....failed. An unkn