Results 1 to 9 of 9

Thread: JBoss 6.0.0 Final and PropertyPlaceholderConfigurer

  1. #1
    Join Date
    Feb 2008
    Location
    Rome
    Posts
    46

    Angry JBoss 6.0.0 Final and PropertyPlaceholderConfigurer

    Hi all!

    I need help with JBoss 6.0.0 Final and PropertyPlaceholderConfigurer.

    Code:
    <!-- PROPERTIES BEAN FROM FILE -->
    <bean id="goWebPropertiesFromFile" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
      <property name="ignoreUnresolvablePlaceholders" value="true"/>
      <property name="location" value="classpath:${GOWEB_HOME}/GOWeb.properties"/>
    </bean>
    On JBoss 4.2.2 I'm using this bean to load a spring's props from file....but the same doesn't work on JBoss 6.0.0

    GOWEB_HOME Config on JBoss:

    Code:
    <attribute name="Properties">
          GOWEB_HOME=D:\\Development\\GOWeb_2.0\\GOWEB_HOME
    </attribute>
    This is the exception:

    Code:
    12:06:23,948 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/GOWeb]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [D:/Development/GOWeb_2.0/GOWEB_HOME/GOWeb.properties] cannot be opened because it does not exist
    I'm speechless and desperate
    Thanks in advance for suggestions!

    Cheers, Vale

  2. #2
    Join Date
    Jul 2010
    Location
    Venice, Italy
    Posts
    710

    Default

    Ciao,

    I think the problem is that you're loading your properties file from CLASSPATH but you're giving a file system path. Either use file: instead of classpath: in Configurer definition, or else put your property file under classpath and specify a classpath location (classpath locations never start with D: or C:, because you navigate the package structure and not a file system).
    I wonder how the same configuration worked with older version of JBoss.

    Saluti,

    Enrico

  3. #3
    Join Date
    Feb 2008
    Location
    Rome
    Posts
    46

    Default

    Hi Enrico,

    at first...thank you for your reply!

    I'm agree with you...I failed a cut and paste ...
    The real config property is:

    Code:
    <!-- PROPERTIES BEAN FROM FILE -->
    <bean id="goWebPropertiesFromFile" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
      <property name="ignoreUnresolvablePlaceholders" value="true"/>
      <property name="location" value="file:${GOWEB_HOME}\GOWeb.properties"/>
    </bean>
    This configuration on JBoss 4.2.2 works fine; with JBoss 6 I'm receiving this exception:

    Code:
    Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 7: file:D:\Development\GOWeb_2.0\GOWEB_HOME\GOWeb.properties
    	at java.net.URI$Parser.fail(Unknown Source) [:1.6.0_22]
    	at java.net.URI$Parser.checkChars(Unknown Source) [:1.6.0_22]
    	at java.net.URI$Parser.parse(Unknown Source) [:1.6.0_22]
    	at java.net.URI.<init>(Unknown Source) [:1.6.0_22]
    	at org.jboss.vfs.VFSUtils.toURI(VFSUtils.java:315) [jboss-vfs.jar:3.0.0.GA]
    	at org.jboss.vfs.protocol.AbstractURLConnection.toURI(AbstractURLConnection.java:90) [jboss-vfs.jar:3.0.0.GA]
    Cheers, Vale

  4. #4
    Join Date
    Jul 2010
    Location
    Venice, Italy
    Posts
    710

    Default

    Ok,

    now clearly the problem is that the URI parser has difficulty in recognizing the string as a valid URI. Some suggestions:

    - don't use dots for directory names. Remove the dot from GOWeb_2.0 (to something like GOWeb_20 for example), change the string accordingly and redeploy;

    - if that fails, try to also remove underscores, even though underscores should be acceptable;

    - If all this fails, try to use unix-style path navigation (forward slashes instead of back slashes) even though you deploy under a Windows system.

    Hope this helps. Ciao,

    Enrico

  5. #5
    Join Date
    Feb 2008
    Location
    Rome
    Posts
    46

    Unhappy

    Hi Enrico....

    I removed dots and underscores from folder name but I'm receiving the same exception

    However...for the Logger I'm using the same dir and it works fine!

    Ciao ciao!
    Vale

  6. #6
    Join Date
    Jul 2010
    Location
    Venice, Italy
    Posts
    710

    Default

    Have you tried to use unix-style paths (change '\' to '/' in your url string)? Because I now noted that the error says "at index 7" and if you count (starting from 0 because it's a String) character 7 in your string is the first backslash:

    Code:
    file:D:\Development\GOWeb_2.0\GOWEB_HOME\GOWeb.properties
    Give it a try,

    ciao

  7. #7
    Join Date
    Feb 2008
    Location
    Rome
    Posts
    46

    Default

    Yes, I do!
    If I change the property URL into property-service.xml (JBoss config file) I'm receiving this new exception:

    Code:
    15:19:10,010 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed: java.lang.IllegalArgumentException: Null path
    	at org.jboss.vfs.VFS.getChild(VFS.java:207) [jboss-vfs.jar:3.0.0.GA]
    	at org.jboss.vfs.VFS.getChild(VFS.java:193) [jboss-vfs.jar:3.0.0.GA]
    	at org.jboss.vfs.protocol.FileURLConnection.<init>(FileURLConnection.java:52) [jboss-vfs.jar:3.0.0.GA]
    	at org.jboss.vfs.protocol.FileURLStreamHandler.openConnection(FileURLStreamHandler.java:38) [jboss-vfs.jar:3.0.0.GA]
    	at java.net.URL.openConnection(URL.java:945) [:1.6.0_14]
    	at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:121) [:2.5.4]
    	at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:182) [:2.5.4]
    I'm going crazy!

    Ciao ciao, Vale!

  8. #8
    Join Date
    Mar 2008
    Posts
    5

    Default

    same here Null path!

  9. #9

    Default

    try this
    Code:
    <property name="location" value="file:///:${GOWEB_HOME}\GOWeb.properties"/>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •