[
https://issues.jboss.org/browse/JBTM-775?page=com.atlassian.jira.plugin.s...
]
Jonathan Halliday commented on JBTM-775:
----------------------------------------
Whilst Andrew is right in so far as you have to be careful in environments with multiple
classloaders, this issue does also arise in simpler cases. The code that searches for
properties files is able to look inside archives and the code that actually reads the
located file is likewise. Between these two chunks of code is a broken check that deals
only with actual files, not files embedded inside archives. We just need to make the
abstract path uri handling a bit cleaner.
Property files within jars not being detected
---------------------------------------------
Key: JBTM-775
URL:
https://issues.jboss.org/browse/JBTM-775
Project: JBoss Transaction Manager
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 4.9.0
Reporter: Galder ZamarreƱo
Assignee: Jonathan Halliday
Fix For: 4.15.0
We, Infinispan, has added a jbossts-properties.xml to src/test/resources to make it
easier for developers to enable debug logging for JBoss TS code.
Now, when the test jar is filled, this file is included, but any client code using this
jar can't startup and instead throws errors like this:
Caused by: java.lang.ExceptionInInitializerError
at com.arjuna.ats.jta.TransactionManager.transactionManager(TransactionManager.java:97)
at com.arjuna.ats.jta.TransactionManager.transactionManager(TransactionManager.java:76)
... 65 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: invalid property file
file:/home/sanne/.m2/repository/org/infinispan/infinispan-core/4.1.0-SNAPSHOT/infinispan-core-4.1.0-SNAPSHOT-tests.jar!/jbossts-properties.xml
at
com.arjuna.common.internal.util.propertyservice.BeanPopulator.getSingletonInstance(BeanPopulator.java:52)
at
com.arjuna.common.internal.util.logging.commonPropertyManager.getLoggingEnvironmentBean(commonPropertyManager.java:39)
at com.arjuna.common.util.logging.LogFactory.setupLogSystem(LogFactory.java:146)
at com.arjuna.common.util.logging.LogFactory.getLogNoi18n(LogFactory.java:107)
at com.arjuna.ats.jta.logging.jtaLogger.<clinit>(jtaLogger.java:54)
... 67 more
Caused by: java.lang.RuntimeException: invalid property file
file:/home/sanne/.m2/repository/org/infinispan/infinispan-core/4.1.0-SNAPSHOT/infinispan-core-4.1.0-SNAPSHOT-tests.jar!/jbossts-properties.xml
at
com.arjuna.common.util.propertyservice.PropertiesFactory.getPropertiesFromFile(PropertiesFactory.java:79)
at
com.arjuna.common.util.propertyservice.PropertiesFactory.initDefaultProperties(PropertiesFactory.java:187)
at
com.arjuna.common.util.propertyservice.PropertiesFactory.getDefaultProperties(PropertiesFactory.java:57)
at
com.arjuna.common.internal.util.propertyservice.BeanPopulator.getSingletonInstance(BeanPopulator.java:49)
... 71 more
2010-08-17 11:48:49,656 INFO [TransactionManagerFactory] (main) failed looking up
TransactionManager, will not use transactions
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup.getTransactionManager(JBossStandaloneJTAManagerLookup.java:54)
at
org.infinispan.factories.TransactionManagerFactory.construct(TransactionManagerFactory.java:55)
at
org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:306)
at
org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:244)
at
org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:803)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:219)
at
org.infinispan.factories.ComponentRegistry.registerComponent(ComponentRegistry.java:118)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:186)
at
org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:314)
at
org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:244)
at
org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:803)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:219)
at
org.infinispan.factories.ComponentRegistry.registerComponent(ComponentRegistry.java:118)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:186)
at
org.infinispan.factories.InterceptorChainFactory.createInterceptor(InterceptorChainFactory.java:50)
at
org.infinispan.factories.InterceptorChainFactory.buildInterceptorChain(InterceptorChainFactory.java:67)
at
org.infinispan.factories.InterceptorChainFactory.construct(InterceptorChainFactory.java:192)
at
org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:306)
at
org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:244)
at
org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:803)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:219)
at
org.infinispan.factories.ComponentRegistry.registerComponent(ComponentRegistry.java:118)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:186)
at
org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:314)
at
org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:244)
at
org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:803)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:219)
at
org.infinispan.factories.ComponentRegistry.registerComponent(ComponentRegistry.java:118)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:186)
at
org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:314)
at
org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:244)
at
org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:803)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:219)
at
org.infinispan.factories.ComponentRegistry.registerComponent(ComponentRegistry.java:118)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:186)
at
org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:314)
at
org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:244)
at
org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:803)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:219)
at
org.infinispan.factories.ComponentRegistry.registerComponent(ComponentRegistry.java:118)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:186)
at
org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:314)
at
org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:244)
at
org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:803)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:219)
at
org.infinispan.factories.ComponentRegistry.registerComponent(ComponentRegistry.java:118)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:186)
at
org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:314)
at
org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:244)
at
org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:803)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:219)
at
org.infinispan.factories.ComponentRegistry.registerComponent(ComponentRegistry.java:118)
at
org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:186)
at
org.infinispan.factories.InternalCacheFactory.bootstrap(InternalCacheFactory.java:90)
at
org.infinispan.factories.InternalCacheFactory.createAndWire(InternalCacheFactory.java:77)
at
org.infinispan.factories.InternalCacheFactory.createCache(InternalCacheFactory.java:58)
at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:445)
at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:411)
Even though the properties file is within the JAR and the contents of the jar and xml
have been verified, the following code does not like it:
filepath = FileLocator.locateFile(propertyFileName);
File propertyFile = new File(filepath);
if(!propertyFile.exists() || !propertyFile.isFile()) {
throw new RuntimeException("invalid property file "+filepath);
}
Maybe the JBoss TS code should be improved to locate property files within jars?
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira