Is it necessary JDK to execute a servlet??
Hi!
I'm trying to carry out 5 servlets (they use XML).
By the moment and while developing, I'm using JDK 1.3 + Tomcat + Xerces, on Windows NT 4.0
But I want to install it on other Windows PCs, and I wonder if it is necessary to install JDK, or it's enough with JRE.
I would like also to know if there is another kind of Free Java Web Server, appart from Tomcat, or a system wasting less resources.
Thank you very much, and best regards.
The JDK is used mostly for JSP's as these need to be compiled on demand.
Servlets are precompiled and don't require a jdk but still need the jre.
As for other free webservers, I noticed a webserver called WASP. I haven't tried it as yet but if you want to give it a go try:
http://www.systinet.com/products/wasp_lite/
Cheers,
Anthony
Similar Messages
-
How to execute a servlet on jakarta-tomcat-4.0.3
Please let me know how to execute a servlet on jakarta-tomcat-4.0.3 .I am able to compile it .
Regards,
Saurabh SinghalHi
You must provide a mapping in your web.xml configuration file. This mapping will allow you to access servlet via url in form: "http://[domain]:[port]/[context]/servlet/[servlet full qualified name]"
This file should be located at $TOMCAT_HOME/conf.
Sample web.xml contains:
<web-app>
<display-name>Sample Database App</display-name>
<description>
This is a simple application.
</description>
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>MyServletImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/myservletaddr</url-pattern>
</servlet-mapping>
</web-app>
You can find more info at:
http://scitec.uwichill.edu.bb/cmp/online/CS36L/tutorials/TomcatIntroduction/TomcatIntroSampleApp.html
or
http://www.moreservlets.com/Using-Tomcat-4.html -
How to execute a servlet from a java code
Hi,
I am trying to make a URL connection to a particular site and trying
to execute the servlet at the site specified and then storing the image
pointed to by the servlet in a tmp location.I am passing the servlet id
in the param Parameter.and the
HTTP link in the URLString.
This code worked fine with a CGI script but is not working
properly with a servlet.
A sample servlet code
<img SRC=http://xyz/ABCServlet?imageKey=51752
2881"/>
private String executeServlet(String URLString, String param) {
try {
URL url = new URL(URLString);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
PrintWriter out = new
PrintWriter(connection.getOutputStream());
out.println(param) ;
out.close();
BufferedReader in = new BufferedReader(new
InputStreamReader(
connection.getInputStream()));
String inputLine;
String inputData = "" ;
while ((inputLine = in.readLine()) != null)
inputData = inputData + inputLine ;
in.close();
System.out.println(inputData) ;
return inputData ;
Could anyone one help me out in this.
Thanks,
Trita
Hi,
I would assume your image is a binary file, and therefore you should use
class for byteStream instead of charStream classes, i.e. Reader.
Michael
Trita Tripathi <[email protected]> wrote in message
news:[email protected]...
> Hi,
> I am trying to make a URL connection to a particular site and trying
> to execute the servlet at the site specified and then storing the image
> pointed to by the servlet in a tmp location.I am passing the servlet id
> in the param Parameter.and the
> HTTP link in the URLString.
> This code worked fine with a CGI script but is not working
> properly with a servlet.
> /*
> A sample servlet code
> <img SRC=http://xyz/ABCServlet?imageKey=51752
> 2881"/>
> */
>
> private String executeServlet(String URLString, String param) {
>
> try {
> URL url = new URL(URLString);
> URLConnection connection = url.openConnection();
> connection.setDoOutput(true);
>
> PrintWriter out = new
> PrintWriter(connection.getOutputStream());
> out.println(param) ;
> out.close();
>
> BufferedReader in = new BufferedReader(new
> InputStreamReader(
> connection.getInputStream()));
> String inputLine;
> String inputData = "" ;
>
> while ((inputLine = in.readLine()) != null)
> inputData = inputData + inputLine ;
>
> in.close();
>
> System.out.println(inputData) ;
> return inputData ;
> }
> Could anyone one help me out in this.
>
> Thanks,
> Trita
>
>
>
>
-
Hello,
I wnt to execute a servlet I use a Tomcat to do it
webapps/mySevletTest/Web-INF/classes/HelloServlet.java
in web.xml
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
to execute
http://localhost:8080/mySevletTest/HelloServlet
Error : The requested resource (/ServletTest/HelloServlet) is not available.
why ????
thanksI have put the class in a package org
package org;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloServlet extends HttpServlet
public void service(HttpServletRequest request, HttpServletResponse response)throws IOException
response.setContentType("text/html");
PrintWriter writer = response.getWriter();
writer.println("<html>\n");
writer.println("<head>\n");
writer.println("<title>Test</title>\n");
writer.println("</head>\n");
writer.println("<body>\n");
writer.println("<h1>Hallo Issam</h1>\n");
writer.println("<br>\n");
writer.println("<h3>Test for Servlet ist successfull ...</h3>\n");
writer.println("</body>\n");
writer.println("</html>\n");
}/WEB-INF/classes/org/HelloServlet.class
the phad of aaplication
webapps/myServletTest/WEB-INF/classes/org/HelloServlet.java
in web.xml
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
I become the same error !!!!!!!!!!
The requested resource (/myServletTest/HelloServlet) is not available.
who ist the error -
WebLogic cant execute a servlet
Hi!
Does anybody know how to debug or get more information about such a situation?
There are some servlets working on Sun with WebLogic.
Log file show me:
####<Nov 27, 2002 12:44:34 PM EET> <Error> <Posix Performance Pack> <egw> <agserver> <ExecuteThread: '59' for queue: 'default'> <> <> <000000> <Uncaught Throwable in processSockets>
java.lang.NullPointerException
at weblogic.socket.TunnelContext.getServlet(TunnelContext.java:24)
at weblogic.servlet.internal.MuxableSocketHTTP.dispatch(MuxableSocketHTTP.java:465)
at weblogic.socket.PosixSocketMuxer.deliverGoodNews(PosixSocketMuxer.java:456)
at weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java:385)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:23)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
it's my very first time of working with java,
sorry if the question looks stupid.Hi,
use the try catch block and post the stack trace. Without it its difficult to judge where the problem is.
Seetesh -
hai friends,
I am trying to execute a simple servlet in tomcat but I couldn't..
please help meCan you execute the default Servlets in Tomcat which are found in the "Examples" folder ? http://localhost:<PORT NO>/examples/
If yes then try deploying your servlet in the examples folder and find out a file called "servlet.jar " in your server and set its classpath.
I hope that will work.
Shashi -
How to execute a servlet onload
Hi everyone,
I am very new to servlets. I have a jsp page that calls a servlet which is executed on a submit button within a form.
It works, returning the data to the page. However I would like my servlet to be executed on load of the jsp. A tutorial that covers this area would be great.
If you have a suggestion please post a response.. Thanks.
<form name="data_form" method="post" action="Controller">
<input type="hidden" name="action" value="getData"/ >
</form>
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//String action = request.getServletPath().substring(1, request.getServletPath().indexOf("."));
String action = (String)request.getParameter("action");
// select application logic
String target = null;
try {
if(action.equals("getData")){
DataManager data = new DataManager();
request.setAttribute("Data", data.getData());
target = "/data.jsp";
}catch(RuntimeException e){
e.printStackTrace();
}Edited by: _AlyssaK on May 29, 2009 8:49 AMOnload? I've had a laugh, seriously :)
Create a Servlet class and implement doGet() wherein you do the desired loading tasks and finally forward the request to a JSP file and in the JSP file just access the loaded data through taglibs/EL. Finally map that servlet on an url-pattern and call it in your browser.
E.g. (semi pseudo)
doGet(request, response) {
Data data = dataDAO.load();
request.setAttribute("data", data);
request.getRequestDispatcher("data.jsp").forward(request, response);
}data.jsp
<p>The data is: ${data}</p>web.xml
<servlet-mapping>
<servlet-name>yourServlet</servlet-name>
<url-pattern>/data</url-pattern>
</servlet-mapping>Then invoke it on [http://hostname:port/contextroot/data]. -
Can I execute four servlets in succession using rd.forward
Hi^^,
I have created 1 JSP and four servlets which are as follows:
Login.jsp
SessionLogin.java
Authenticate.java
Authorize.java
Bologin.java
The Login.jsp transfers the control to SessionLogin.java which transfers the control to Authenticate.java which then transfers the control to Authorize.java which then transfers the control to Bologin.java. I do this using the RequestDispatcher code. My query is that is it technically correct to do this or I am violating ther MVC principle.
thanksHi,
fyi, my project is part of a larger project which is based on MVC architecture. I just need to follow the flow and code the servlets so that they are executed in the right sequence. However thanks for your suggestions, i do value them.
Regards,
Prashant -
Hi,
I'm trying to process xsql pages with the
XSQLServlet running in OSE.
I followed the procedure given in xsql 1.0.4.0 documentation but cannot make this
work.
while accessing an xsql page on the server,
the client's browser seems to be awaiting
for something which never comes...
here is an extract from the error_log file from
the apache server on the DB machine:
[Wed Apr 11 12:58:41 2001] [debug] jipa8i.c(655): Root JIP Service initialized
[Wed Apr 11 12:58:41 2001] [debug] jipa8i.c(659): Root JIP Service already running
[Wed Apr 11 12:58:41 2001] [debug] jipa8i.c(708): JIP Service initialized as inst1_http
[Wed Apr 11 12:58:41 2001] [debug] jipa8i.c(708): JIP Service initialized as inst1_http
[Wed Apr 11 12:58:41 2001] [debug] jipa8i.c(503): Stateless connection established
[Wed Apr 11 12:58:41 2001] [debug] jipa8i.c(1297): [client 192.108.115.44] Requesting: GET /demo/xsql/home/home.xsql
[Wed Apr 11 12:58:41 2001] [debug] jipa8i.c(503): Stateless connection established
[Wed Apr 11 12:58:41 2001] [debug] jipa8i.c(1297): [client 192.108.115.44] Requesting: GET /demo/xsql/home/homecontent.xsql?tab=Demos
[Wed Apr 11 13:01:10 2001] [debug] jipa8i.c(659): Root JIP Service already running
[Wed Apr 11 13:01:10 2001] [debug] jipa8i.c(659): Root JIP Service already running
[Wed Apr 11 13:01:10 2001] [debug] jipa8i.c(708): JIP Service initialized as inst1_http
[Wed Apr 11 13:01:10 2001] [debug] jipa8i.c(708): JIP Service initialized as inst1_http
[Wed Apr 11 13:01:10 2001] [debug] jipa8i.c(503): Stateless connection established
[Wed Apr 11 13:01:10 2001] [debug] jipa8i.c(1297): [client 192.108.115.44] Requesting: GET /demo/xsql/home/home.xsql
[Wed Apr 11 13:01:10 2001] [debug] jipa8i.c(503): Stateless connection established
Where could I see if mod_ose is really working?
is there any logfile?
did someone made that stuff work?
thanks.
XtoF.It works with IIS when you couple a Java servlet engine with IIS.
One we have tested in the past is the ServletExec from New Atlanta. -
How to execute jsp.servlet program in eclipse with small example
This is sasidhar,
How to set classpath pf tomcat to eclipse.
and how to run jsp and servlets in eclipse 3.o
thanks®ards
sasidharHI,
Try these links
http://help.sap.com/saphelp_nw04/helpdata/en/64/620a2ae361344abf47462809eb5388/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/f6/baba3eb645dc61e10000000a114084/frameset.htm -
Facing the problem while executing the Servlet on Jserv Unix box
Requirement : To Upload the CSV file from client machine to the database
server's UTL file directory path and load the
contents of the file in to table by using PLSQL procedure.
Followed Process : 1> JSP page is used to take the CSV file as Input for
transferring to the Database server's UTL file directory
path.
2> SERVLET is called by above mentioned JSP which
transfers the input CSV file to the database server UTL
path.
It also called the PLSQL procedure which load the contents
of the file in the table.
File Transfer Method: Multi-part/Form-data
Web-server : Apache-Jserv
Operating System : Unix
Problem : After trying to upload the file from JSP, I am getting the INTERNAL SERVER ERROR.
Note : The above process has been tested successfully on TOMCAT5 server on Windows XP.
After checking the error log file ..I am getting the follwing error
02/06/2005 09:56:08:350] (ERROR) balance: continuing session to bbebapp.balfourbeatty.com : 16600
[02/06/2005 09:56:19:391] (ERROR) balance: continuing session to bbebapp.balfourbeatty.com : 16600
[02/06/2005 09:56:19:397] (ERROR) ajp12: Servlet Error: java.lang.NoSuchMethodError: null
[02/06/2005 09:56:19:397] (ERROR) an error returned handling request via protocol "ajpv12"
[02/06/2005 09:56:19:397] (ERROR) balance: 10204 internal servlet error in server bbebapp.balfourbeatty.com:16600
[02/06/2005 09:56:19:397] (ERROR) an error returned handling request via protocol "balance"Hi Pavan,
In the below WLST command please provide a "Space" between every comma ( , )...like following
wls:/base_domain/serverConfig> reassociateSecurityStore(domain="base_domain", admin="cn=orcladmin", password="welcome1", ldapurl="ldap://<hoistname>:389", servertype="OID", jpsroot="cn=jpsroot_idm_idm1")
like there is a Space before servertype="OID" same password="welcome1" there is a Space before password...
Thanks
Jay SenSharma
http://jaysensharma.wordpress.com (WebLogic Wonders Are Here) -
JRE/JDK Problem with Applet/Servlet scenario
Hi there!
I'am forced by my company to upgrade an old Java application. The situation is, that an signed applet calls several servlets (running on Tomcat 4.x or 5.x) over http(s).
In former times both, servlet container and applet, were using jre 1.4.1.x
(The servlet container was ServletExec, so a jre was sufficient).
Everything was working fine, if the client was using the 1.4.1 jre.
But on later versions (1.4.2.x) the whole Applet-jar was downloaded from the server per user interaction, whats definitly not acceptable as customers still using isdn or nowadays umts.
Any sugesstions?
Thanks
BuzzDouble Posted:
http://forum.java.sun.com/thread.jsp?thread=553517&forum=33&message=2709389
And the answer is the same. You will have to open multiple connections. One for each time want to send data to the Servlet, because that is how HTTP works.
Try a simple case, where you want to send a single object through to the Servlet, then read the response.
When that works, repeat it for every subsequent time you want to send or recieve data.
If you want to have continuous communication between the server and the client, you do not want to use HTTP. -
Hi,
I am using jakarta-tomcat-4.0, to which jar file I have to set the classpath inorder to compile a servlet program.
Thanks%TOMCAT_HOME%\common\lib\servlet.jar
-
Error while executing servlet through a HyperLink.
Hi
When i am trying to execute a servlet through the HyperLink using this statement
where CallStatusDetailsAssign is my servlet.then i am getting this error :
The Following is the Alert Message.
1. Microsoft InterNet Explorer
http://localhost:8080/examples/servlets/CallStatusDetails?Call_ID=1&EMP_NO=1
** Download of the specified Resource has failed.
& also getting this error:
2. IE Cannot open the Internet Site
** Operation has been Cancelled.
If i refresh the screen by clicking on refresh button in the Internet Explorer.the Page is getting displayed properly.
Is there any problem with my servlet code ??or some other Problem.
Can Anyone Please help me on this & give me the Solution for my Problem.
RashmiI'm not sure if this is cause of your problem but the anchor tag should look like this:
some text</ a>
... in the code the quotes are missing
spieler -
Problem in executing servlets under tomcat 4.1
Dear Group,
I am using Tomcat 4.1 and have the following directory structure:
1. C:\Tomcat 4.1\webapps\testapp
----It is my root directory and I have my html file called
sample.html
2. C:\Tomcat 4.1\webapps\testapp\WEB-INF------web.xml is here
3. C:\Tomcat 4.1\webapps\testapp\classes\TestServlet.class
-------here I have the servlet, no package---only one servlet
My[b] web.xml has entry for:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/TestServlet</url-pattern>
</servlet-mapping>
</web-app>My[b] sample.html contains:
<HTML>
<BODY>
<form method="post" action="http://localhost:8080/testapp/TestServlet">
<input type=submit value="showServlet">
<h2>
<font color="green">First try on Serlvet</font>
</h2>
</form>
</BODY>
</HTML>Here is what I have done:
1. Started the Tomcat server
2. In the IE browser, I typed http://localhost:8080/testapp/sample.html
-------- - the file shown correctly and I clicked the showServlet button.
3. I got the follow error �HTTP Status 404 - /testapp/TestServlet" the
requested resource not availble
4. when I clicked the showServelt button the control goes to another page
(as it should go to execute the servlet) .
The URL is �http://localhost:8080/testapp/TestServlet�
Please enlighten me where I went wrong?Hello all,
Thank you for answering the question now the servlet gets executed.
I here posts the steps i carried out to execute the
servlet. If anyone have different idea pls post. Im
pasting here the steps also attaching one.
Steps to create your directory and work in Tomcat 4.1
1. Create your directory in Tomcat�s webapps Directory.
-----If your tomcat is in d:\ the your directory may look
----- D:\tomcat\webapps\<your directory>
------E.g. �d:\tomcat\webapps\test�
2. In the test directory you can your html files directly or you can create a
directory to hold html files.
--------E.g. �d:\tomcat\webapps\test\first.html (OR)
-------E.g. �d:\tomcat\webapps\test\html-files\first.html�
3. Create a folder called WEB-INF inside test
-------E.g. �d:\tomcat\webapps\test\WEB-INF
------ Under the WEB-INF folder put your web.xml file
4. Create another folder named classes under the same test
----- E.g. �d:\tomcat\webapps\test\classes
----- Here you need to place your servlet classes
----- E.g. �d:\tomcat\webapps\test\classes\testServlet.class
5. Start any browser that are java enabled
6. Type �http://<machine name (or) IP add.>:8080/<your folder
name>/<html file>�
---- E.g. http://localhost:8080/test/ html-files/first.html
-----E.g.http://127.0.0.1:8080/test/html-files/first.html
7. Click the component (button, label�) to enable servlet
8. That�s all! Now you should get your servlet executed.
Files:
1. web.xml
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems,
Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>testServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>testServlet</servlet-name>
<url-pattern>/testServlet/*</url-pattern>
</servlet-mapping>
</web-app>
2. first.html
<html>
<body>
<form method="POST"
action="http://localhost:8080/test/testServlet">
<input type=submit value=click></input>
</form>
</body>
</html>
3. testServlet.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class testServlet extends HttpServlet
public void doPost(HttpServletRequest req,
HttpServletResponse res)throws ServletException,
IOException
PrintWriter out = res.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<h1>Hello! </h1>");
out.println("</body>"+"</html>");
}I have put my first.html inside the folder
�d:\tomcat\webapps\test\html-files\� and testServlet
is under �d:\tomcat\webapps\test\WEB-INF\classes\� folder.
Maybe you are looking for
-
Loaded new desktop SW V 6.1.0 B34, crashes on startup
Blackberry 9300 Curve, ATT provider My desktop got infested with Open Cloud Security virus. I had to backup, erase, load new WIN XP OS, new MS Office, trying to sync phone with outlook. Downloaded Download Details Software Name: Desktop Software v6.
-
Change height of column in Analysis
Hi, I have a simple analysis that I use to write comment back to the database, it works fine but the users have asked if I can increase the size of the input box on the dashboard. I have had a look and I can't find any default functionality to do thi
-
I've created a database in 9ias and i also selected the option of jvm. but whenever i go into the enterprise manager and try to connect to the jvm it gives me an error the error is VDJSERVER-1516 failed to get a new jserver session. and during the da
-
What is the process of the SunMSCAPI getting a cert's alias from windows?
Hi: This problem comes from a older problem ( http://forums.sun.com/thread.jspa?threadID=5374874&tstart=0 ) . Unfortunately, this problem seems like not a popular problem :-( Is there anybody can access the souce code of SunMSCAPI, and give me some h
-
Wbs elements information needed - importance.
Hi Gurus, please explain wbs elements related information. regards.