Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

calling servlet from a java class loaded inside the database.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,

I have a java class (source code given below)loaded inside Oracle 9i. The status of the class file is valid in the database. This java class has to call the servlet running on the web server. HTTP being used to connect to the webserver.

At run time I am getting the following error when I try to connect to the web server.

java.net.SocketException: Invalid argument
Invalid argument
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:320)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:133)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:120)
at java.net.Socket.<init>(Socket.java:273)
at java.net.Socket.<init>(Socket.java:100)
at sun.net.NetworkClient.doConnect(NetworkClient.java:55)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:335)


The java class loaded inside database is :

import java.net.URL;
import java.net.URLConnection;
import java.io.*;

public class CargoDstMsg {
public static String doCall(int seq_num, int flag) {
try {
String servletURL = "http://" + url1 + ":" + 9099 + "/TestWebApp/SessionServlet" ;

URL url = new URL(servletURL);

URLConnection conn = url.openConnection();

conn.setRequestProperty("obj","Message from Stored Procedure");
conn.connect();
return "success";

} catch(Exception ex ) {

StringWriter sw = new StringWriter();

PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
String status = sw.toString();
return status;
}
}
}


If any one knows how to tackle with this exception please do let us know.


Thanks,
Abdur Rahman.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Abdur,
Please don't post the same question in multiple forums.

Thanks,
Jeanne
Oracle Forum Bartender
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic