on 2017 Apr 13 12:41 PM - last edited on 2024 Feb 03 9:00 PM by postmig_api_4
I want to access data which has been served by the Cloud Connector and which is successfully connected to my Cloud Platform account. Now I want to access this data within a Spring Boot application and display the data on a web page.
But I get an error when I try to access the connectivityConfiguration resource:
javax.naming.NamingException: Cannot create resource instance
In Spring Boot I have no web.xml, so I try to do it this way:
@Bean
public TomcatEmbeddedServletContainerFactory tomcatFactory() {
return new TomcatEmbeddedServletContainerFactory() {
@Override
protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(Tomcat tomcat) {
tomcat.enableNaming();
return super.getTomcatEmbeddedServletContainer(tomcat);
}
@Override
protected void postProcessContext(Context context) {
ContextResource resource = new ContextResource();
resource.setName("connectivityConfiguration");
resource.setType(com.sap.core.connectivity.api.configuration.ConnectivityConfiguration.class.getName());
context.getNamingResources().addResource(resource);
}
};
}
When I access the InitialContext, I see the connectivityConfiguration key in the list of resources, but when I try to access it like that:
Context context = new InitialContext();
Object conObj = context.lookup("java:comp/env/connectivityConfiguration");
ConnectivityConfiguration configuration = (ConnectivityConfiguration) conObj;
.. I get the exception I mentioned above.
Any idea?
Request clarification before answering.
I also have similar requirement but without springboot.
I have a web.xml filebut still I am facing same set of isues.
Regards
Shirjan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
11 | |
9 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.