Rmi, servlet + mysql

i have a jsp page as follows that requests information from a database
<body>
<form method="post" action="http://localhost/servlet/JobServlet">
View Job Details:
Enter job number <input name="jobno" type="text" id="jobno" />
<input name="view" type="submit" id="view" value="View Details" />
</form> </body>
my interface:
import java.rmi.*;
public interface JobInt extends Remote {
public String getDetails(int jobno) throws RemoteException; }
the server:
import java.rmi.*;
public class JobServer {
public static void main(String[] args) {
try {
JobImpl j = new JobImpl();
Naming.rebind("//"+"localhost"+"/JobImpl",j); System.out.println("Registered"); }
catch (Exception e) {
System.out.println("Exception occured in JobServer ... " +e); } } }
implementation:
import java.rmi.*;
import java.rmi.server.*;
import java.sql.*;
public class JobImpl extends UnicastRemoteObject implements JobInt {
Connection con; Statement st; ResultSet rs;
String url = "jdbc:mysql://localhost:3306/db?user=root;password=admin";
public JobImpl() throws RemoteException {
super();
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection(url, "", "");
st = con.createStatement(); }
catch (Exception e) {
System.out.println("problem while establishing connection"+e); } }
public String getDetails(int jobno) throws RemoteException {
try {
rs = st.executeQuery("Select * from job where jobno="+jobno);
rs.next();
return(rs.getString(2)); }
catch (Exception e) {
e.printStackTrace(); }
return null; } }
from the jsp page, when the jobno is entered all the details about the job should be displayed on the servlet
the servlet:
import java.rmi.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class JobServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
PrintWriter out = res.getWriter();
res.setContentType("text/plain");
try {
int jobno = Integer.parseInt(req.getParameter("jobno"));
JobInt j = (JobInt)Naming.lookup("//"+"localhost"+"/JobInt");
System.out.println("Job Details: "+j.getDetails(jobno)); }
catch (Exception e1) {
System.out.println(""+e1); } } }
i get a HTTP 405 error... i really dont know whats the problem and y it doesnt work... im doing an assignment on these... plz help

You are requesting the servlet via the POST method (<form method="post"...) but you didn't implement the doPost() method in your servlet. Therefore your servlet doesn't support POST requests and you get that error back.
Either change the HTML to use the GET method or change the servlet to implement doGet() instead of doPost(). In my opinion the GET method would be more suitable for a request that doesn't change anything on the server side.

