How to set a JVM system property at startup

I need to set a JVM system property when Lucee is starting up. How can this be done?

In order to get the jtds SQL driver to work with encrypted database connections the following must be set for the Java 8 VM: -Djsse.enableCBCProtection=false.

I’ve tried adding that to the catalina.bat file (on Windows) like this:

rem The following line was added
set JAVA_OPTS=-Djsse.enableCBCProtection=false

Doesn’t work. I also print out the property from a test page. Nothing is printed.

<CFSET jsys= CreateObject( "Java", "java.lang.System" )>
<CFOUTPUT>#jsys.getProperty( "jsse.enableCBCProtection" )#</CFOUTPUT>

I even tried setting the property from the same page and that doesn’t work either.

<CFSET unused = jsys.setProperty( "jsee.enableCBProtection", "false" )>

Any clues?


Mike, a couple of issues:

  • if you read the comments in the catalina.bat, it says that you should set such env vars (and overriding the java_opts for such startup args) in a setenv.bat file instead (and it doesn’t exist by default, but just create it, and it will use it)
  • (some may question if you should be quoting the entire java_opts, but I can confirm that is works whether the quotes are around the whole set value, or the value to the right of the =, or with no quotes at all)
  • finally, note that if you’re instead running Lucee as a Windows service, then you don’t want to be editing either file, but instead you want to use the luceew.exe (in the lucee\tomcat\bin folder), which has a “java” tab, where you’d set that java arg on its own line (and without using SET)

Let us know if either works.

1 Like


Yes, I saw the note in catalina.bat. I didn’t see a setenv.bat (I’m on Windows) and wasn’t sure of the format. So, I just plugged in the property to catalina.bat. But we are running Lucee as a Windows service and your tip on using lucee.exe worked!!!

However, my ultimate problem wasn’t resolved. Maybe you can help with this too?

The second part to making jtds work is to replace the jtds.1.3.1.jar that comes with Lucee. A patch has been committed to jtds, that fixes the SSL db connection problem. However, a new version of jtds has never been released. I have built a version but can’t seem to be able to get Lucee to use it.

NOTE: I know the patched version works because I’ve tested it in a standalone java app.

I have the patched version in the WEB-INF/LIB folder but Lucee seems to insist on using its own jtds-1.3.1.jar. I can find find a jtds-1.3.1.jar in C:\lucee\tomcat\lucee-server\bundles. If I replace it with my patched version (even using the same name, which I prefer not to do) Lucee replaces it with its own when the service is restarted.

How can I replace the jtds-1.3.1.jar file that Lucee insists on using?


I’d make an updated lex.

Clone this

Replace the jar in the build/jtds folder, tweak as necessary and maybe name your jar version

Use ant to build from the root, then install the new lex in lucee and it should replace the one provided by the update provider.

None of the files are available at that github URL. Clicking on any file gives an error.



Ignore last message. I wasn’t logged in to GitHub. I can see the files now.

Ok, I’ve cloned the JDBC extension project and built it with no changes. Then I replaced the jtds JAR file (jtds-1.2.6.jar) with my jtds file (jtds-1.3.2) jar file. Upon building I’m seeing this in the DIST directory. The first JAR is the new jtds.

Not being a Lucee extension builder, I’m at a loss. I assume there are some build properties that I need to set in order to get correct name?


I resolved that by adding a manifest file to the new jtds JAR file we built. Now a LEX file is created. When deployed, it gives this.

I created a UUID using Lucee and put it in the jtds file. How does one create a “valid” UUID?

Finally got stuck here.

I’m not sure why it thinks the version value is 1. It is set to 2 (previously tried 1, but it complained about that).