FAQ Database Discussion Community


java.lang.IllegalArgumentException: 'hello' does not contain an equals sign

java,apache-commons,properties-file
I am currently using the Apache commons configuration library to write and read data from a file. I am able to save the key value pair colors=hello to the user..properties file, but when i try to read the value is get the below exception. Exception in thread "main" java.lang.IllegalArgumentException: 'hello'...

Open a properties file from a class in a Dynamic Web Project

java,eclipse,jsp,properties-file
I'm using Eclipse for EE Developer. I need to access to a properties file (db.properties) from a class's method (DBQuery.java). The class is located inside a package inside the src folder. For the properties file i tried almost everything that i could find over the net to make it work,...

How can I retrieve an external .properties file in Java?

java,file,java-ee,inputstream,properties-file
Hello to everybody I have the following problem trying to load a properties file from a directory that is external to my project. So my project have the following structure: PROJECT-ROOT | | |-----> confi | |------> src | | |------> mainPkg (the package name) | | |------> Main (the...

How do you populate a displaytag column title with a Struts2 properties file entry?

struts2,displaytag,properties-file
In Struts2 you can populate a label for a component with a value from a properties file. The properties file must have the same name as the Struts2 Action Class that will serve up the JSP and be in the same folder as that Action Class. <s:textfield key="field.label.casereference" name="caseReference" />...

Problems reading keys from properties file java

java,properties-file
I have a properties file that is used to control specific variables within my application. All but one of the keys I am using work perfectly fine as the application has been working. The structure of the ini file is: JDBC_DRIVER=com.mysql.jdbc.Driver DB_URL=localhost/tempTables [email protected] [email protected] host=<sanitised> port=25 USER=root PASS=Fo0b4R path=C:/Users/foo/Desktop/profile_admin_ logLevel=2...

Constants and properties in java

java,configuration,constants,config,properties-file
Java best practices recommends read properties as constants. So, what do you think is the best approach to reach it? My approach is: A Configuration class to read the properties file only one time (singleton pattern) and use this class to read properties when needed as constants. And a Constants...

“Address already in use: bind” exception when running Gradle JUnit tests

gradle,spring-boot,junit4,properties-file,springjunit4classrunner
I'm using Spring Boot 1.2.2.RELEASE, JUnit4, and Gradle 2.1 for a RESTful service and am trying to define a properties file which includes and/or overrides values which will be used in JUnit tests only. All tests execute without an issue when invoked as a JUnit test. However, when these same...

Parsing a .properties file with getClassLoader()

java,inputstream,properties-file
I'm writing a Java program that takes a foo.properties file and parses it into a Properties object. After a quick search, I found this code: public Properties getProperties() throws IOException{ String fileIn = "foo.properties"; Properties p = new Properties(); InputStream inStream = getClass().getClassLoader().getResourceAsStream(fileIn); if(inStream != null) { p.load(inStream); } else...

Is it possible to use two “job.properties” file in a workflow oozie?

hadoop,workflow,oozie,properties-file
I need to use another file than the job.properties for my workflow. This file have the same structure than a properties file. I have a generator of result's path which create this file. The particularity of this one, is that it's change each time the workflow is launched (with new...

Can't load multiple property files in spring's application context

java,spring,spring-mvc,properties-file
I have three property files placed in a resource folder in classpath. The problem i am facing is while i am able to load invidual files separately i am unable to load them when they are declared together. Please see the XML below: <bean name="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basenames" value="resources\label"/> </bean>...

Loading of Java message properties for internalization

java,localization,internationalization,translation,properties-file
I have the following Java i18n Message class.: public class Messages { private static final String BUNDLE_NAME = "languages.message"; private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); private Messages() { } public static String getI18n(String key) { try { return RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException e) { return '!' + key +...

Using maven profiles to configure code based a Spring application

properties-file,spring-4,maven-profiles
I have a Spring application which is complete code based configured. And I am trying to combine maven profiles to setup my db connections. I defined some properties for a local, live and staging issues. Now I try to get control over maven profiles. Every profil defines my MySql db...

Resource and properties file management issue

java,spring,resources,properties-file
I am trying to learn spring. I have some trouble to manage my resource and properties file. This is my mvc-dispatcher-servlet.xml file. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd...

Inject values from messages.properties into ValidationMessages.properties

java,spring,hibernate,hibernate-validator,properties-file
I need to change the @NotNull message used by hibernate-validator. Have successfully done this using a line in ValidationMessages.properties, e.g: javax.validation.constraints.NotNull.message=my validation message. However, this isn't quite what's needed. Will spare the details about why but all these messages should originate from a single messages.properties file, whose purpose is not...

WiX - Set MSI's Program name

wix,windows-installer,manifest,properties-file,details
in my WiX installer, if I right-click my MSI, hit Properties, go to Details, and browse the details of my MSI package, I see that under Origin, the default Program name is set to Windows Installer XML Toolset (3.9..... How can I change the Program name that appears in the...

How can I load a resource bundle properties file within a composite component?

jsf,composite-component,resourcebundle,properties-file
My component library directory tree is setup as the following: resources mylib css mycomponent.css properties mycomponent.properties mycomponent.xhtml I'd like to load the properties file within mycomponent.xhtml to use for messages. What is the proper way of doing this? Is there an f:loadbundle type of solution?...

Loading properties file in jboss eap 6.3

java,properties,jboss,properties-file,jboss-eap-6
I am new to jboss eap 6.3. I have to load a list of configuration parameters (properties file) into a cache in my application running on jboss eap 6.3. I checked the developers guide from red hat but did not find anything specific. Any pointers will help. I have this...

Sort contents of a property file in a Gradle task

sorting,groovy,gradle,properties-file
As part of building a number of projects, I would like to sort the contents in some property-files that are semi-generated but also checked in to source control. The generation/update step in Gradle leaves them in different order (Done in 3rd party plugin code, probably the changing ordering is due...

Does java.util.Properties support nested properties?

java,nesting,properties-file
I'm trying to set up environment-specific properties in a file, customized for each device running the code. I'd like to be able to nest some properties in others, for example: browser=chrome baseUrl=${server}/app/login.do server=http://localhost I'd like to be able to get http://localhost/app/login.do when I get the baseUrl property. Does java.util.Properties support...

How to fill HashMap from java property file with Spring @Value

java,spring,properties-file,spring-el
Is it possible to use Spring @Value, to map values from properties file to the HashMap. Currently I have something like this, and mapping one value is not a problem. But I need to map custom values in HashMap expirations. Is something like this possible? @Service @PropertySource(value = "classpath:my_service.properties") public...

Why Ant add an equal character in properties file

encoding,ant,properties-file
I have a some given properties file like this : firstvalue=1 secondvalue=hello I use this Ant script to change a value : <propertyfile file="A.properties"> <entry key="firstvalue" value="2" /> </propertyfile> After executing the script, the properties file is now : #Wed, 20 May 2015 11:42:46 +0200 = firstvalue=2 secondvalue=hello I understand...

ant time format backslash issue

date,ant,properties-file
I have an ant build.xml to create/modify a version.properties file with the following tag: <propertyfile file="${version.file}" comment="Build version info"> <entry key="buildDate" type="date" value="now" pattern="MM-dd-yyyy HH:mm:ss"/> The the result is this: buildDate=01-28-2015 15\:49\:57 Is there a way to eliminate these back slashes in the result?...

Creating an ANT macro to combine two properties file

ant,properties-file,build.xml
Suppose that I have two properties file (say a.properties and b.properties) which contains key value pair. How to write ANT task to create a new properties file (say c.properties) which contains the key value pair of both these files(a and b). Please help.

Maven build profiles in a mutli-module project property expansion

java,maven,properties-file
I have a Multi-Module Maven project. My parent POM has the following modules: <module>common</module> <module>ingest</module> <module>package</module> The package modules handles all aspects of building a deployable zip file using maven-antrun-plugin. The other two modules are where the core application code is located. Within the package I have various profiles holding...

How exactly works this properties file that “include” some other properties file?

java,java-ee,properties,properties-file
I have the following doubt related a Java properties file. Into a project I have a config.properties file that contains something like these lines: Mailer=C:/Projects/MY-PROJECT/src/config/mailer.properties Upload=C:/Projects/MY-PROJECT/src/config/upload.xml Soap=C:/Projects/MY-PROJECT/src/config/soap.xml Libretto=C:/Projects/MY-PROJECT/src/config/libretto.properties So what is the exact meaning of these lines into a properties file? I think that is how I am including the...