title: Jasypt and Weblogic environment variables
body: <p>I am using jasypt 1.9.2 to encrypt a password in a property file for my spring REST service.  I've added an environment variable to Weblogic via the Server startup arguments text box called APP_ENCRYTPION_PASSWORD, but that environment variable is not getting read by the jasypt.  Here is the error:</p>
  
  <pre><code>ERROR o.s.web.servlet.DispatcherServlet - Context initialization failed
  java.lang.NullPointerException: null
      at org .jasypt.encryption.pbe.config.SimplePBEConfig.getPasswordCharArray(SimplePBEConfig.java:434) ~[jasypt-1.9.2.jar:na]
  </code></pre>
  
  <p>Here is the Weblogic environment variable logged during when the server starts up:</p>
  
  <pre><code>JAVA_OPTIONS= -Dother.vars=xxx -DAPP_ENCRYPTION_PASSWORD=password -Dmore.vars=yyy
  </code></pre>
  
  <p>I've traced the jasypt code and it seems jasypt does not parse the environment variables within JAVA_OPTIONS.  I know this works for other frameworks like spring since we have other environment variables within JAVA_OPTIONS that spring has no issue reading.</p>
  
  <p>I could add the environment variable to the startup scripts (setEnv.sh I think) for weblogic, but that will add the variable for all managed nodes instead of the one cluster my app is deployed to.</p>
  
  <p>Is there a different way to configure jasypt within spring to get the environment variables within JAVA_OPTIONS?   </p>
  
  <p>Here is my spring config:</p>
  
  <pre><code>&lt;bean
      class="org.jasypt.spring31.properties.EncryptablePropertyPlaceholderConfigurer"&gt;
      &lt;constructor-arg&gt;
          &lt;bean class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"&gt;
              &lt;property name="config"&gt;
                  &lt;bean class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig"&gt;
                      &lt;property name="algorithm" value="PBEWithMD5AndTripleDES" /&gt;
                      &lt;property name="passwordEnvName" value="APP_ENCRYPTION_PASSWORD" /&gt;
                  &lt;/bean&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
      &lt;/constructor-arg&gt;
      &lt;property name="location"&gt;
          &lt;value&gt;application.properties
          &lt;/value&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>My application.properties file contents:</p>
  
  <pre><code>username=someuser
  password=ENC(encryptedstring)
  </code></pre>
  
  <p>UPDATE for clarity:
  Adding the environment variable to weblogic via setEnv.sh or Eclipse works just fine.  It's only when I use the weblogic console to add the environment variable for a cluster that jasypt fails to parse the value since it is within JAVA_OPTIONS.</p>