简体   繁体   中英

Wildfly 8.1 - set system property without standalone.xml

To overcome the issue described here , I have a requirement to set a system property,

com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager=true

Due to environment constraints, I can not use standalone.xml or the web interface in WildFly 8.1 to do so. Is there a way to achieve this from within my EAR or WAR file?

I would imagine this would be done using jboss-deployment-structure.xml or jboss-web.xml, but can't find any references to this.

I appreciate any assistance.

Doing it in the EAR or WAR is already too late; according to the question/answer you link to it needs to be set at Java startup time using the -D command line flag. So it needs to go in the standalone startup script, or in a JAVA_OPTS environmental variable. Both require modifications to the server environment.

Not using an EAR or WAR but if you are using JBoss or Wildfly you can use a SAR to do this. SARs are unique to the JBoss community and run as a service inside of your container, starting prior to all WARs and EARs. I have previously used a SAR to set system properties from references stored in my DB but you could easily also load them from a static string or a flat file. If you are using maven, there is also a jboss based SAR module for creating it at compile time. You can find steps to create a sar at http://www.javabeat.net/sar-service-archive-file-in-jboss/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM