• Post Reply 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

URL HTTPS MalformedURLException

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am having difficulty reading from an https url. I can run my servlet from the command line (main) and it works correctly. When I put it in WebSphere it gives:
java.net.MalformedURLException: unknown protocol: https
I have the 3 jars in the classpath. And I'm setting setProperty and addProvider.
Can anyone shed some light on this.
try{
// create a new protocol handler
System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
// protocol handler uses this security provider
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
URL url = new URL("https://www.somesite.com");
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
br.close();
}
catch(NoClassDefFoundError ncdfe){
System.out.println(ncdfe.toString());
}
catch(Exception ex){
System.out.println(ex.toString());
}
Thanks
 
It's fun to be me, and still legal in 9 states! Wanna see my tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic