Hi,
I'm trying to write to a servlet running on another web server running on
the same box, using HttpURLConnection. The response from the servlet
provides the content for a JSP page. After successfully writing to the
servlet, the program would read the output(response) from the servlet.

Please tell me what is the problem with this code:

try {
        context = new InitialContext();
        url = (URL)context.lookup("java:comp/env/url/MyURL");
        connection = (HttpURLConnection)url.openConnection();
        responseCode = connection.getResponseCode();
     } catch (Exception ex) {
         throw new EJBException(ex.getMessage());
     }
    if (responseCode != HttpURLConnection.HTTP_OK) {
        throw new HTTPResponseException("HTTP response code: " +
           String.valueOf(responseCode));
     }

-->     connection.setDoOutput(true);


At run time, when the control comes to the last line, an exception is
raised and the client reports the following error message:

Caught an unexpected exception!
java.rmi.ServerException: RemoteException occurred in server thread; nested
exception is:
        java.rmi.RemoteException: Unknown Exception/Error thrown by EJB
method.; nested exception is:
        java.lang.IllegalAccessError: Already connected
java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.;
nested exception is:
        java.lang.IllegalAccessError: Already connected
java.lang.IllegalAccessError: Already connected
        <<no stack trace available>>

If you know of any resource that has a solution to this problem, please let
me know.

Thanks,
Sanjay
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to