2

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.

Community
  • 1
  • 1
rennX
  • 25
  • 2
  • 6
  • 1
    Doing it in the EAR or WAR is already to 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. – Gimby Oct 01 '14 at 15:41
  • @Gimby you should just put that as the answer as you're correct :) – James R. Perkins Oct 01 '14 at 21:38
  • @JamesR.Perkins I didn't want to do that since I'm basically just parroting what the linked answer clearly implies... but I guess flagging this as a duplicate is also not correct. I'll trust your judgement. – Gimby Oct 02 '14 at 08:27

3 Answers3

2

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.

Gimby
  • 5,095
  • 2
  • 35
  • 47
1

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/.

dsutherland
  • 792
  • 6
  • 15
  • 1
    Thank you. This is really nice if you want to bake your own redistribution of WildFly. – aelgn Dec 17 '14 at 15:55
0

You can try "The native management API" https://docs.jboss.org/author/display/WFLY8/The+native+management+API

sibnick
  • 3,995
  • 20
  • 20