I am trying to access an additional data store in application deployed as uberJar, in order to perform a SQL query.
When I run the application locally, I use JNDI to resolve the data source name, which is
where (name) is name of my database. And this is working fine.
However, when I build the application as uberJar, and define datasources in jetty-env.xml (overriden via -jettyEnvPath runtime parameter, an attempt to resolve the above JNDI name returns
java.lang.RuntimeException: Could not get data source from JNDI by name java:/comp/env/jdbc/lens --- javax.naming.NameNotFoundException: null at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(ServiceInterceptor.java:127) at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
I don’t know what is wrong. The data sources are defined in jetty-env.xml, and they are used by CUBA.
But I cannot access them via JNDI. Is it somehow related to context.xml?
Thanks for any support.