System.setProperty("http.agent"..) appends Java/1.6

In my JAVA program I set the user agent with
System.setProperty("http.agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
But I see from packet sniffing that JAVA appends " Java/1.6" to the user agent that I'm trying to set.
This causes a web page that I am trying to read to stop responding.
Does anyone know how to get around this?
thanks,
William

You should set the request header with that user agent, not the system property.
That said, a website won't block requests without any legal reason. Stop whatever you're doing and contact the web master immediately. Otherwise you may get in bigger trouble sooner or later.

Similar Messages

  • Bad http.agent in Java properties : a bug in the HTTP user-agent string?

    Hi all,
    Me :
    I'm patching AWSTATS (web log analyzer tool) in order to recognize which Java version has
    been used to download files.
    Context of the problem :
    Each time a Java program (or applet) is downloading a file (for example .class, .png, .html)
    from a web server, a line will be added in the web server log file. If the web server is well
    configured, the user agent used to download the file will be at the end of the line in the log file.
    For Sun Java JVM, the user agent string is configured in the Java properties under "http.agent".
    Usually, the user-agent string contains the word "Java" and the virtual machine version. In most
    cases, this is just a string like "Java/1.4.2", so this is relatively easy to parse.
    Problem :
    Looking in my web server stats, and then on the web, I found that a JVM's user-agent is
    "Mozilla/4.0 (Windows XP 5.1)", which obviously does not contains the word "Java".
    Consequently, it is difficult to say that this user-agent string belongs to a JVM.
    Further look in my log files and on google shows that this http.agent string appears
    on Microsoft Internet Explorer (it seems MSIE 6.0) over Windows XP with the J2RE plugin:
    http://board.gulli.com/thread/300321
    http://forum.java.sun.com/thread.jsp?thread=531295&forum=30&message=2559523
    http://forum.java.sun.com/thread.jsp?forum=63&thread=132769&start=210&range=15&tstart=0&trange=15
    http://forum.java.sun.com/thread.jsp?forum=32&thread=480899
    http://www.goodidea.ru/setupJava/javaInstall.htm
    The J2RE plugin version does not seems to play a role as this user-agent string has
    been seen on 1.4.1_02-b06, 1.4.2_01, 1.4.2_03 and 1.4.2_04-b05.
    Further information requested :
    I would like to know:
    1) if you have reported the same problem;
    2) if there is some rules for the http.agent property;
    3) if this is a bug.
    Thank you very much, and feel free to add you opinion.
    Julien

    The web log files where the "Mozilla/4.0 (Windows XP 5.1)" user-agent appears can be displayed using the following search terms on google :
    "Mozilla/4.0 (Windows XP 5.1)" -"(Windows XP 5.1) Java"
    http://www.google.ch/search?hl=fr&ie=UTF-8&q=%22Mozilla%2F4.0+%28Windows+XP+5.1%29%22+-%22%28Windows+XP+5.1%29+Java%22&btnG=Rechercher&meta=
    Julien

  • System.setProperty(key,value )

    Where do i find information about diffrent keys (name of system properties )
    i am using following once but where do i find all the listings.
    System.setProperty ("http.proxyHost", "myserver");
    System.setProperty ("http.proxyPort", "8080");
    Vijay

    I get this output not htto.* properties
    java.runtime.name
    sun.boot.library.path
    java.vm.version
    java.vm.vendor
    java.vendor.url
    path.separator
    java.vm.name
    file.encoding.pkg
    user.country
    sun.os.patch.level
    java.vm.specification.name
    user.dir
    java.runtime.version
    java.awt.graphicsenv
    java.endorsed.dirs
    os.arch
    java.io.tmpdir
    line.separator
    java.vm.specification.vendor
    user.variant
    os.name
    sun.java2d.fontpath
    java.library.path
    java.specification.name
    java.class.version
    java.util.prefs.PreferencesFactor
    os.version
    user.home
    user.timezone
    java.awt.printerjob
    file.encoding
    java.specification.version
    user.name
    java.class.path
    java.vm.specification.version
    sun.arch.data.model
    java.home
    java.specification.vendor
    user.language
    awt.toolkit
    java.vm.info
    java.version
    java.ext.dirs
    sun.boot.class.path
    java.vendor
    file.separator
    java.vendor.url.bug
    sun.cpu.endian
    sun.io.unicode.encoding
    sun.cpu.isalist
    vijay

  • System.setProperty("java.class.path", cp)

    hello,
    I have written a little program that is supposed to set the CLASSPATH var in a instance of
    bash ... not set it permantly. Anyway, after running the program when i run,
    echo $CLASSPATH
    none of the changes i make with the program are there.... why is this?
    thanks,
    jd
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import layout.TableLayout;
    import com.incors.plaf.kunststoff.KunststoffLookAndFeel;
    public class JPathGui extends JFrame{
         JButton cpSubmit;
         JButton cpClear;
         JButton qaSubmit;
         JButton qaClear;
         JTextField cptf;
         JTextField qatf;
         public JPathGui(){
              super("JPATH ver .001");
              try {
                        UIManager.setLookAndFeel(new KunststoffLookAndFeel());
                 } catch (Exception ignored) {}
              addWindowListener(new WindowAdapter()
                     public void windowClosing(WindowEvent e){
                    System.exit(0);
              JPanel mainPanel = new JPanel();
              mainPanel.setPreferredSize(new java.awt.Dimension(800,230));
              double[][] size = {{10,780,10},{20,30,5,30,10,20,30,5,30}};
            TableLayout layout = new TableLayout(size);
            mainPanel.setLayout(layout);
              myGetClassPath(mainPanel);
              myQuickAdd(mainPanel);          
              getContentPane().add(mainPanel);
              pack();
            setSize(820,230);
            setVisible(true);
         public void myGetClassPath(JPanel mainPanel){
              JLabel cpl = new JLabel("ClassPath");
              JPath jp = new JPath();     
              cptf = new JTextField(jp.getClassPath());
              cptf.setFont( new Font("Monospaced", Font.PLAIN, 10) );
              cptf.setPreferredSize(new java.awt.Dimension(780,50));
              mainPanel.add(cpl, "1,0");
              mainPanel.add(cptf, "1,1");
              JPanel cpActionPanel = new JPanel();
              cpActionPanel.setPreferredSize(new java.awt.Dimension(780,50));
              double[][] size1 = {{570,100,100,30},{30}};
            TableLayout layout1 = new TableLayout(size1);
            cpActionPanel.setLayout(layout1);
              cpSubmit = new JButton("Submit");
              cpClear = new JButton("Clear");
              cpSubmit.setSize(40,20);
              cpClear.setSize(40,20);
              cpSubmit.addMouseListener(new command_listner());
              cpClear.addMouseListener(new command_listner());
              cpActionPanel.add(cpSubmit , "1,0");
              cpActionPanel.add(cpClear, "2,0");
              mainPanel.add(cpActionPanel, "1,3");
         public void updateCPTF(){
              JPath jp = new JPath();     
              cptf.setText(jp.getClassPath());
         public void myQuickAdd(JPanel mainPanel){
              JLabel qal = new JLabel("QuickAdd");
              qatf = new JTextField();
              qatf.setFont( new Font("Monospaced", Font.PLAIN, 10) );
              qatf.setPreferredSize(new java.awt.Dimension(780,50));
              mainPanel.add(qal, "1,5");
              mainPanel.add(qatf, "1,6");
              JPanel qaActionPanel = new JPanel();
              qaActionPanel.setPreferredSize(new java.awt.Dimension(780,50));
              double[][] size2 = {{570,100,100,30},{30}};
            TableLayout layout2 = new TableLayout(size2);
            qaActionPanel.setLayout(layout2);
              qaSubmit = new JButton("Submit");
              qaClear = new JButton("Clear");
              qaSubmit.setSize(40,20);
              qaClear.setSize(40,20);
              qaSubmit.addMouseListener(new command_listner());
              qaClear.addMouseListener(new command_listner());
              qaActionPanel.add(qaSubmit , "1,0");
              qaActionPanel.add(qaClear, "2,0");
              mainPanel.add(qaActionPanel, "1,8");
         public class command_listner extends MouseAdapter{
                 public void mouseClicked(java.awt.event.MouseEvent evt){
                       Object source = evt.getSource();
                   //cpSubmit
                   if(source == cpSubmit){
                        JPath jp = new JPath();
                        String newCP = cptf.getText();
                        boolean b = false;
                        String olcp = jp.setClassPath(newCP,b);
                        updateCPTF();
                   //cpClear
                   else if(source == cpClear){
                        updateCPTF();
                   //qaSubmit
                   else if(source == qaSubmit){
                        JPath jp = new JPath();
                        String newCP = qatf.getText();
                        boolean b = true;
                        String olcp = jp.setClassPath(newCP,b);
                        qatf.setText(null);
                        updateCPTF();
                   //qaClear
                   else if(source == qaClear){
                        qatf.setText(null);
         public class JPath {
              public String getClassPath(){
                   String cp = System.getProperty("java.class.path");
                   return cp;
              public String getPathSep(){
                   String ps = System.getProperty("path.separator");
                   return ps;
              public String getUserName(){
                   String un = System.getProperty("user.name");
                   return un;
              public String getUserHome(){
                   String uh = System.getProperty("user.home");
                   return uh;
              public String getOSName(){
                   String osn = System.getProperty("os.name");
                   return osn;
              public String getOSVersion(){
                   String osv = System.getProperty("os.version");
                   return osv;
              public String setClassPath(String newClassPath, boolean append){
                   String oldClassPath = null;
                   if(append){
                        String cp = getClassPath() + getPathSep() + newClassPath;
                        System.out.println("from setClassPath" + cp);
                        oldClassPath = System.setProperty("java.class.path", cp);
                   else{
                        System.out.println("else - " + newClassPath);
                        oldClassPath = System.setProperty("java.class.path", newClassPath);
                   return oldClassPath;          
         public static void main(String[] args){
              JPathGui jpg = new JPathGui();
    }     

    Two reasons:
    1) Setting the system property java.class.path does not change the value of the CLASSPATH environment variable in the first place.
    2) Even if it did, the change would not be visible in the original shell because the environment of the Java subprocess is destroyed. You can't change the environment of the parent process from any subprocess, including shell scripts. (That's why you have to "source" and not run .bashrc or .profile to customize environment settings)

  • System.setProperty("java.library.path")  question

    Is there a way to dynamically specify which directories the System.loadLibrary picks up its DLL's and libraries from ?
    I have read a few places saying no, however, WHY even have a System.setProperty("java.library.path") function? If there truly is not, then can there be a jni directory added to the WAR directory structure so that tomcat et. al. can access them

    Is there a way to dynamically specify which
    directories the System.loadLibrary picks up its DLL's
    and libraries from ?No.
    You can however use System.load().
    I have read a few places saying no, however, WHY even
    have a System.setProperty("java.library.path")
    function? That are many reasons for having setProperty(). For example if you want to set your own property.
    If there truly is not, then can there be a
    jni directory added to the WAR directory structure
    so that tomcat et. al. can access themBecause it extracts them into a directory which is in the OS path presumably.
    The OS, not java, loads shared libraries. And that means that the OS has to be able to find it. So JNIs are not loaded from a war/jar. They must be extracted first.

  • Java System.setProperty  (get JMenuBar on mac menu bar)

    Hi,
    I am currently building a Java application using Eclipse IDE. I have written GUI programs on OS X 10.4 before and managed to get the JMenuBar on the mac menu bar using
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    But for some reason when using leopard the JMenuBar seems to disappear totally. When i don't use the above line it shows on the JFrame as it should do.
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "AppName");
    The above line doesn't work either with OS X 10.5
    Anyone have any experience with this and had any success?
    Thanks,
    Sion

    Hi Sion
    Welcome to Apple Discussions.
    You might be able to work around these problems using Jar Bundler, which takes a Jar file and converts it into a Mac OS X application. One of the options is to use the top line menu bar (instead of having it at the top of the frame).
    Find Jar Bundler in /Developer/Applications/Java Tools
    Bob

  • System.setProperty("java.security.auth.login.config","rajesh.txt");

    Dear All,
    System.setProperty("java.security.auth.login.config","rajesh.txt");
    Is this a right way to define system property. Since I am not able to set this property. Even from cmd prompt also
    I have tried. But no use. Please suggest me, what elseI have to do to set this property.
    Thanks,
    Rajesh

    hi,
    Thanks for your response, finally i got solution. As you told I just check with file path, it works.
    regards
    rajesh

  • Making https: connection from java code loaded into Oracle 8i database

    A bit of a blast from the past, really, as 8i provides a JVM at 1.2.2.
    I need to provide an PL/SQL function which accesses a RESTful web service requiring https connection. Got the call working under 1.2 locally without much trouble using:
    static {
            System.setProperty("java.protocol.handler.pkgs",
                    "com.sun.net.ssl.internal.www.protocol");
            Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
        }The trick is to get the Oracle database to run the code internally. What libraries do I need where? I get an extremely unhelpful NoClassDefFoundError, without mention of the offending class.
    By doing loadjava with jcert.jar,. jnet.jar and jsse.jar (the libraries I'm using with the test program) I can get loadjava to accept and allegedly resolve the class.

    endasil wrote:
    malcolmmc wrote:
    Well, sadly look at the colour scheme.Yeah, sarcastic was I. The NoClassDef error seriously doesn't give a class name? I find it astonishing that any implementation would be that stupid.Seriously. The strange thing is that before I got to the NoClassDefFound I had a Initialization error (until I added a security rule for setting the Provider) and for that I got a full stack trace (in an obscure trace file, granted).

  • "SYSTEM FAILURE" during JCo call.java.lang.reflect.UndeclaredThrowableExcep

    Hi All
    I have developed Java mapping program where I am calling three BAPI in sequence and trying to map all three bapi data to single Target XML file or Multiple target xml files depends on the in coming data.
    Now I want these files name should be genereted dynamically .So I have used below  Dynamic Configuration code in my java mapping program.********************************************************************************************************************************************************************
    try
         String currDate = new String();
         String currTime= new String();
         DateFormat dFormat=new SimpleDateFormat("yyyyMMdd");
         DateFormat tFormat = new SimpleDateFormat("HHmmss");
         java.util.Date date = new Date();
         TimeZone cetTimeZone = TimeZone.getTimeZone("CET");
         tFormat.setTimeZone(cetTimeZone);
         currDate = dFormat.format(date);
         currTime= tFormat.format(date);
         String pubDate=currDate + currTime;
         String ext=".xml";
         String event="-1_1-";
         trace.addInfo("********  Before  Dynamic Configuration ***************" );
         DynamicConfiguration conf =(DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
                                            DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File","FileName" );
         trace.addInfo("********  After  Dynamic Configuration ***************" );
         String tempFileName="NL09-"eventponum+ "-" pubDateext;
         trace.addInfo("The name of the file is  : " + tempFileName);
         conf.put(key, "tempFileName");
                catch (Exception e)
                     trace.addWarning("Error While creating File Name"+e.getMessage());
                     throw new Exception("Error While creating File Name",e);
    Now the problem is when I am using above code I am getting following error
    "SYSTEM FAILURE" during JCo call.
    java.lang.reflect.UndeclaredThrowableException
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="MAPPING">JCO_SYSTEM_FAILURE</SAP:Code>
      <SAP:P1>java.lang.reflect.UndeclaredThrowableException</SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:Stack>&quot;SYSTEM FAILURE&quot; during JCo call.
    java.lang.reflect.UndeclaredThrowableException</SAP:Stack>
      <SAP:Retry>A</SAP:Retry>
      </SAP:Error>
    Could please tell me why I am facing this problem only when I am using  Dynamic configuration code.
    If I dont use  Dynamic configuration code then I am not getting any error .But my requirement is to generate dynamic file name (Note I have tried with Variable Substution also, It is also not solving my problem as I need time stamp of ("CET") time zone).

    Hi Abhishek,
    Yes I have appended throws StreamTransformationException and imported the relevant StreamTransformationException class also.
    Here I am getting strange thing when  I am adding dynamic configuration code " SYSTEM FAILURE" during JCo call. But Jco cal is something to internal systems which does not relate to Dynamic Configuration.
    If I run my code with out any Dynamic Configuration code then it is running with out any errors.
    But I need this  Dynamic Configuration inorder to generate dyanamic file name.

  • NAC Agent/ActiveX/Java applet

    Hi,
    For L3 OOB deployment , does any one know how the NAC agent/ActiveX/Java applet refresh the IP address for the client??
    i know that In the Login Page configuration, two options need to be checked to use the ActiveX/Applet webclient to
    refresh the client’s IP address:
    - Use web client to detect client MAC address and Operating System
    - Use web client to release and renew IP address when necessary (OOB) .
    But what i need to know how the agent/ActiveX/Java applet refresh the IP address for the client???
    are these programs ( agent/ActiveX/Java applet ) triggers the client machine to do that???
    regards
    MAM

    MAM,
    You're right. The applets do indeed trigger a dhcp refresh on the machines. This is to avoid bouncing the port which can be problematic when you have IP phones.
    More info on this in the docs here: http://tinyurl.com/yhnskdf
    HTH,
    Faisal

  • Could somebody help about :System.SetProperty

    I use JSP to call a java class in which System.SetProperty is used to set the truststore and password for connecting to LDAP server by TLS connection .
    in the java class there are following statements
    System.setProperty("javax.net.ssl.trustStore",".truststore");
    System.setProperty("javax.net.ssl.trustStorePassword","ldapserver");
    //to set the property to access to the LDAP with TLS connection.
    The java class works well when I call it by a java file .
    But when I call this java class in JSP , there are some errors as following.
    Who can give me some suggestions ? thanks
    exception
    org.apache.jasper.JasperException: access denied
    (java.util.PropertyPermission javax.net.ssl.trustStore write)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    root cause
    java.security.AccessControlException: access denied
    (java.util.PropertyPermission javax.net.ssl.trustStore write)
    java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
    java.security.AccessController.checkPermission(AccessController.java:427)
    java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    java.lang.System.setProperty(System.java:698)
    LDAPAuthenPackage.LDAPAuthen.CheckUserNew(LDAPAuthen.java:30)
    org.apache.jsp.UserAuthen_jsp._jspService(UserAuthen_jsp.java:58)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)

    java.security.AccessControlException: access denied
    (java.util.PropertyPermission javax.net.ssl.trustStore write)
    java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)The current security manager does not permit the current code to change the property "javax.net.ssl.trustStore".
    The java class works well when I call it by a java file .
    But when I call this java class in JSP , there are some errors as following.By default, unless you are running applet or java plug-in, there is no security manager. Then all your code has all permissions. However, it is clear that your tomcat(?) instance is using a security manager.
    The first thing you want to know is why or how you started your tomcat instance with a security manager. There are two directions to resolve your problem. You can start your tomcat without a security manager. Or you can add the permission for your class to change that property into the policy file for the security manager.
    Lastly, of course, this problem has nothing particular to do with JSP.

  • Setting system properties: difference between "-D" and "System.setProperty"

    Hi.
    I have a program that relies on the jogl library to display graphics. Internally, jogl loads a native library from disk, with a System.loadLibrary() call. In turn, loadLibrary searches the paths in the system property "java.library.path" to find the jogl DLL/SO files. So, it is my responsibility to ensure that the "java.library.path" property is correctly set.
    There are two ways that I know of to set system properties: as an argument to the JRE via the "-D" option and from within an application with the System.setProperty method. However, I have noticed that only the former gives the desired behavior. That is, if I do:
    java -Djava.library.path=lib MyProgram{code}
    the code in jogl.jar is able to successfully find and load the native libraries in lib/, but if I do:
    {code:java}System.setProperty("java.library.path", "lib");{code}
    at the beginning of main in my program (before the classes requiring jogl are loaded), I end up with an UnsatisfiedLinkError.
    Why does this happen? Why do the 2 methods produce different results? Is specifying native library paths on the command line the only way to ensure that they are found?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    See the [System Properties Tutorial|http://java.sun.com/docs/books/tutorial/essential/environment/sysprop.html] section on "Writing System Properties" which says:
    Warning: Changing system properties is potentially dangerous and should be done with discretion. Many system properties are not reread after start-up and are there for informational purposes. Changing some properties may have unexpected side-effects.
    Also see the [setting java.library.path property in java code|http://forums.sun.com/thread.jspa?threadID=627890] thread in the JNI forum.

  • System.setProperty() doesn't seem to take new keystore

    Hi,
    I've spent a few hours hunting around on google and can't seem to find a solution to my problem so hopefully someone here can help.
    I've written a simulator for people at work that tests HTTPS connections using .jks keystores. Each time they make a request they pass in a few basic variables like IP Address and Port number etc but also the keystore file to use.
    The first HTTPS request always works fine, assuming they've passed in the correct keystore, but if they then change the keystore and point to another server it fails even if using the correct keystore. Here is the part of the code where the keystore is set.
    public HttpsURLConnection getHTTPSRequest(URL url) throws IOException {
              System.setProperty("javax.net.ssl.trustStore", ToolWindow.sHTTPSKeystoreLocation);
              System.setProperty("javax.net.ssl.keyStoreType", "JKS");
              System.out.println(ToolWindow.sHTTPSKeystoreLocation);
              System.out.println(System.getProperty("javax.net.ssl.trustStore"));
              HttpsURLConnection httpsURL = (HttpsURLConnection)url.openConnection();
              httpsURL.setHostnameVerifier(new HostnameVerifier()
                   public boolean verify(String hostname, SSLSession session)
                        return true;
              httpsURL.setRequestProperty("Content-Type","text/xml");
              httpsURL.setDoOutput(true);
              httpsURL.setDoInput(true);
              httpsURL.setConnectTimeout(iConnectTimeout);
              httpsURL.setReadTimeout(iReadTimeout);
              return httpsURL;
         }The System.out.println output always shows the correct keystore that's being passed in but the following exception gets thrown:
    nested exception is:
         javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    I know the path and certificate are good because if I restart the application and put in the same values it works but each time I change the keystore it stops working. It seems like System.setProperty() isn't using the new keystore supplied when making the connection but then my System.out.println output would show that surely.
    Any help would be appreciated.
    Thanks.

    Hi ejp,
    Thanks for pointing me in the right direction. I eventually found a solution which I will share here in case anyone else has a similar problem. The reason why I couldn't put all private keys into a single keystore is that the tool I'm writing is for our Operations team to be able to test keystores that we give out to individual customers. From a security point of view it wouldn't be a good idea to give out every customers keystore to everyone else.
    Here is how I did my implementation.
    In my original class that creates the HttpsURLConnection only line changed as follows:
    public HttpsURLConnection getHTTPSRequest(URL url, SSLSocketFactory sslSF) throws IOException { // pass in SSLSocketFactory
         HttpsURLConnection httpsURL = (HttpsURLConnection)url.openConnection();
         httpsURL.setSSLSocketFactory(sslSF); // set SSLSocketFactory
         httpsURL.setHostnameVerifier(new HostnameVerifier()
              public boolean verify(String hostname, SSLSession session)
                   return true;
         httpsURL.setRequestProperty("Content-Type","text/xml");
         httpsURL.setDoOutput(true);
         httpsURL.setDoInput(true);
         httpsURL.setConnectTimeout(iConnectTimeout);
         httpsURL.setReadTimeout(iReadTimeoutDefault);
         return httpsURL;
    }and here is the code I added to build the SSLSocketFactory...
    KeyStore ks = KeyStore.getInstance("JKS"); // create new KeyStore object and pass in instance to constructor
    ks.load(new FileInputStream(ToolWindow.getHTTPSKeystoreFile()), ToolWindow.getKeystorePassword()); // load keystore file and password in to KeyStore instance
    KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); // create a new KeyManagerFactory object and pass in instance to constructor
    kmf.init(ks, ToolWindow.getKeystorePassword()); // initialize the KeyManagerFactory and pass in the KeyStore object and keystore password as variables
    TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); // create a new TrustManagerFactory object and pass in instance to constructor
    tmf.init(ks); // initialize the TrustManagerFactory and pass in the KeyManagerFactory object as a variable
    SSLContext c = SSLContext.getInstance("SSL"); // create a new SSLContext object and pass in instace to constructor
    c.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); // initialize SSLContext and pass in Trust/KeyManagerFactory as variables
    SSLSocketFactory sf = c.getSocketFactory(); // create my SSLSocketFactory to be passed in to HttpsURLConnection
    HttpsURLConnection urlc = getHTTPSRequest(url,sf); // create a HttpsURLConnection by calling my method listed at the top of this post and passing in the variables I have herby described.Hope this helps someone else who runs into the same problem as me!

  • Registration of Business system for the Integration Engine Java in the SLD issue

    Hi,
    We have completed the installation of PI-AEX 7.4 SR1 then we ran the below wizards successfully.
    - Configuration Wizard: PI-AEX initial setup
    - Configuration Wizard: PI Self Test for AEX
    However when we were Checking the AEX Configuration as per help.sap.com
    Check the registration of a business system for the Integration Engine Java in the SLD:
        Enter https://<host>:<port>/sld .
        Choose Start of the navigation path Business System Next navigation step Integration Engine Java <SID> Next navigation step Integration End of the navigation path.
        The pipeline URL must be: http://<host_fully_qualified>:<port>/XISOAPAdapter/MessageServlet?ximessage=true .
    More information: SAP Note 1435392
    for us the Pipeline URL is as below
    http://<host_fully_qualified>:<port>/XISOAPAdapter/MessageServlet
    and the rest " ?ximessage=true "  is not there.
    Also we ran the below wizard
    Configuration Wizard: PI Self Test for AEX
    and it finished successfully without any issue.
    Any Suggestions what could be missing.
    Thanks,
    Regard
    Ahmed Mohammed

    Hi,
    I found the below SAPNOTE which confirms that the Pipeline URL should be
    http://<host_fully_qualified>:<port>/XISOAPAdapter/MessageServlet
    1564449 - PI CTC Wrong Pipeline Url after AEX Initial Setup
    However on help.sap.com it is different.
    Any one experienced the same ?
    Regards
    Ahmed Mohammed

  • System copy sapinst method no java engine found

    Hi all,
    I have completed my system copy of R3 ECC 6.0 and BI7 system to another machines for testing purpose using sapinst method.
    Basically i have used installation master DVD and went for option Additional software life cycle _ system copy -- Source system - Based on abap + java -- Export
    and then along with DDLs from  SMIGR_CREATE_DDL program i have prepared Export and performed Import at target machine with
    installation master DVD and went for option Additional software life cycle _ system copy -- Target system - Based on abap + java -- Import
    Give different hostname this time.
    all phases successfully completed in both machines and i am able to login to both systems successfully.
    But unfortunately i dont find j2ee_process table in MMC ( as i have in source system ) , but everything is green
    in MMC and smicm transaction shows no HTTP port entry but again green signal.
    Is there anything else to carry out to get j2ee_engine working at target system.
    also http://host:port/nwa for target system not working ,
    Can anybody throw some light on this issue , initially i was struglling for getting this import successfully done but now j2ee_process table is an issue for me.
    Best Regards,
    AjitR

    Since it is Test machine , i tried with option
    Additional software life cycle tasks --> java Add in for ABAP --> central system -->
    central service instance java addin
    and provided required inputs for screens and task completed .
    Now i can see j2ee process table under MMC .
    Is this normal scenario we should do after system copy through SAPINST ?
    If i have performed sapinst system copy for ABAP + java system then why it was not included in first import success ?

Maybe you are looking for