Atomikos Forum |
|
I am using Spring to configure v3.6.4 of transaction essentials using this guide:
http://www.atomikos.com/Documentation/SpringIntegration#The_Advanced_Case_As_of_3_3 Everything functions properly, but at system startup I was getting the following message: No properties path set - looking for transactions.properties in classpath... transactions.properties not found - looking for jta.properties in classpath... Failed to open transactions properties file - using default values So I set the "no_file" property according to the instructions here: http://www.atomikos.com/Documentation/FrequentlyAskedQuestions But the error messages remain. The configuration in Spring looks like this: <bean id="userTransactionService" class="com.atomikos.icatch.config.UserTransactionServiceImp" init-method="init" destroy-method="shutdownForce"> <constructor-arg> <!-- IMPORTANT: specify all Atomikos properties here --> <props> <prop key="com.atomikos.icatch.no_file">true</prop> <prop key="com.atomikos.icatch.service">com.atomikos.icatch.standalone.UserTransactionServiceFactory</prop> <prop key="com.atomikos.icatch.output_dir">target/</prop> <prop key="com.atomikos.icatch.log_base_dir">target/</prop> </props> </constructor-arg> </bean> Any idea why it still looks for the file? Is there something else I need to do?
*************************************************
No properties path set - looking for transactions.properties in classpath... transactions.properties not found - looking for jta.properties in classpath... Failed to open transactions properties file - using default values ************************************************* The above message is coming from this piece of code ************************************************* String filename = System.getProperty ( FILE_PATH_PROPERTY_NAME ); if ( filename == null ) { filename = DEFAULT_PROPERTIES_FILE_NAME; logToStdErr ( "No properties path set - looking for " + DEFAULT_PROPERTIES_FILE_NAME + " in classpath..." ); url = findPropertiesFileInClasspath ( filename ); if ( url == null ) { filename = PRE_3_0_DEFAULT_PROPERTIES_FILE_NAME; logToStdErr ( DEFAULT_PROPERTIES_FILE_NAME + " not found - looking for " + PRE_3_0_DEFAULT_PROPERTIES_FILE_NAME + " in classpath..." ); url = findPropertiesFileInClasspath ( filename ); } ************************************************* This is present in com.atomikos.icatch.config.UserTransactionServiceImp::findProperties(). The logging to the StdErr comes if the system property is not set, if you set the System properties with this value -Dcom.atomikos.icatch.file=<filelocation> you will not see the specific messages appearing. If you set the system property com.atomikos.icatch.hide_init_file_path to any arbitrary value it will go. Can you please perform this test and let us know if this works? Also you can ignore these messages it would not break anything which you too have been witnessing. Regards, -VK
Setting the System property to hide the stderr messages worked just as you said it would.
Nonetheless, I really, really wish that no_file, file, and hide_init_file_path were all properties that could be constructor provided properties in addition to being a system property. For those of use who configure Atomikos via Spring, it would make life a lot easier. As it is, I need to have all my customers configure this manually. Thanks for your help. Dave
Found a decent work-around for setting a system property from within a Spring configuration file. Putting it in here for the record:
<bean id="setAtomikosSystemProps" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="targetObject"> <!-- System.getProperties() --> <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="targetClass" value="java.lang.System" /> <property name="targetMethod" value="getProperties" /> </bean> </property> <property name="targetMethod" value="putAll" /> <property name="arguments"> <!-- The new Properties --> <util:properties> <prop key="com.atomikos.icatch.file">/etc/myapp/jta.properties</prop> <prop key="com.atomikos.icatch.hide_init_file_path">true</prop> </util:properties> </property> </bean> then just make the UserTransactionServiceImp bean depend on this bean and you are all set.
I add a new section in Spring:
http://www.atomikos.com/Documentation/SpringIntegration#Setting_Atomikos_System_Properti and also took the liberty of cleaning up the documentation surrounding the JVM properties: http://www.atomikos.com/Documentation/JtaProperties#JVM_System_Properties |