Similar Messages

  • Rmi, jsp + mysql

    i have a jsp page as follows that requests information from a database
    <body>
    <form method="post" action="http://localhost/servlet/JobServlet">
    <p>View Job Details: </p>
    <p>Enter job number
    <input name="jobno" type="text" id="jobno" />
    <input name="view" type="submit" id="view" value="View Details" />
    </form>
    </body>
    </html>
    my interface:
    import java.rmi.*;
    public interface JobInt extends Remote
         public String getDetails(int jobno) throws RemoteException;
    the server:
    import java.rmi.*;
    public class JobServer
         public static void main(String[] args)
              try
                   JobImpl j = new JobImpl();
                   Naming.rebind("//"+"localhost"+"/JobImpl",j);
                   System.out.println("Registered");
              catch (Exception e)
                   System.out.println("Exception occured in JobServer ... " +e);
    implementation:
    import java.rmi.*;
    import java.rmi.server.*;
    import java.sql.*;
    public class JobImpl extends UnicastRemoteObject implements JobInt
         Connection con;
         Statement st;
         ResultSet rs;
         String url = "jdbc:mysql://localhost:3306/db?user=root;password=admin";
         public JobImpl() throws RemoteException
              super();
              try
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
                   con = DriverManager.getConnection(url, "", "");
                   st = con.createStatement();
              catch (Exception e)
                   System.out.println("problem while establishing connection"+e);
         public String getDetails(int jobno) throws RemoteException
              try
                   rs = st.executeQuery("Select * from job where jobno="+jobno);
                   rs.next();
                   return(rs.getString(2));
              catch (Exception e)
                   e.printStackTrace();
              return null;
    from the jsp page, when the jobno is entered all the details about the job should be displayed on the servlet
    the servlet:
    import java.rmi.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class JobServlet extends HttpServlet
         public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
              PrintWriter out = res.getWriter();
              res.setContentType("text/plain");
              try
                   int jobno = Integer.parseInt(req.getParameter("jobno"));
                   JobInt j = (JobInt)Naming.lookup("//"+"localhost"+"/JobInt");
                   System.out.println("Job Details: "+j.getDetails(jobno));
              catch (Exception e1)
                   System.out.println(""+e1);
    i get a HTTP 405 error... i really dont know whats the problem and y it doesnt work... im doing an assignment on these... plz help

    i have a jsp page as follows that requests information from a database
    <body>
    <form method="post" action="http://localhost/servlet/JobServlet">
    View Job Details:
    Enter job number <input name="jobno" type="text" id="jobno" />
    <input name="view" type="submit" id="view" value="View Details" />
    </form> </body>
    my interface:
    import java.rmi.*;
    public interface JobInt extends Remote {
    public String getDetails(int jobno) throws RemoteException; }
    the server:
    import java.rmi.*;
    public class JobServer {
    public static void main(String[] args) {
    try {
    JobImpl j = new JobImpl();
    Naming.rebind("//"+"localhost"+"/JobImpl",j); System.out.println("Registered"); }
    catch (Exception e) {
    System.out.println("Exception occured in JobServer ... " +e); } } }
    implementation:
    import java.rmi.*;
    import java.rmi.server.*;
    import java.sql.*;
    public class JobImpl extends UnicastRemoteObject implements JobInt {
    Connection con; Statement st; ResultSet rs;
    String url = "jdbc:mysql://localhost:3306/db?user=root;password=admin";
    public JobImpl() throws RemoteException {
    super();
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection(url, "", "");
    st = con.createStatement(); }
    catch (Exception e) {
    System.out.println("problem while establishing connection"+e); } }
    public String getDetails(int jobno) throws RemoteException {
    try {
    rs = st.executeQuery("Select * from job where jobno="+jobno);
    rs.next();
    return(rs.getString(2)); }
    catch (Exception e) {
    e.printStackTrace(); }
    return null; } }
    from the jsp page, when the jobno is entered all the details about the job should be displayed on the servlet
    the servlet:
    import java.rmi.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class JobServlet extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    PrintWriter out = res.getWriter();
    res.setContentType("text/plain");
    try {
    int jobno = Integer.parseInt(req.getParameter("jobno"));
    JobInt j = (JobInt)Naming.lookup("//"+"localhost"+"/JobInt");
    System.out.println("Job Details: "+j.getDetails(jobno)); }
    catch (Exception e1) {
    System.out.println(""+e1); } } }
    i get a HTTP 405 error... i really dont know whats the problem and y it doesnt work... im doing an assignment on these... plz help

  • RMI and mysql

    hello... i just have a question... im a little confused...
    i am developing an rmi application... for now, my database connection to mysql is in my implementation file...
    if instead of having the connection there, if its in a servlet, does that change something or does it work the same?
    thank you...

    hello... i just have a question... im a little
    confused...
    i am developing an rmi application... for now, my
    database connection to mysql is in my implementation
    file... I have no idea what an "implementation file" is.

  • Servlet mySQL help needed

    Hey Guys... I have a servlet located on the same server as my mySQL database, which is supposed to gather data from the database. Then I have client code, which is supposed to connect to the servlet from some other remote machine, and get the data from the servlet. I had to do it this way because my webhost does not allow remote access to the mySQL database. But my servlet code is not working, no data is being gathered. And I'm betting my client code is incorrect too. I've never had to connect to a servlet from a remote app, I've always connected directly to the database...sooo could you check my code and show me what is wrong and how to do it correctly? (note I XXX'ed out passwords, etc) Thank you...
    LOCAL SERVLET
    public class ServletTest extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
             response.setContentType("text/html");
              PrintWriter out = response.getWriter();
             Connection myConnection;
            Statement myStatement;
            String url="jdbc:mysql://localhost/tsptracker_com?user=XXX&password=XXX";
            String query = "SELECT * FROM fund_data ORDER BY datadate DESC LIMIT 2";
            try { Class.forName("org.gjt.mm.mysql.Driver").newInstance(); }
            catch (Exception e)
            { System.err.print("Unable to load driver"); }
            try
                myConnection = DriverManager.getConnection (url, XXX, XXX);
                myStatement = myConnection.createStatement();
                ResultSet rs = myStatement.executeQuery(query);
                for(int i = 0; i < 4; i++)
                      int id = rs.getInt("dataID");
                      String dataDate = rs.getString("datadate");
                      double gPrice = rs.getDouble("g_price");
                      double fPrice = rs.getDouble("f_price");
                      double cPrice = rs.getDouble("c_price");
                      double sPrice = rs.getDouble("s_price");
                      double iPrice = rs.getDouble("i_price");
                      String temp = id + " " + dataDate + " " + gPrice + " " +
                           fPrice + " " + cPrice + " " + sPrice + " " + iPrice;
                     out.println(temp);
                myStatement.close();
                myConnection.close();
            catch(SQLException e)
            { System.err.println(e.getMessage()); }
            out.close();
    }REMOTE CLIENT
    public class ClientTest
         public static void main(String[] args) throws Exception
              URL url = new URL("http://www.XXX.com/servlet/Test");
              URLConnection con = url.openConnection();
              con.setDoOutput(false);
              con.setDoInput(true);
              con.setUseCaches(false);
              InputStream in = con.getInputStream();
              String buffer = "";
              for(int i = in.read(); i != -1; i = in.read())
            { buffer += (char)i; }
              in.close();
              System.out.println(buffer + "");
    }

    Hello kkopacz,
    From your code, some of the assumptions seems to appear :
    1) You are having Your Servlet Container and MySql on the same machine.
    2) You are providing your user name and password in your URL for the MySql Driver.
    3) You have mapped the 'ServletTest' class's object by '/servlet/Test' in your Deployment
    Descriptor(web.xml).
    4) You are assuming at least four records in your MySql database : tsptracker_com [ This should be in fact in your while(rs.next()) loop at least though not checked for rs to be null ]
    I would say, try with following changes in your code,
    1) insted of 'myConnection = DriverManager.getConnection (url, XXX, XXX);' in ServletTest
    only say 'myConnection = DriverManager.getConnection (url)', since you are already giving as a part of dbase URL , uname and pwd.
    2) In your ClientTest, try following code
    public class ClientTest
         public static void main(String[] args) throws Exception
              URL url = new URL("http://www.XXX.com/servlet/Test");
    // Since http URL and also set content type in response test/html,
    // U can use HttpURLConnection object.
              HttpURLConnection con = (HttpURLConnection) url.openConnection();
    if(con.getContentLength() == -1) {
    con.connect();
              InputStream in = con.getInputStream();
              String buffer = "";
              for(int i = in.read(); i != -1; i = in.read()) {
    buffer += (char)i;
              in.close();
              System.out.println(buffer + "");
    I hope this should work fine.
    Main prob seems to be in your code, is you are giving unmae and paswd again.. and assumption of recod numbers.
    Anyway, I think this should work for you.
    Cheers
    -Yogi

  • Flash, Servlets & MySQL: Collecting variables

    Hi,
    I have developed a Java Servlet that recieves variables from a Flash file. THe problem is the encoding, i need a way to either convert into the correct encoding for populating into a MySQL db or to extravt the value from the request. Sample code looks like this:
    String name = req.getParameter("name");
    but when populated into the database the HTML tags that make up the HTTP request are still there
    ie <P ALIGN="LEFT"><FONT FACE="AR">Kevin Kilroy</FONT></P>
    Thanks in advance
    Kevin

    best would be to strip the html tags in the flash file. But i don't know Flash, so i have no idea whether and how this can be done.
    You need something like a html stripper. i never used something like this, but i remeber i read about this topic in the forum. There must be a class somewhere in the jdk that is designed to parse a hmtl file and 'grap' the values of the html elements and attributes. I guess this way you should be able get the values you like.
    Do a search in the forum or in the jdk for HTML Parser - i guess you'll find what you need.

  • RMI,Servlets and Java Web Start

    I am a new developer working on a java application. My java GUI will access one server where a user will have an account. This server will store data, execute programs and access other servers for information. I have completed the GUI and I am beginning to build the client-server communication with RMI. There appear to be several tools for doing client-server communication, and while I have read much, I don't understand which is the best to explore. For applets I have read that a good method to use is servlets with RMI. But is this also true for a stand-alone application? If not, what is the best/preferred method? What if I choose to use Java Web Start (which I have not read up on, yet) will the best method of client-server communication change?
    Thanks in advance, shawn

    It depends on your budget too. To me the optimim way to communicate is to use SERVLET/JSP combination for client/server communication.

  • Applets, RMI, and mySQL OH MY!

    This is not gonna be easy to explain, but I will try....
    1) I have successfully created an RMI applet client, and I can access the mySQL database on another server that has both the RMI server and the mySQL together. So this works great.
    2) On further experiment, I have another server that hosts only the mySQL database and not the RMI server. I host the RMI server on the same system as the RMI applet client, including the mySQL driver jar file; the code is exactly the same as in (1) as far as the client/server RMI goes because I pass the host:port information through the client to the RMI server which within invokes the mySQL database connections/queries.
    I find that this fails.
    The RMI client does connect successfully to the RMI server, but
    the RMI server cannot make the call to connect to the remote database.
    The error I received is:
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection refused: connect
    Ok, I am thinking that since I am running an applet and thus in a sandbox, I had assumed that as far as the applet is concerned, the
    RMI client/server is LOCAL and it is no business of the applet to be
    concerned with what the RMI server chooses to do internally, right?
    I mean, in (1) above it all works fine as the RMI server and mySQL
    database is on the same system so everything is LOCAL - but in
    (2) above - seperating the RMI server from the database is not the
    same thing - thus breaks the sandbox rules?
    Care to comment?
    Kind regards,
    Dan

    Gah.... Never mind. I solved my issues. I thought I seperated
    the logic of the RMI host information from the database connectivity
    information and it turns out that I didn't.
    I thought it was Monday but it is Friday obviously at least in locale PST
    Kind regards,
    Dan

  • Dont think RMi is HTTP tunneling through proxy firewall

    Hi Guys,
    Does anyone know how to monitor if RMI is using the option toHTTP tunnel through a proxy ???
    Many of clients sit behind firewalls/proxies that enable HTTP only. I thought RMI would, as a default, use HTTP tunneling POST, RESPONSe methods to get through, but it does not.
    Would that case be insted of using Naming.lokup("RMIServer"); that i should use
    Registry reg = LocateRegistry.getResgistry(serverAddress, serverPort);
    reg.lookup("RMIServer");
    Any help would be greatly appreciated.

    RMI doesn't have an option like that. Sockets do, and you get it for any socket including RMI by setting socksProxyHost and socksProxyPort.
    The RMI HTTP tunnelling thing happens when there is an HTTP server at the server side. which redirects the request to an RMI server via rmi-cgi.cgi or the RMI servlet. It's automatic, as a fallback, and you can enforce its use via a system property which you can find in the Javadoc Guide to Features/Remote Method Invocation/Useful java.rmi system properties.

  • Using normal class file in the servlet

    Hello Friends;
    Now my problem is ;
    I generated a java file ;
    import drasys.or.mp.*;
    import drasys.or.mp.lp.*;
    public class optimize
        public static void main(String[] args)
        try
            int r=1;
            int s=0;
    .This file works perfect. It calls an API and there is no problem. But when I take this code into my servlet, then problem starts. First it says;
    "java.lang.NoClassDefFoundError: drasys/or/mp/ScaleException"
    but I know it is there. And I mounted the jar file.
    Do you think there is a problem with my codes, because it works when it is outside of the servlet.
    My servlet code is as follows;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.net.*;
    import drasys.or.mp.*;
    import drasys.or.mp.lp.*;
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
             try
            int r=1;
            int s=0;
            int n = 3;
            int t,w,u,v,f;
            f = 1;
            int z=0;
            int y = 1;
            int l = 1;
            double [][][][] C = new double [1][1][n-1][n];
            double [][][][] D = new double [1][1][n-1][n];
            C[0][0][0][1]=2.5-0.92*r;
            C[0][0][0][2]=1.43-0.37*r;
            C[0][0][1][2]=1.14-0.48*r;
            D[0][0][0][1]=0.65*r+0.94;
            D[0][0][0][2]=0.31*r+0.75;
            D[0][0][1][2]=0.27*r+0.40;
         SizableProblemI prob = new Problem(n*(n-1)+1,n);
            prob.getMetadata().put("lp.isMaximize", "true");
            prob.newVariable("Lambda").setObjectiveCoefficient(1.0);
            for (t=0;t<=(n-1);t++)
                prob.newVariable("W"+t).setObjectiveCoefficient(0);
            final byte LTE = Constraint.LESS;
            final byte EQU = Constraint.EQUAL;
            for (v = 1;v <= n*(n-1);v++)
                   prob.newConstraint("constr"+v).setType(LTE).setRightHandSide(y);
                prob.newConstraint("constr"+(n*(n-1)+1)).setType(EQU).setRightHandSide(1);
                // here, we are creating coefficients for lambda.
            for (u = 1; u <= n*(n-1); u++)
                    prob.setCoefficientAt("constr"+u,"Lambda",y);
    // here, we are creating coefficients for W�s.
            for(t = 0 ; t <= (n-2); t++)
                for (w = 1; w <= (n-1); w++)
                     if (t<w)
                         prob.setCoefficientAt("constr"+l, "W"+t, 1);
                         prob.setCoefficientAt("constr"+l,"W"+w, (-C[s][z][t][w]));
                         l = l + 1;
                         prob.setCoefficientAt("constr"+l, "W"+t, -1.0);
                         prob.setCoefficientAt("constr"+l, "W"+w, D[s][z][t][w]);
                         l = l + 1;
    /* here , we are creating coefficients for the last formula which is w1+w2+w3+....Wn = 1 */
                for (f=0; f <= (n-1); f++)
                prob.setCoefficientAt("constr"+(n*(n-1)+1), "W"+f, 1);
    /* API finds the solution below.*/
         LinearProgrammingI lp = new DenseSimplex(prob);
            double ans = lp.solve();
            System.out.println("Solution"+r+"="+ans);
            System.out.println(lp.getSolution());
            catch (drasys.or.mp.DuplicateException first)
             first.getMessage();
            catch (drasys.or.mp.NotFoundException second)
            catch (drasys.or.mp.InvalidException third)
            catch (drasys.or.mp.NoSolutionException fourth)
            catch (drasys.or.mp.UnboundedException fifth)
            catch (drasys.or.mp.InfeasibleException sixth)
            catch (drasys.or.mp.ConvergenceException seventh)
            catch (drasys.or.mp.ScaleException eigth)
               eigth.toString();
       

    Thanks a lot for the reply.
    Forgive me, I have no object oriented background,
    even programming. I am just in the learning phase.This is a pretty advanced problem to tackle for your first programming task.
    That's why it doesn't follow OO concepts. This part
    will be connected to user input part, that I've
    completed .Hmmm.
    Successful programming depends on one idea: "divide and conquer". You take a big problem and solve it by dividing it into smaller chunks that you CAN handle. You get the solution you want by bringing the smaller chunks together.
    In your case I'd recommend that you get the optimization code into a single object that you can test off-line, without Tomcat. It looks like you started to do that with your optimize class, but the mistake you made is to put so much code into the main() method. You can only call that on the command line. Better to encapsulate the rest of it into small methods that will let you instantiate an instance of optimize and call its methods. Once you have that working you can wrap it in a servlet if you want to use it in a Web app.
    Separate how your optimizer gets its data from how it processes it. On a desktop app, it might be convenient to read input from a file on disk. A Web app might be better served by an XML stream.
    Why I said "I know it is there" because it doesn't
    give any other error message than that one, if it
    couldn't see the jar file, wouldn't it give me lots
    of error messages? Don't assume anything. It only needs one error, which is the one you get when it can't find a class. How many more do you need? The class loader couldn't find that class, so it printed the message and stopped.
    "I mounted" the jar file means I'm using Netbeans, I
    mounted it to that environment as suggested by
    Netbeans, If you don't know Java or programming well, I'm guessing that you also don't know NetBeans. I'd recommend that you figure out how to make all this work without NetBeans before you add another complication to your life.
    If you don't use NetBeans, all you have to do is add the JAR to your CLASSPATH using the -classpath option on javac.exe when you compile and java.exe when you execute.
    Tomcat assumes that all the JAR files in your Web app's WEB-INF/lib are in the CLASSPATH. If you put it in there, Tomcat will find it.
    you're right, I'm using Tomcat 5.0,
    everything is working fine, user input servlets,
    mysql connection etc. Only this part is causing the
    problem now.If you've already got a Web app deployed and connected to MySQL, you're not doing too badly. Kudos to you - that's not too bad for someone who claims to be a programming novice.
    I'll put that jar file into lib folder as you suggested thanks.I think that might be all you'll need. Try it and see.
    Actually I saw an example it was using "throws
    exception" , I couldn't figure out where to put it,
    and I decided to get rid of the compiling errors just
    putting bunch of catch statements.If you're saying that your code is throwing a lot of checked exceptions, and you added these extra catch blocks to get rid of them, another way to do it would be to simply have a single catch block, like this:
    try
        // your code in here
    catch (Exception e)
        e.printStackTrace();
    }Polymorphism says that this catch block will handle all checked exceptions.
    >
    Looks like I don't know anything but I'm trying to
    handle a big thing :))).Indeed you are. Anyone who can write a Web app and connect it to a relational database on their first try is hardly helpless. We're all ignorant, just about different things. Keep digging - you'll make this work.
    But thank you soooo much for your detailed answer, and happy new year.
    Shamil.And the same to you, Shamil. Good luck, and let me know how you make out.
    %

  • RMI Server and RMI Client Problem

    First, Hi!
    I have create my RMI Server and a RMI Servlet client.
    I can run the server and servlet first time and it works fine.
    Then, I stop rmiregistry and server.
    Then, I start rmiregistry and server for a second time but my RMI Servlet client gets a
    java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.xxx; nested exception is: java.net.ConnectException: Connection refused
    If I copy the class again where the servlets resides, it works again. But I have to keep doing that. I have to keep copying the class file to the servlet directory every 2nd time I try to run it for it to work.
    Anyone know what am I doing wrong?

    First, Hi!
    I have create my RMI Server and a RMI Servlet client.
    I can run the server and servlet first time and it
    works fine.
    Then, I stop rmiregistry and server.
    Then, I start rmiregistry and server for a second time
    but my RMI Servlet client gets a
    java.rmi.ConnectException: Connection refused to host:
    xxx.xxx.xxx.xxx; nested exception is:
    java.net.ConnectException: Connection refused
    If I copy the class again where the servlets resides,which class file ? u mean RMIServer's class files ??
    I have faced the same problem too. In my case if i just restart my Tomcat webserver the error goes and the servlet is very well able to connect back to the RMI Server
    it works again. But I have to keep doing that. I have
    to keep copying the class file to the servlet
    directory every 2nd time I try to run it for it to
    work.
    Anyone know what am I doing wrong?

  • RMI Tunneling - Please Help

    Hello
    I am trying to get RMI tunneling to work and am having problems. I have read the documentation and have setup my environment as recommended. Specifically -- my rmi.xml file looks like this:
    <?xml version = '1.0' standalone = 'yes'?>
    <!DOCTYPE rmi-server PUBLIC "Orion RMI-server" "http://xmlns.oracle.com/ias/dtds/rmi-server.dtd">
    <rmi-server port="23791">     
    <log>
    <file path="../log/rmi.log"/>
    </log>
    </rmi-server>
    My global-web-application.xml file contains these entries:
    <servlet>
    <servlet-name>rmi</servlet-name>
    <servlet-class>com.evermind.server.rmi.RMIHttpTunnelServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>rmi</servlet-name>
    <url-pattern>/*.tunnelrmi</url-pattern>
    </servlet-mapping>
    The URL I am using to get the initial context is this:
    http:ormi://myserver:7777/NEATS
    When I attempt a lookup for one of my EJBs I get the following exception:
    javax.naming.NamingException: Lookup error: javax.naming.AuthenticationException: No such domain/application: NEATS; nested exception is:
         javax.naming.AuthenticationException: No such domain/application: NEATS
    7777 is the port that my Oracle HTTP server listens on.
    This application is deployed in one of several OC4J components that I have configured in a single 9iAS instance. Is there some additional configuration I need to do for Apache to get the request forwarded to the right application? Maybe the multiple OC4J components are causing me trouble?
    Any help anyone can offer would be much appreciated!
    Thanks
    Chris Sargent

    Hi Chris!
    Did you ever get this to work? If so what was the solution!
    Thanks!

  • RMI through firewall

    I want to know if RMI http tunniling works fine, or if it is hard to do.
    Before I start to testing, I need to clarify some doubts.
    Why JDK windows distribution doesn't have java-rmi.cgi file for http tunneling?
    The bin directory has a file java-rmi.exe that I don't know what it does. I couldn't find many information about this.

    Because you should use the RMI servlet that comes in the samples.

  • Reading input from servlet works in Windows but not Kubuntu

    I'm working on an applet/servlet/mysql database application and recently switched from Windows Vista (yeah, yeah) to Kubuntu Gutsy Gibbon. In Vista, everything worked fine (bet you've never heard anyone say that before), but in Kubuntu, I get a FileNotFound exception at the line where I initialize the ObjectInputStream (the ObjectOutputStream line doesn't throw an exception, but it doesn't look like that one works either (I output queries and such to the log files when the servlet receives them, but the logs are empty)). I tried everything I could think of (tomcat is fine, the servlet is where it should be, etc), but nothing seems to work.
    Here's the code from my applet:
    //open the connection to the servlet
    URLConnection servletConnection = servletLocation.openConnection();
    //inform the connection that we will send output and accept input
    servletConnection.setDoOutput(true);
    servletConnection.setDoInput(true);
    //don't use a cached version of URL connection.
    servletConnection.setUseCaches(false);
    servletConnection.setDefaultUseCaches(false);
    //we will send java serialized objects
    servletConnection.setRequestProperty("Content-Type", "application/x-java-serialized-object");
    //send the object to the servlet using serialization
    //*THIS LINE DOESN'T THROW AN EXCEPTION*/
    ObjectOutputStream output=new ObjectOutputStream(servletConnection.getOutputStream());
    //serialize the object
    output.writeObject(data);
    output.flush();     
    output.close();
    //get the object input stream and receive a vector
    /*THIS LINE THROWS A FILENOTFOUND EXCEPTION*/
    ObjectInputStream input=new ObjectInputStream(servletConnection.getInputStream());               
    thing = input.readObject();
    input.close();
    As you can see, I use the same servletConnection for both the output as well as the input. I don't know why one would work and not the other.
    Any input would be great. Just to reiterate, it worked fine in Vista. I'm boggled.
    Thanks.

    If its a sand box restriction you should get a security restriction. How ever getting a FileNotFountException in an applet means that your code try to access a local file some ware which is not allowed in an applet unless it is signed.
    Give us the code that you use to create the URL object. You should not use hard coded URLs in an applet. You have to get the Document URL or Codebase URL of applet and then modify it to derive the URL of the servlet.

  • How can i display HTML text in a TextArea

    Hello All,
    We are developing a chat application using Java Swing and RMI with MySQL as backend.
    We have two options.The users can chat thro both browser and application(Swing GUI).
    Now when a user who chats thro a browser sends a message,the chat contents are stored in HTML format in the database (like <BR><font>R u There?</Font></BR>).When the other user happens to chat thro the application,the chat contents send by the other user has to appear in the HTML format in the TextArea of the application.So obviously the textarea shud understand the HTML and display it accordingly.
    How can i do this?Kindly give me an example with some code samples if i have to use EditorPane etc 'coz i haven't got any experience using EditorPanes.
    Thanks in advance
    Regards
    Vijayakannan

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test extends JFrame {
        public Test() {
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Container content = getContentPane();
         JEditorPane jep = new JEditorPane("text/html",
                  "Joe: <font color=red>R u <b>There</b>?</Font><BR>"+
                  "Mary: <font color=green>Keep ur shorts on...</Font>");
         content.add(new JScrollPane(jep), BorderLayout.CENTER);
         setSize(200,200);
         show();
        public static void main(String[] args) { new Test(); }
    }

  • Troubles writing to file and printing characters above 127

    Hi,
    Whenever I write to a file or to the standard output (System.out), all characters above 127 are replaced by a question mark.
    I only started having this problem after upgrading to jdk 1.3.1, with previous version all was fine. I'm using slackware linux 7.0.
    output of java -version
    java version "1.3.1"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
    Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
    After reading a lot about internationalization I still can't solve my problem.
    The output of the following code:
    System.out.println(java.util.Locale.getDefault().getDisplayName());
    System.out.println( System.getProperty("file.enconding"));
    is:
    English (United States)
    null
    Shouldn't the file.encoding property be set?
    I've tried setting it:
    System.out.println( System.setProperty("file.enconding","UTF8"));
    but the aplication simply hangs at that line.
    Please help!

    Hi,
    I am having similiar problem as posted by you in the message - ours is a web application hosted on Apache - JServ, JDK 1.2.1, Servlets, MySQL, and SunOS 5.6. We have recently upgraded to JDK 1.3.1 and SunOS 5.8.
    The application works fine except for the internationalization code.
    The web application support 8 languages. The application works fine for english but for asian languages (korean,japanese,traditional chinese,simplified chinese), all characters are replaced by question marks. Similarly some characters in latin based languages (german,french,italian)are replaced by question marks.
    I am wondering if you can share the solution - i think it should be applicable to us also.
    The mechanism used by us is to set the content type in the HTTPServletResponse object and use output stream writer to send localized information to browser:
    res.setContentType("text/html;charset=EUC_JP");
    OutputStreamWriter out = new BufferedWriter( new OutputStreamWriter(this.oHttpResponse.getOutputStream() ), 512 );
    Regards,
    Kapil Kapoor.

Maybe you are looking for

  • "Connect to server" inserts "afp://" in front of "vnc://"? 10.4.11

    Hi All: I have a macbook running 10.4.11 connecting to the internet through a wireless router. I'm trying to connect to a vnc server in a remote location. When I go to "connect to server" and enter: vnc://[ip address] the "connecting to server" windo

  • What are the differences between Acrobat 8 and XI?

    I currently work with Adobe 8 and I'm experiencing difficulties with some types of PDF's. PDF's with Layar or links (interactive ones). Also forms do not work at their best. I would like to upgrade to XI, but my boss is not convinced that it is neces

  • TS4001 iCloud created thousands of duplicate bookmarks

    My iCloud account created thousands of duplicate bookmarks.  I would like to delete them all.  Any thoughts on how I could go about this?

  • ECC 6.0 with EHP4 fresh Installation

    Hello Gurus, A fresh ECC 6.0 with EHP4 needs to be installed on Wnidows + Oracle Platform, please let me know which of the following path should be followed? 1. SAP NW 7.0 installation (without EHP1)  --> EHP 1 installation --> EHP4 Installation 2. S

  • IMAP protocol for email router

    Hi All, Is Email Router for MS CRM 2015 support IMAP protocol? I have follow this link https://technet.microsoft.com/en-us/library/dn832099.aspx?f=255&MSPPError=-2147217396 Internet Message Access Protocol (IMAP) email servers are currently not suppo