Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java System.setProperties might effect other code

Recently I integrated a piece of code into existing project. However in order for the code to work following properties have been set:

System.setProperty("javax.xml.soap.MessageFactory","com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl");
System.setProperty("javax.xml.soap.SOAPFactory","com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl");
System.setProperty("javax.xml.soap.MetaFactory","com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl");

System.setProperty("weblogic.security.SSL.enforceConstraints","off");
System.setProperty("weblogic.security.SSL.ignoreHostnameVerification","true");
System.setProperty("weblogic.security.SSL.strictcertchecking","false");
System.setProperty("weblogic.security.SSL.nojce","true");

Now everything seems to work nicely, however I have a big concern.

1) Can above properties mess up functionality elsewhere in a huge application?

2) Can I set some properties that are specific to my Object only? Meaning that I wouldn't have to set system wide properties in order to achieve the same result.

like image 999
MeIr Avatar asked Aug 12 '13 16:08

MeIr


1 Answers

Believe System will tie to the JVM running. If I'm understanding your question correctly, you're wondering if this will affect functionality elsewhere.

It is possible to affect functionality if you load up another application that depends on the properties being set above within the same JVM.

i.e.

System.setProperty("weblogic.security.SSL.enforceConstraints","on");

being set in a different application. The other thing to worry about is are these properties being set at deploy time, then considered immutable? If they're accessed and changed, and other applications are accessing and changing, you'll have chaos.

Hopefully that makes sense.

like image 150
dardo Avatar answered Oct 20 '22 03:10

dardo