64441

JBoss External Properties Files in Classpath

I was going through JBoss.org how to put external file in the classpath, but it doesn't work.

I have 1 file with name "config.properties". It is placed in jboss/modules/com/xsiraul/test/main/ folder. In the same folder there is module.xml which looks like -

<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="com.xsiraul.test"> <resources> <resource-root path="."/> </resources> </module>

I have load config.properties file from Java using -

InputStream settingsStream = getClass().getClassLoader().getResourceAsStream("config.properties");

Java class is in package named com.xsiraul.test

The problem is that method getResourceAsStream returns NULL and I don't understand why. Maybe somebody has any ideas?

I use JBoss EAP 6.1.0.GA version.

Answer1:

<ol> <li>

Copy your 'config.properties' and 'module.xml' in the following directory:

<JBOSS-6.1-ROOT>/modules/system/layers/base/com/fico/test/main </li> <li>

Extend '/standalone/configuration/standalone.xml' by the following sub-system:

<subsystem xmlns="urn:jboss:domain:ee:1.1"> <global-modules> <module name="com.fico.test" slot="main"/> </global-modules> <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement> <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement> </subsystem> </li> <li>

Restart JBoss

</li> </ol>

Answer2:

Did you declare the dependency to your module? maybe you missed that..

Add Dependencies: com.fico.test to your manifest.mf file

Recommend

  • How do I apply XACML rules to every child URI?
  • What's “msgid” and “xliff” in strings.xml file?
  • How to access gmail API?
  • How do I create an image and save it for later to draw as texture in XNA?
  • NHibernate proxyexception
  • How many Vertica Databases can run on a Host in the same time?
  • What is the equivalent of Android permissions in iOS development? [duplicate]
  • Android Lock Screen C# .NET Replica
  • XSD with multi occurrences unordered
  • Cannot find “Grammar.txt” in python-sphinx
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • Does CSS support inheritance [duplicate]
  • In Java, how can I construct a File from a resource?
  • Splash Screen will not display
  • Eclipse MTJ doesn't see Java ME SDK 3.0 devices
  • How to convert SOAP response with xsi values to json in WSO2esb
  • Bash if statement with multiple conditions
  • Elasticsearch script query involving root and nested values
  • htaccess add www if not subdomain, if subdomain remove www
  • Android - Material Design - NavigationView - How to put vertical scroll?
  • Why Encoding.ASCII != ASCIIEncoding.Default in C#?
  • Mysterious problem with floating point in LISP - time axis generation
  • Jquery UI tool tip close icon
  • Pass value from viewmodel to script in zk
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Encrypt data by using a public key in c# and decrypt data by using a private key in php
  • Launch Runnable Jar from Web Start
  • script to move all files from one location to another location
  • SSO with signing and signature validation doesn't work
  • ILMerge & Keep Assembly Name
  • Deserializing XML into class C#
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • Symfony2: How to get request parameter
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How can i traverse a binary tree from right to left in java?
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?