Calling remote machine servlet from applet
I got an error when I calling a remote machines servlet. I am calling from applet which is downladed by pluggin.
can any body tell me what is the reason the applet is not calling this servlet ?
what do i do to solve this problem ?
Dinesh
Dinesh
Enable the Java console (Control Panel, Java Plug-In, Basic, Show Java Console, Apply)
The error message might give you some help.
Regards
Similar Messages
-
Calling 3 different servlets from a single servlet
hi all,
i am in lot of soup...i am new to servlets,etc....so help me pls.
i need to call 3 different servlets from one servlet. all 3 servlets that i want to call perform different functions and execute queries on the database.
what i am trying to do is:
there is an html page that call a servlet called authenticate.java.(whose code is at the bottom of this page).
the servlet authenticate.java should authenticate a user according to the password and username supplied in the html page.
MAINLY:-
i need to display 3 buttons to the authenticted user. those 3 buttons each should call 3 different servlets, which do different things.
now in authenticte.java i set certain information in the session using session.putValue();
further, whatever servlet is called, i need to use that information i set into the session...using session.getValue().
PLS TELL ME HOW TO DO THAT...ALSO C IF THE BELOW CODE IS OK.
ALSO TELL ME HOW TO END A SESSION. ALSO DO SERVLETS SUPPORT SESSIONS?
I AM USING jdk1.3 and jsdk2.0.
* Authenticate.java
// this places all user variables in session
//to access use session.getAttribute
//dispatcher stuff
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import java.sql.*;
import java.io.*;
import java.util.*;
* @author Gudiya
* @version
public class Authenticate extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
HttpSession session = request.getSession(true);
Connection con=null;
String sessionid;
String deptcode;
String desig;
String add1;
String add2;
String contname;
PrintWriter out = response.getWriter();
try
{System.out.println(1);
response.setContentType("text/html");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:SACFA","","");
System.out.println("connection established");
catch(ClassNotFoundException e){
System.out.println("database driver not found");
System.out.println(e.toString());
catch(Exception e){System.out.println(e.toString());
String username=request.getParameter("username");
String password=request.getParameter("password");
try{
System.out.println(2);
PreparedStatement stmt=con.prepareStatement("SELECT * FROM AUTHENTICATION,mb_add where AUTHENTICATION.NAME=? AND AUTHENTICATION.PASSWORD=? AND mb_add.DEPT_NAME=?");
stmt.setString(1,username);
stmt.setString(2,password);
stmt.setString(3,username);
ResultSet rs=stmt.executeQuery();
System.out.println(3);
boolean rowfound=false;
rowfound=rs.next();
if (rowfound==true)
sessionid=session.getId();
System.out.println(sessionid);
System.out.println(4);
session.putValue("user",username);
rs.beforeFirst();
while (rs.next())
System.out.println(5);
deptcode=rs.getString("DEPT_CODE");
desig=rs.getString("DESIGNATION");
add1=rs.getString("ADDRESS1");
add2=rs.getString("ADDRESS2");
contname=rs.getString("NAME");
session.putValue("dept_code",deptcode);
session.putValue("designation",desig);
session.putValue("address1",add1);
session.putValue("address2",add2);
session.putValue("cont_name",contname);
System.out.println(6);
} out.println("<html>");
out.println("<head>");
out.println("<title>Successful Login Screen</title>");
out.println("</head>");
out.println("<body bgcolor='ORANGE'>");
out.println("WELCOME SACFA MEMBERS FROM "+ username);
//print decorative html statements here
out.println(" SELECT ANY ONE ACTION:-");
//out.println("<form Action="+"\"servlet/noc\""+" method =post>");//call for your noc servlet
//print decorative html statements here
out.println("<INPUT TYPE=submit VALUE='GENERATE NOC' NAME='NOC'>");
out.println("</form>");
//print decorative html statements here
//out.println("<form Action="+"\"servlet/comments\""+" method =post>");//call for your comment servlet
out.println("<INPUT TYPE=submit VALUE='ENTER/ MODIFY COMMENTS' NAME='COMMENTS' >");
out.println("</form>");
//print decorative html statements here
// out.println("<form Action="+"\"servlet/bye\""+" method = post>");
out.println("<INPUT TYPE=submit VALUE=EXIT NAME=EXIT >"); //place javascript fucction for exiting window
out.println("</form>");
out.println("</body>");
out.println("</html>");
con.close();
} catch( SQLException e){ }
out.close();}
THANK YOU,
REGARDS,
ASHNAHi Ashna,
You have use three different forms for three buttons. But I think all are commented one.It will also work if you uncomment it.
Else you can use only one Form without giving action in form tag. Use normal buttons instead of submit type buttons & call different JavaScript functions on onClick event for each button.
Try this out.
Ajay -
Calling a Weblogic Servlet from a CGI
Hello,
I need to call a WL servlet from a CGI and having problems with the URL
enconding.
It's necessary to add a null character to the URL in the CGI script?
Thanks in advance
[email protected]
Hi!
I believe U can call ur servlet by appending "servlet" just before servlet1 .
That is
ur URL should be
http://<host:port>/servlet/servlet1/<File .........>
I was facing the same problem and it worked fine..........
Why JDev9i appends "/servlet" and how to remove this is so that I can have whatever path I can is still a mystery..
If u have a work around. Do share with me...
Cheers
Abhishek
mail: [email protected] -
Calling Java Script Function from Applet
How can I call the Java Script method from Applet. This should work both on IE and NN running on both Windows NT and solaris. I know it is possible to call the function in Java script using JSObject. But I don't have JSObject at run time. Please let me know how to call Java Script function from applet without using JSObject.
For Java <-> JavaScript communication in Netscape / Mozilla see:
http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/lc.html#1014290
http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/lc.html#1008480 -
How to call servlet from applet residing in Oracle9i forms bean area.
Dear Members
I have an applet which is calls a servlet for database operations. If access this from a browser it works fine as the applet is signed. But When i place this applet in a bean area of Forms in Oracle 9i. It gives access control exception. Can anyone help me, as i feel this problem is with oracle9i forms.Dear Members
I have an applet which is calls a servlet for database
operations. If access this from a browser it works
fine as the applet is signed. But When i place this
applet in a bean area of Forms in Oracle 9i. It gives
access control exception. Can anyone help me, as i
feel this problem is with oracle9i forms.As far as I recall - Oracle 9i forms is operating on a top of another special/internal servlet. I can't really recall, since I've been working with Oracle 9i forms 2 yrs ago. So total procedure looks like following:
applet -> Oracle 9i Forms servlet -> my servlet
instead of
applet -> my servlet
I think this is an actual reason why your signed applet can't work with your servlet.
Oracle 9i servlet has a number configuration files, I think among them you should change smth to get your construction working. Another approach would be to use servlet filtering before calling Oracle 9i servlet
Hopefully it will help
Paul -
How to call a .jsp file from Applet
Could any one guide me how to call a .jsp file from a Applet using action Event.
Thankshttp://javaalmanac.com/cgi-bin/search/find.pl?words=URL+post
-
Tomcat 6 Calling a Java Servlet from a JSP Page
Below is a very simple JSP Page that calls a Java Servlet. The question is given Tomcat security constraints, is it possible to call a servlet from a JSP and get the correct output without getting an error message? If so, how would you code the web.xml file?
c:\apache-tomcat-6.0.18
Under conf
catalina
localhost
HelloWorldExample.xml is directly under localhost
The application would have this directory structure:
webapps
HelloWorldExample
hello.jsp is directly under HelloWorldExample
Under HelloWorldExample
src
WEB-INF
classes
Under classes
jservlets
HelloWorld.java is in src folder
HelloWorld.class is in jservlets folder
HelloWorldExample.xml
<Context path="/HelloWorldExample" docBase="HelloWorldExample" debug="0"
reloadable="true" crossContext="true">
</Context>**************************
hello.jsp
<HTML>
<HEAD>
<TITLE>Hello</TITLE>
</HEAD>
<BODY>
<FONT SIZE="4">
<P>
Please enter your name:
<FORM
METHOD="Post"
ACTION="servlet/jservlets.HelloWorld">
<TABLE BORDER="3" CELLPADDING="1" WIDTH="100%" ALIGN="CENTER">
<TR>
<TD><B>Name:</B></TD>
<TD><INPUT TYPE="text" NAME="Name" VALUE="" SIZE="65"> </TD>
</TR>
</TABLE>
<P>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</FONT>
</BODY>
</HTML>******************
HelloWorld.java
package jservlets;
import java.io.*;
import java.util.Date;
import java.util.*;
import java.text.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet
PrintWriter out;
PrintWriter err;
String strName;
public void displayMessage(HttpServletRequest request, HttpServletResponse response)
throws Exception
try
if (!strName.equals("") && strName != null)
out.println("Hello " + strName + "" + "<P>");
out.println("Hello World" + "<P>");
else
out.println("Hello World" + "<P>");
catch (Exception e)
out.println("Exception: Could not display message." + "<P>");
err.println (e.getMessage () ) ;
out.println("<P>");
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
try
response.setContentType("text/html");
out = response.getWriter();
err = response.getWriter();
strName = request.getParameter("Name").trim();
out.println("<html><head><title>");
out.println("</title></head><body>");
out.println("<FORM");
out.println("METHOD=POST");
out.println("ACTION=http://localhost:8080/HelloWorldExample/hello.jsp>");
out.println("<TABLE ALIGN='RIGHT'>");
out.println("<TR>");
out.println("<TD>");
out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Hello World Page\";>");
out.println("</INPUT>");
out.println("</TD>");
out.println("</TR>");
out.println("</TABLE>");
out.println("</FORM>");
out.println("<BR CLEAR='all'>");
out.println("<P>");
displayMessage(request, response);
out.close();
out.println("</body></html>");
catch(Throwable e)
e.printStackTrace();
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
doPost(request, response);
web.xml
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>jservlets.HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/servlet/HelloWorld</url-pattern>
</servlet-mapping> ******************************
HelloWorld.java can be compiled by using javac.
Once compiled, HelloWorld.class would be moved to the jservlets folder.
FYI, coding the above url-pattern results in:
HTTP Status 404
The requested resource (/HelloWorldExample/servlet/jservlets.HelloWorld) is not available
The following url-pattern in the web.xml file permits the servlet to be executed but results in a null pointer exception:
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/ </url-pattern>
</servlet-mapping> **************************************************
RobinThis problem was resolved.
In hello.jsp
ACTION="servlet/jservlets.HelloWorld">
was replaced with
ACTION="servlet/HelloWorld">
Robin -
Calling Remote C program from Report2.5
Any one got an oppurtunity to use user_exits to call remote C or
Pro*C Program from Report2.5 development either widows NT or
unix environment.
Please give me some examples how to use it.
Thanks
nullHi Aparna,
In order to zoom in on the root cause of your problem, it would be helpful to have more information on your application. Have you tried calling your C DLL from any other programming languages? What exactly are the inputs and outputs (along with datatypes) of your DLL? Does LabVIEW give any error message when it "hangs"? I am sure that we can work together to resolve this issue.
Regards,
Casey Weltzin
Applications Engineer
National Instruments -
Calling Remote Stored Procedure from Pocket PC
Hi all,
I have finished building an application based on IBM's SMF framework which conforms to the OSGI standards. Currently, I am having a problem with connecting to the main server DB which resides on a Websphere server. Basically, user will enter information on their pocket pc and then save it to a local DB2e database. I thought about going with the synchronization solution with the DB2 Sync server, but really all the user is trying to do is updating records in the main server database tables and there's really no need to sync anything back from the server to the pocket pc. So, I m thinking maybe I should try to invoke a stored procedure that resides on the main DB server from my device, passing in parameters through a WLAN connection.
My question now is:
1. user should be connecting through a WLAN connection and my company have set up a login that prompts the user to login everytime they try to access anything on the server. It won't be nice if the user will hv to do that every single time. Is there a way that I can log the user in programmatically so they do not have to do it with a separate log in window?
2. Is calling a remote stored procedure a bad idea?
3. If the network goes down, then there's no way the users can update anything to the main server DB. So, the changes will be saved locally and once the network goes back up, the user should be able to update those changes back to the server. I am just wondering if it's bad to do a loop and send those updates to the server by calling the stored procedures repeatedly passing in diff. parameters? what safeguards do I need to put in? like what exceptions should I expect to catch? also, I would like to be able to track those updates that failed, how do I do that?
Any help will be appreciated. I tried to find resources online, but to no avail. I am not sure if I am overly complicated things. Please advice! Thanks alot everyone!The error message is:
ORA-04067: not executed, stored procedure "schema.P$PROC@remote_db" does not exist -
Calling this simple servlet from command line -- ERRORS!
Below is my servlet. I call from command line via:
java BatchServlet
and I get:
Exception in thread "main" java.lang.NoClassDefFoundError: BatchServlet
IS there a reason for this
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
public class BatchServlet extends HttpServlet implements Runnable{
static Thread t = null;
public void init(ServletConfig c) throws ServletException{
super.init(c);
if (t==null){
t = new Thread(this);
t.start();
public void run(){
while (true){
try{
Thread.sleep(5000);
}catch (InterruptedException ie){
ie.printStackTrace();
System.out.println("Wake up");Same error with this little prog.....
Notice main method
package wch.util;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
public class test {
public void main(){
System.out.println("test"); -
Calling remote CFC method from CFFORM
From what I understand by the remote methods in CFCs you can
access them by passing the argument names and values through the
URL with the method defined as well. I am trying to do the
following:
http://www.cfcoding.com/osu/components/Employees.cfc?method=addEmployee&firstname=Tristan& lastname=Lee&email=tristanlee%40gmail.com&address=1234+Some+Dr.&city=My+City&state=My+Stat e&zip=12345&comments=Test2&onNext=%2Fadmin%2F
I have attached the code for that function, but it seems as
though when I call that method with the arguments, the page is just
blank. Even with output being on, I still can't get anything to
display. In the end, the new employee isn't inserted into the
database which is my biggest concern. Any dieas?There are several issues:
1. You need to obtain file handle before calling GetFileType(). How are you going to get it?
2. The simplest way to call a method from kernel32 would be using jni wrapper library, like xFunction:
import com.excelsior.xFunction.*;
/* Call Beep() from KERNEL32.DLL */
xFunction f = new xFunction( "kernel32", "int Beep(int,int)" );
f.invoke( new Argument(1770), new Argument(100) );regards, Denis -
Calling a http page from applet? on click of one button
i want to make a http request in address bar of my internet explorer from my applet which is running in the browser
check showDocument(....) method in AppletContext interface.
-
Can we call Remote Endable Module from another Remote Enabled Moduel
Hii experts...
I have a problem regarding Remote Enabled Module Function Module....
Actually i want to call the standard BAPI 'BAPI_GL_GETGLACCBALANCE' into the BAPI which i hve created...
is it possible???
or can anyone tell me if it is not possible then what is the alternative for this..???'Remote enabled' means that you can also call the function remotely. The 'Remote enabled' characterstic implies some restrictions for the FMs interface, i.e. parameters can not be passed by reference because the remote system has no access to the memory of the called systems where the referenced data are located.
Remote call means only a restriction for the remote call, not for any direct call.
Regards,
Clemens -
About calling servlet from an applet
In one of my jsp, I have an applet which is to call a servlet. When I run it, I get an error in the status bar of IE. It says 'Exception: java.lang.runtimeException: java.security.AccessControlException: access denied (java.net.SocketPermission localhost:8080....)'
Does anybody have similar experience?
Thanks,
Joehi;
to call a servlet from applet i give you a link:http://www.j-nine.com/pubs/applet2servlet/Applet2Servlet.html.
read cearfuly, and if you have any question you can post it to me?
goodluck -
Problems calling Java Servlets from HTML pages Online
Hello
I have created a Web site using Java Servlets, and have acquired some servlet enabled web-space however i am having some difficulty in calling the actual servlets from the HTML pages i was using the line of code as follows
http://localhost:8080/servlet/....
followed by the name eg.
http://localhost:8080/servlet/Login
however this doesn't seem to be working i have also tried using the exact address of the servlet but this didn't work either
i.e ..servlet/Login.java
I was wondering would anyone have any idea as in how the servlets should be called
Thanks very muchOnce you write the Servlet code, you have to compile and put the classes in the server classpath. To refer these servlets from your pages, you have to configure them in the server configuration(typical a xml file). There you define how you are going to refer to the servlet(/servlet/Logon) and the correponding class.
-Mak
Maybe you are looking for
-
Mac stuck in safe mode start up loop
Hi everyone, it seems I have run into a problem and can't find answers online. First off I have a MacBook intel core duo on the latest snow leopard and mac software is up to date. It all started when I had to restore my iPhone and it had some problem
-
How can I insert text in Pages so it flows to the next page?
I try copying a block of text into Pages but it cuts off at the end of the page instead of flowing to the next page. How do I fix this?
-
How can I keep apps in the order I prefer? I've rearranged via iTunes but every time I power cycle the phone, the apps go back to their original positions...
-
Configure airport express with mac book air
I am trying to configure airport express with a Mac Book Air, without success; the program is installed, but then, nothing appears to configure Airpor Express... Can I get any help? Thank you António
-
Repalcing UNIOn with full outer Join
I have a query wihch looks like , select colA,colB ,colC, coldD from A,B,C,D where (some join conditions) union select colA,colB ,colC, NULL from A,B,C where (some join conditions) This query is posing us serious performance issues and we want to tun