My Servlet is Not Serving
I am trying to run my first Servlet. I am using the Apache Tomcat 4.0 server on Windows 98. When I try to run the Servlet in Netscape, I get a message saying "The requested resource (/myjsp/HelloServlet) is not available."
The Tomcat example Servlets work just fine. What's the deal?
an alternative route to place servlet is:
D:\jakarta-tomcat-X.X\webapps\ROOT\WEB-INF\MyServlet.class
and it is invoked in browser with:
http://localhost:8080/servlet/MyServlet
servlet must have metodo doGet
in case that servlet one is in a package in special is placed the file class in or the subdirectory
D:\jakarta-tomcat-X.X\webapps\ROOT\WEB-INF\paquete[\subpaqute]\MyServlet.class
corresponding. and it is invoked
http://localhost:8080/servlet/paquete[.subpaquete].MyServlet
EMECAS
Similar Messages
-
Javax.servlet does not exit
hello all,
i m new and have recently started using java, servlets, jsp with netbeans and Tomcat.
There are some servlet examples in Tomcat5.5\webapps\servlets-examples\WEB-INF\classes\...
Using the //localhost:8080/....... , i can easily get these servlets working in the browser.
When i opened one of the java file say: HelloWorldExample.java in Netbeans, there area lot of red circles with exclamation mark in it.
it says: "package javax.servlet does not exist"
in this line: import javax.servlet.*;
i am surprised why such errors are there and with such errors also the program runs...i want to get rid of such red circles and the error it is showing.
I have jdk1.6.0_10 , jre1.6.0_05 , Netbeans IDE 6.0.1 , Tomcat 5.5 installed in my Windows Vista OS
i have set my classpath as
.;C:\root\jakarta-tomcat-5.5.9\common\lib\servlet-api.jar;C:\root\jakarta-tomcat-5.5.9\common\lib\jsp-api.jar;
JAVA_HOME : C:\Program Files\Java\jdk1.6.0_10
any help is appreciated....
Thank you.
Edited by: kuchu on Jun 26, 2009 12:00 PMThe servlet API is included in the application server implementation which you're going to use (in this case Tomcat). You need to associate the application server with the Netbeans project. Check the project properties.
I cannot tell the detailed steps how to do it in Netbeans as I already uninstalled it after 5 minutes of trying some years ago, but in Eclipse you can select and add the application server during the 'create dynamic web project' wizard. It is smart enough to include the appserver's libraries in the project's build path. From what I heard and read about Netbeans is that it is also able to do so. -
Hi!
We need to implement authentication using our own methods, and the authentication
information is provided to the web service implementation in a basic authentication
header. The problem is, that the servlet
weblogic.webservice.server.servlet.WebServiceServlet, which handles web services
in
wls 7.0.sp2, always attempts to perform authentication, if the header is present.
Is there any way to circumvent this, because we want to implement authentication
on our own?
I already know two workarounds:
The best would of course be to implement a custom security realm for our own
authentication system. This is not an option, implementing an own security
realm is overkill for this specific web service.
The other way would be to route the requests by way of a custom servlet, which
would
remove the basic authentication header, and put the authentication info in custom
headers, such as x-auth: <user:password>, or smthng similar, and after successful
authentication, make a call to bea's servlet weblogic.webservice.server.servlet.WebServiceServlet.
But still, I'd like to know if there is any way to tell bea's servlet to ignore
the basic
authentication header?
Oh yeah, by the way, this is URGENT, as always. (really!! ;)
Toni NykanenCurrently there is no option to turn off security check.
I think you can use a servlet filter mapped to the URL
of your service, instead of a proxy servlet?
Regards,
-manoj
http://manojc.com
"Toni Nykanen" <[email protected]> wrote in message
news:3ef1577b$[email protected]..
>
Hi!
We need to implement authentication using our own methods, and theauthentication
information is provided to the web service implementation in a basicauthentication
header. The problem is, that the servlet
weblogic.webservice.server.servlet.WebServiceServlet, which handles webservices
in
wls 7.0.sp2, always attempts to perform authentication, if the header ispresent.
Is there any way to circumvent this, because we want to implementauthentication
on our own?
I already know two workarounds:
The best would of course be to implement a custom security realm for ourown
authentication system. This is not an option, implementing an own security
realm is overkill for this specific web service.
The other way would be to route the requests by way of a custom servlet,which
would
remove the basic authentication header, and put the authentication info incustom
headers, such as x-auth: <user:password>, or smthng similar, and aftersuccessful
authentication, make a call to bea's servletweblogic.webservice.server.servlet.WebServiceServlet.
>
But still, I'd like to know if there is any way to tell bea's servlet toignore
the basic
authentication header?
Oh yeah, by the way, this is URGENT, as always. (really!! ;)
Toni Nykanen -
How to redirect request to a servlet on another server/context
Hi
I want to redirect a request came to a servlet to another servlet on another server or atlest different context on same server.
Thanks in advance,
--NageshThanks but, now after rediriceting the request I am
not getting any ServletInputStream. Getting rintime
error as NoClassDefinitionFoundError :
ServletInputStream.That's indicative of a problem with your classpath settings.
DO I have to do anything the JSP
(which submitted the request to first servlet) after
redirecting?Nops, you shouldnt do anything after sendredirect(). The response is committed after using this method.
ram. -
Using JDO in a Servlet container/app server
Hi,
I was just wondering what Solarmetric recommends when using Kodo in a
servlet container/app server. Specifically the following:
1. Should each user session maintain a PersistenceManager or should the
PM be created per request? I am thinking it might be expensive to
maintain PMs across requests since you may have idle sessions and the
PMs may hold database resources? But since PMs aren't pooled in Kodo is
creating/closing a PM per request expensive or is it offset by Kodo's
connection pooling?
2. Is it advisable to store data to be displayed on a JSP by storing the
JDO instances themselves or serializable proxies (simple data beans) of
these objects in a user's session?
3. If you can store the JDO instances in the session, do you need to
make them transient instances using makeTransient() and call close() the
PersistenceManager?
Thanks in advance,
KhamsoukThese are all very good questions. There really is no one right answer to any
of them, so I'll just try to educate you on the issues involved and you can
make your own decision. Hopefully other people who are actually using Kodo
in a servlet/JSP environment will chime in too.
1. Should each user session maintain a PersistenceManager or should the
PM be created per request? I am thinking it might be expensive to
maintain PMs across requests since you may have idle sessions and the
PMs may hold database resources? But since PMs aren't pooled in Kodo is
creating/closing a PM per request expensive or is it offset by Kodo's
connection pooling?As long as you are outside of a datastore transaction, a PM does not maintain
any database resources. The only significant state it maintains is a soft
cache of persistent objects that have already been instantiated. If you are
using Kodo 2.3 RC1 and have no set the
com.solarmetric.kodo.DefaultFetchThreshold property to -1, then some
large collections you obtain from query results or relation traversals may be
scrollable result sets on the back-end, in which case they obviously maintain
some database resources.
2. Is it advisable to store data to be displayed on a JSP by storing the
JDO instances themselves or serializable proxies (simple data beans) of
these objects in a user's session?
3. If you can store the JDO instances in the session, do you need to
make them transient instances using makeTransient() and call close() the
PersistenceManager?I'll address these together. JDO fully supports serialization, and in fact
I think you'll find it does so in exactly the way that you want. If you choose
to store serialized persistent objects in the session, then during
serialization the objects will transparently pull in all of their persistent
state and relations, so the entire object graph is serialized. When you
deserialize, the objects will no longer be attached to their persistence
manager -- they will be transient.
Another options is to store the object IDs in the session, and re-retrieve
the persistent objects for each web request.
One design pattern that can probably net very good performance is to maintain
a global read-only persistence manager that you use to dereference these IDs.
Of course, if you ever want to change an object, you'll have to re-fetch it
in a new persistence manager, and evict it from the global manager's cache.
I hope this helps. -
ATMTag.java:5: package javax.servlet does not exist
My j2ee jdk1.4.2 is not supporting javx package.
i already set all pathh and class path.
anybody can help me.
details are given below ::
C:\AVA\J2EE Programs\JSP\JSPCustomTag>javac ATMTag.java
ATMTag.java:5: package javax.servlet does not exist
import javax.servlet.*;
^<br>
ATMTag.java:6: package javax.servlet.http does not exist
<br>
import javax.servlet.http.*;
<br>
ATMTag.java:18: cannot resolve symbol
symbol : class TagSupport
location: class ATMTag
public class ATMTag extends TagSupport{
<br> ^
ATMTag.java:29: cannot resolve symbol
symbol : class JspTagException
location: class ATMTag
public int doStartTag() throws JspTagException{
<br> ^
ATMTag.java:31: cannot resolve symbol
symbol : class JspWriter
location: class ATMTag
<br> JspWriter out =pageContext.getOut();
^
ATMTag.java:31: cannot resolve symbol
symbol : variable pageContext
location: class ATMTag
<br> JspWriter out =pageContext.getOut();
^
ATMTag.java:56: cannot resolve symbol
symbol : variable pageContext
location: class ATMTag
pageContext.getOut().write(str);
<br> ^
ATMTag.java:60: cannot resolve symbol
symbol : variable EVAL_PAGE
location: class ATMTag
return EVAL_PAGE;
^
8 errorsWhen compiling servlets etc, you need to include in your classpath a jar file with all the javax.* classes defined in it.
For Tomcat this is called servlet.jar and is in (I think) [TOMCAT_HOME]/shared/lib or /common/lib
For J2EE 1.4 Server, the jar is [J2EE_HOME]/lib/j2ee.jar
Where the _HOME directory is the directory where you installed J2EE.
Include this jar file in your classpath when compiling.
Good luck,
evnafets -
Servlet Filter not working in Oracel9iAS(9.2.0.3)
Hi,
May i know what cause the servlet filter not workinng in Oracle9iAS? Is there any library files missing? I have tried deploy the war file in Tomcat but is working fine but when i try to deploy in Oracle9iAS, the application seems like can't call the servlet filter.
Please advice.
Thanks.
Regards,
Ming JadeI'm not exactly sure what version you are using.
Servlet Filters were introduced in Servlet 2.3 which was part of J2EE 1.3.
Oracle9iAS 9.0.2.3 is J2EE 1.2 compatible .
Oracle Application Server 10g 9.0.4.x and 10.1.2 is J2EE 1.3 compatible
Oracle Application Server 10g 10.1.3 is J2EE 1.4 compatible.
So the problem could be that the version of the product you are using does does not support the version of the servlet spec that covers Servlet Filters.
Can you upgrade to/install the 10.1.2 release as a minimum?
cheers
-steve- -
Servlet in WebLogic Server 6.0
I am trying to run a servlet from WebLogic Server 6.0
Copied servlet class file into the following directory:
config/mydomain/applications/
DefaultWebApp_myserver/
WEB-INF/classes
Modified the web.xml file located in the config/mydomain/applications/
DefaultWebApp_myserver/
WEB-INF/ directory
<web-app>
<servlet>
<servlet-name>
CustLogin
</servlet-name>
<servlet-class>
lawson.servlet.CustLogin
</servlet-class>
<init-param>
<param-name>url</param-name>
<param-value> http:/localhost:7001/CustLogin/custaddr.html</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>
CustLogin
</servlet-name>
<url-pattern>
/CustLogin/*
</url-pattern>
</servlet-mapping>
</web-app>
Run servlet from a Web browser with URL:
http://localhost:7001/CustLogin
Servlet Exception
<<Error> <HTTP> <saluki2> <myserver> <ExecuteThread-11> <> <> <101018>
<[WebAppServletContext(944251,DefaultWebApp_myserver)] Servlet
failed with ServletException>
javax.servlet.ServletException: Servlet class: 'lawson.servlet.CustLogin'
could not be resolved - a class upon which this class depends wasn't
found
Deepak,
Are all the classes used by CustLogin in System Classpath or under
web-inf\classes directory?
Kumar.
Deepak wrote:
> I am trying to run a servlet from WebLogic Server 6.0
>
> Copied servlet class file into the following directory:
> config/mydomain/applications/
> DefaultWebApp_myserver/
> WEB-INF/classes
>
> Modified the web.xml file located in the config/mydomain/applications/
>
> DefaultWebApp_myserver/
> WEB-INF/ directory
>
> <web-app>
>
> <servlet>
> <servlet-name>
> CustLogin
> </servlet-name>
> <servlet-class>
> lawson.servlet.CustLogin
> </servlet-class>
> <init-param>
> <param-name>url</param-name>
> <param-value> http:/localhost:7001/CustLogin/custaddr.html</param-value>
>
> </init-param>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>
> CustLogin
> </servlet-name>
> <url-pattern>
> /CustLogin/*
> </url-pattern>
> </servlet-mapping>
> </web-app>
>
> Run servlet from a Web browser with URL:
> http://localhost:7001/CustLogin
>
> Servlet Exception
>
> <<Error> <HTTP> <saluki2> <myserver> <ExecuteThread-11> <> <> <101018>
> <[WebAppServletContext(944251,DefaultWebApp_myserver)] Servlet
> failed with ServletException>
> javax.servlet.ServletException: Servlet class: 'lawson.servlet.CustLogin'
> could not be resolved - a class upon which this class depends wasn't
> found
>
-
How to execute servlets in j2ee server
please help me out in running servlets in j2ee server.
i dont know where to put my servlets class files.please help me out in running servlets in j2ee
server.
i dont know where to put my servlets class files.In your j2ee server, look for your virtual host directory (webapps, deploys...information may be found in a \conf\ directory )
Your application have to respect the hierarchy :
/WEB-INF/web.xml --> The Web Application Deployment Descriptor
/WEB-INF/classes/ --> put any java class (servlet or non-servlet)
/WEB-INF/lib/ --> put jar file (external ressource)
*.jsp;*.html ...
/subdir/*.jsp;*.html...
put this hierarchy in your web apps directory
note : You can packed the hierarchy in a WAR file(Web ARchive)
a web.xml example :
<web-app>
<servlet>
<servlet-name>
myservlet
</servlet-name>
<servlet-class>
MyFirstServlet <!-- (your servlet's class)-->
</servlet-class>
<servlet-mapping>
<servlet-name>
myservlet
</servlet-name>
<url-pattern>
/myservleturl <!--(URL to call servlet) -->
</url-pattern>
</servlet-mapping>
</web-app> -
Package javax.servlet does not exists - Cannot resolve symbol
Hello,
I am using JDK 1.3.1.06 version. I wanted to compile a simple servlet using this. But I am getting plenty of errors for all javax package. Why it is not able to find javax package classes?
The following is the program I have tried to compile.
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class TestServlet extends HttpServlet
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
process(request, response);
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
process(request, response);
private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
PrintWriter out = response.getWriter();
out.println("Hello World !");
I am getting errors like this :
Package javax.servlet does not exists.
cannot resolve symbol
symbol : class HttpServlet
Please advice me some solutions fast.
Thanking you,
ForumAns.javax.servlet doesn't come with the standard jdk. It's part of J2EE.
If you have tomcat, you can use the server.jar that comes with tomcat.
Or you can just download J2EE sdk instead.
I am getting errors like this :
Package javax.servlet does not exists.
cannot resolve symbol
symbol : class HttpServlet -
Package javax.servlet does not exists ?
Hello,
I am using JDK 1.3.1.06 and trying to compile a simple Servlet. But getting errors as javax package classes does not exits and cannot resolve symobol.
The following is the program I am trying to compile:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class TestServlet extends HttpServlet
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
process(request, response);
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
process(request, response);
private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
PrintWriter out = response.getWriter();
out.println("Hello World !");
I am getting errors such as :
Package javax.servlet does not exists.
cannot resolve symbol
symbol : class HttpServlet
Please advice me of any solution asap. Deep trouble.
Thanking you,
Forumans.Just a guess...
JDK 1.3.1.06 This represents the Java language in the form of a JVM and the Java API (like java.lang.String.)
ServletThis is in J2EE, which if you look above was not mentioned.
If you look in the java docs for the JDK you will also find that javax.servlet does not exist.
I would guess however that you could start here - http://java.sun.com/j2ee/
However, keep in mind that your servlet still needs to run in something, so you better make sure that you are compiling against the correct J2EE server for what you are doing. -
Package java.servlet does not exists
I am getting this error:
c:Program Files\Java\jdk1.6.0_10\bin>javac -Xlint HelloServlet.java
HelloServlet.java:2:package java.servlet does not exists
import java.servlet.;
^
HelloServlet.java:4; cannot find symbol
symbol: class GenericServlet
public class HelloServlet extends GenericServlet
^
5 errors
i am using jdk1.6.0_10. i tried to locate the servlet.jar file in the \lib directory, but the jar file was not there. how can i download one and include it in \lib?
import java.io.*;
import java.servlet.*;
public class HelloServlet extends GenericServlet {
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter pw=response.getWriter();
pw.println("<B>Hello!");
pw.close();
}jatilau wrote:
forgive my ignorance.That's ok, we're all here to learn; but while (most) people on the forums are smart, they're (unfortunately) not all-knowing. They can't possibly know something about you or your environment unless you tell them.
it is because i have no one to look up at for help with java, except for the book (The Complete Reference, Java 2, 3rd Edition, Naughton & Schildt) and, of course, some times this forum.There's the whole Internet available to you. Remember, Google is your friend.
please, will anyone tell me how to find out what server type and version does JDK 1.6.0_10 provide? It doesn't. Java comes in three 'editions':
Micro (JME, earlier J2ME which is meant for mobiles and other similar platforms)
Standard (JSE, earlier J2SE which is what you're using, it's meant for core Java applications, like the sort you might use on your desktop.)
Enterprise (JEE, earlier J2EE which is for server side code. This includes JSPs, Servlets, EJBs etc)
i did not find any information about this in the book.Probably because it's a Java 'Standard' Edition (JSE or J2SE) book
What you need, to learn about servlets, is a JEE book. I'd suggest Head First Servlets and JSP from O'Reilly. Otherwise, follow the link I gave earlier to find tutorials.
To get started, you'll need a JDK, which you say you already have and a server. I'd suggest you get Tomcat. You will also find the servlet-api.jar after you setup Tomcat. This is an implementation of the JEE specification for servlets. This contains the javax.servlet.* packages you'll need to compile. Beyond this, the scope of what servlets are and how to deploy etc is rather large and best left to one of the afore-mentioned tutorials. -
Hi, I have a servlet which I was developing in my local computer using Tomcat, then I had to upload the servlet in a server which is running Web Logic, I put the name of the serlet and the path of the class of the servlet location and still not running, also some of the libraries that I use in the servlet are already located in the lib directory of the server (WEB-INF\lib), any ideas?, thanks in advance.
Hi, I asked to the server administrator if they have to restart the server in order to run new servlets and he said that no, these are the entries that I have:
<servlet>
<servlet-name>GanttChart</servlet-name>
<servlet-class>com.gepower.gees.gms.times.GanttChart</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GanttChart</servlet-name>
<url-pattern>/servlet/GanttChart</url-pattern>
</servlet-mapping>
I don't know what's going wrong, any ideas?, thanks. -
Servlet does not load on startup
Hi Guys,
I'm tryin to load a servlet on startup ..
Tryin to follow what the doc say but i get this error
in the server logs which means that the servlet is not found
Any help wud be greatly appritiated ...
thanx
what the logs say >>>
Fri Apr 28 11:52:51 PDT 2000:<I> <WebLogicServer> Invoking T3StartupDef
StartConfigServlet weblogic.servlet.utils.ServletStartup with
{servlet=ConfigServlet}
Fri Apr 28 11:52:51 PDT 2000:<I> <WebLogicServer> T3StartupDef
StartConfigServlet weblogic.servlet.utils.ServletStartup
reports:servlet: ConfigServlet not found
Fri Apr 28 11:52:51 PDT 2000:<I> <SSLListenThread> Listening on port:
7002
Fri Apr 28 11:52:51 PDT 2000:<I> <ListenThread> Listening on port: 7001
my server configuration>>>>
weblogic.httpd.register.ConfigServlet=com.fourcharity.servlet.ConfigServlet
# Set initArgs
weblogic.httpd.initArgs.ConfigServlet=\
servletHost=10.10.10.126:7001,\
smtpHost=4charity.com,\
[email protected],\
fclogourl=http://www.4charity.com/img/donate/4c_logo.gif
# Configure the ServletStartup class to run ConfigServlet's init()
# method at startup
weblogic.system.startupClass.StartConfigServlet=weblogic.servlet.utils.ServletStartup
weblogic.system.startupArgs.StartConfigServlet=servlet=com.fourcharity.servlet.ConfigServlet
regards sanjay
www.eBusinessDesign.com
3475 Granada Ave, Apt# 319,Santa Clara, CA-95051
(1-415-2671363(o) 1-408-2492716(r) 1-877-8993286(fax))
Thanks for the reply. However, the final product is to run in Solaris,
so there should not be a problem. Thanks anyway.
Regards,
Baivab
Mettu Kumar <[email protected]> wrote:
>what problems are you facing with sp8.
>
>Baivab Mitra wrote:
>
>> Hi All!!
>>
>> Thanks beforehand for all help received to this query
>beforehand.
>>
>> We are using WL5.1 on WinNT, with SP6. Unfortunately,
>we have followed
>> all instructions as in the docs. and tried to load the
>servlet
>> on WL startup automatically. It does not work!! Checking
>the Internet,
>> we came to know the SP8 is required. Installed SP8 and
>again tried.
>> Now -- the EJBs are giving problems -- deployment.
>>
>> Please -- is there anyone who can suggest remidies to
>this? BETTER
>> if we could stick to SP6 and NOT switch to SP8.
>>
>> Thanks,
>>
>> Baivab
>
-
Can i deploy servlet to iis server..?
Can i deploy servlet to iis server..?
if yes.. how..?to deploy servlets into IIS you need to use some connector which connects IIS to tomcat. Still you have to use servlet contrainer from tomcat only (as IIS serves you only web server functionality but not servlet contrainer ). use JK Connector for this bride.
Maybe you are looking for
-
How do i print calendar from icloud using windows 7?
Forgive me if this question is out there and has been answered – I'm sure it is but I can't find it. How do I print a day or series of days of my calendar from icloud? I have an ipad mini and ipad 2 but I want to print the calendar from icloud using
-
ICal syncing problems (with Lion?)
I've only noticed this since upgrading to Lion but I am having problems syncing my phone and iCal via iTunes. To start, I spent almost 3 hours on the phone with Apple a few days ago and we thought we fixed the issue. Here were the original problems:
-
My itunes library is no longer syncing with my iphone
My playlists within iTunes are no longer syncing with the playlists on my iPhone
-
I want to delete my OS9 system folder. I don't use, don't want to use and have no need to use it. I have been on OS 10 full time since the 10.1.5 days - I'm not looking back now. I want to free up some space as this is on my laptop. I know there are
-
USB 8451 - SMbus with labview: help please
Dear all, I just purchased an USB 8451 and I need to interact with a smart battery using a labview interface. I really need a departure point to build up a VI read/write and finally interact with the battery, and the tutorial on NI website ( http://