Hi!

Stand alone pplication means running the application from the command prompt 
i.e. java -jar <jar file name>, not in the jboss. if i try to deploy it as a 
service it starts giving the exception, where it works fine in the previous 
case.

I am using JAXRPC in my application. here is the code snippet which does the 
handshake with the application server on port 443(I am using kestore at the 
server side and certificate at the client)

    public Object getService(String serverURL) throws Exception {
  |         StatusListener statusListener = null;
  |         String JBOSS_HOME = System.getenv("JBOSS_HOME");
  | 
  |         mLogger.info("certfcate name in servcie locator>>" + certificate);
  |         String pathToCert = "c:\\certificate\\svsos.cer";
  |         mLogger.info("Path of certificate in  service Utility =======" + 
pathToCert);
  |         
  |         SSLContext ctx = null;
  |         TrustManagerFactory tmf = null;
  |         KeyStore ksSvr = KeyStore.getInstance("JKS");
  |         ksSvr.load(null, null);
  |         FileInputStream fis = new FileInputStream(pathToCert);
  |         CertificateFactory cfe = CertificateFactory.getInstance("X.509");
  |         Collection c = cfe.generateCertificates(fis);
  |         Iterator i = c.iterator();
  |         Certificate cert = null;
  |         while (i.hasNext()) {
  |             cert = (Certificate) i.next();
  |         }
  |         ksSvr.setCertificateEntry("sos", cert);
  |         tmf = TrustManagerFactory.getInstance("SunX509");
  |         tmf.init(ksSvr);
  |         // initialize context with server certificate.....
  |         ctx = SSLContext.getInstance("TLSv1");
  |         ctx.init(null, tmf.getTrustManagers(), null);
  |         // get socket factory class....
  |         SSLSocketFactory factory = ctx.getSocketFactory();
  | 
  |         HttpsURLConnection.setDefaultSSLSocketFactory(factory);
  |         Service service = null;
  |         String urlstr = "https://"; + serverURL + 
ReplicationConfigParser.getInstance().getWebserviceContext();
  |         mLogger.info("Contacting webservice at " + urlstr);
  |         URL url = new URL(urlstr);
  | 
  |         HostnameVerifier hv = new HostnameVerifier() {
  |             public boolean verify(String urlHostName, SSLSession session) {
  |                 return true;
  |             }
  |         };
  |         HttpsURLConnection.setDefaultHostnameVerifier(hv);
  |         QName qname = new 
QName(ReplicationConfigParser.getInstance().getNamespaceURI(), 
ReplicationConfigParser.getInstance().getLocalPart());
  |         ServiceFactory factory1 = ServiceFactory.newInstance();
  |         service = factory1.createService(url, qname);
  |         statusListener = (StatusListener) 
service.getPort(StatusListener.class);
  |         return statusListener;
  |     }

if u get any idea where the problem is, please let me know.

Thanks

Hardeep

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956225#3956225

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956225

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to