[ https://issues.apache.org/jira/browse/CXF-2075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677410#action_12677410 ]
Seumas Soltysik commented on CXF-2075: -------------------------------------- Sergey, thanks for the input. One additional issue is that when the BusApplicationContext is tried a second time, it simply logs an error regarding not being able to find the config file but no exceptions is thrown. I think the BAC would also need to be updated to throw an Exception if the config file is not found on the 2nd try to create the BAC. If we did this we could the implement your solution to hold onto the initial exception and throw it if an exception was thrown during the 2nd try. Also if this 2nd try is there to satisfy an OSGi requirement, it seems like there should be some kind of test in CXF which requires this 2nd try so that the need for this is confirmed in the testing framework. Currently removing this 2nd try does not affect systests results. I can submit a patch for this issue once we sort out the solution. > Error in spring config file reported as a missing config file during > initialization of BusApplicationContext > ------------------------------------------------------------------------------------------------------------ > > Key: CXF-2075 > URL: https://issues.apache.org/jira/browse/CXF-2075 > Project: CXF > Issue Type: Bug > Components: Core > Affects Versions: 2.1.4 > Reporter: Seumas Soltysik > > The current code to create a Bus in SpringBusFactory masks any problem in > processing the spring config file passed in to SpringBusFactory. Currently if > a config file is corrupt, the exception thrown trying to process this file is > eaten and an attempt to create a Bus is tried again with a different thread > context classloader. This completely hides the source of the error and > results in a message which indicates that the config file could not be found > which is completely misleading for the user. > The solution is to not perform the 2nd attempt to create a > BusApplicationContext and let the original exception propagate upwards. > private BusApplicationContext createApplicationContext(String > cfgFiles[], boolean includeDefaults) { > try { > return new BusApplicationContext(cfgFiles, includeDefaults, > context); > } catch (BeansException ex) { > ClassLoader contextLoader = > Thread.currentThread().getContextClassLoader(); > if (contextLoader != > BusApplicationContext.class.getClassLoader()) { > Thread.currentThread().setContextClassLoader( > BusApplicationContext.class.getClassLoader()); > try { > return new BusApplicationContext(cfgFiles, > includeDefaults, context); > } finally { > > Thread.currentThread().setContextClassLoader(contextLoader); > } > } else { > throw ex; > } > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.