I do struggle with the following situation:
I have an Equinox based server, running OSGI Jetty hosting a webapp employing spring. The Equinox server already uses gemini naming to provide the non-jta-data-source to eclipselink, which works perfectly.
Now I want to pass this DataSource to the spring application. My research so far brought me to the following steps:
* Register the datasource with JNDI
** Employ gemini naming for this
* Register a reference within web.xml for the web-application
** Activate JNDI initialization for jetty via jetty-web.xml
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
** Add the resource in web.xml
<resource-ref>
<description>Elexis DB Connection</description>
<res-ref-name>osgi:service/jdbc/poolable</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
* Reference the DataSource out of the spring-application
<bean id="dataSourceElexis" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/poolable">
</property>
</bean>
This all does not look to bad - but I can't seem to figure out the following: Why does gemini naming not care for "java:comp"?
I get the following exception when initializing org.eclipse.jetty.plus.webapp.EnvConfiguration.createEnvContext
2018-02-02 09:05:00,350 WARN o.eclipse.jetty.webapp.WebAppContext - Failed startup of context o.e.j.w.WebAppContext@51c85cbe{/org.mitre,file:///Users/marco/Development/elexis-server-master/ws/org.mitre.openid-connect-server-webapp/,null}{file:/Users/marco/Development/elexis-server-master/ws/org.mitre.openid-connect-server-webapp/}
javax.naming.NameNotFoundException: Name: java:comp was not found. A URL Context Factory was not registered to handle this URL scheme
at org.eclipse.gemini.naming.ContextWrapperImpl.getURLContextOrDefaultContext(ContextWrapperImpl.java:220) ~[na:na]
at org.eclipse.gemini.naming.ContextWrapperImpl.lookup(ContextWrapperImpl.java:51) ~[na:na]