Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can't load Spring context in Talend ESB Runtime

What I am doing: I'm using an external JAR library made with Spring, through a tJavaFlex component. I've created a Routine with my own method and library that is loading my application context this way:
public String customMethod(){
ApplicationContext ap = new ClassPathXmlApplicationContext("classpath:/META-INF/spring/application-context.xml");
CustomInterface test = (CustomInterface) ap.getBean("customClass");

return test.businessMethod();
}

My application-context.xml looks like this one:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
      xmlns:xsi=""
      xmlns:context=""
      xmlns:mvc=""
      xsi:schemaLocation="
                         
                          ">
   <!-- Spring IoC Context -->
   <context:component-scan base-package="com.test" />
   <import resource="root-config.xml" />
   <import resource="classpath:/root-context.xml" />
   <!-- Enables the Spring MVC @Controller programming model -->
   <mvc:annotation-driven />
</beans>

the tJavaFlex component is inside a Job that is called from a Route.
If I run this on my Talend Open Studio ESB it works.
My problem: from the mediation perspective, I right-click on my route and build it, so I can deploy inside my Runtimefolder/container/deploy.
But when I use my route from my container it doesn't work! It looks like it can't load the application-context.xml file, giving me an exception like it can't find a bean named "customClass".
Is it because the "classpath" is differend in the built kar file? How can I fix this?
Labels (4)
2 Replies
Anonymous
Not applicable
Author

Route already contains own Spring config (Spring view at Mediation perspective). You can extend it as you wish.
Anonymous
Not applicable
Author

Route already contains own Spring config (Spring view at Mediation perspective). You can extend it as you wish.

I'm using a Routine not a Route...