Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » JNDI-Context on Tomcat 5.5
JNDI-Context on Tomcat 5.5 [message #115942] Tue, 16 December 2008 16:48 Go to next message
Alex is currently offline AlexFriend
Messages: 6
Registered: July 2009
Junior Member
Hi,

I want to deploy my RAP app on an external server (Tomcat 5.5) using the
equinox servlet bridge. I need to instantiate the quartz scheduler and
have it to be communicating with a derby database, but I'm not able to
initialize the context (see the exception beneath).

Here is what I've already tried (without success):
- adding a folder "META-INF" to server-directory on the same level as my
project's WEB-INF-folder; this contains a "context.xml" where the context
is defined
- same context.xml renamed as myproject.xml copied into
jakarta-tomcat-5.5.9\conf\Catalina\localhost
- jakarta-tomcat-5.5.9\conf\server.xml: adding a resource with the
connection properties under "<GlobalNamingResources>"
- adding following code to my project's web.xml:
<resource-ref>
<description>Supplycare DB</description>
<res-ref-name>jdbc/quartz</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

here the jndi url that is given to the quartz-constructor with a few other
properties:
org.quartz.jobStore.dataSource = quartzDS1
org.quartz.dataSource.quartzDS1.jndiURL = java:comp/env/jdbc/quartz

The database is working fine in other (non-RAP) projects. Is it possible,
that the context is overwritten by any RAP-feature?

Thanks for your help.

Regards, Alex


ERROR JNDIConnectionProvider:129 - Error looking up datasource: Name
java:comp is not bound in this Context
javax.naming.NameNotFoundException: Name java:comp is not bound in this
Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:76 9)
at org.apache.naming.NamingContext.lookup(NamingContext.java:15 2)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
org.quartz.utils.JNDIConnectionProvider.init(JNDIConnectionP rovider.java:127)
at
org.quartz.utils.JNDIConnectionProvider.<init>(JNDIConnectionProvider.java:105)
at
org.quartz.impl.StdSchedulerFactory.instantiate(StdScheduler Factory.java:917)
at
org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedule rFactory.java:1355)
at
scheduler.service.CommonSchedulerService.initializeScheduler (CommonSchedulerService.java:91)
at
scheduler.service.SchedulerControlService.initializeSchedule r(SchedulerControlService.java:55)
at
scheduler.service.CommonSchedulerService.<init>(CommonSchedulerService.java:78)
at
scheduler.service.SchedulerControlService.<init>(SchedulerControlService.java:34)
at
rap.SchedServCommunicationImpl.initScheduler(SchedServCommun icationImpl.java:82)
at rap.BorderLayoutView.createPartControl(BorderLayoutView.java :80)
at
org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:371)
at
org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:230)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:594)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:31 2)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:53 6)
at
org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:180)
at
org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:265)
at
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:64)
at
org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:478)
at
org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.java:1260)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1213)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:16 13)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.ja va:651)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.ja va:577)
at
org.eclipse.ui.internal.PartSashContainer.createControl(Part SashContainer.java:569)
at
org.eclipse.ui.internal.PerspectiveHelper.activate(Perspecti veHelper.java:269)
at org.eclipse.ui.internal.Perspective.onActivate(Perspective.j ava:930)
at
org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPa ge.java:2498)
at
org.eclipse.ui.internal.WorkbenchWindow$22.run(WorkbenchWind ow.java:2832)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:66)
at
org.eclipse.ui.internal.WorkbenchWindow.setActivePage(Workbe nchWindow.java:2813)
at
org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(Workben chWindow.java:718)
at
org.eclipse.ui.internal.Workbench$18.runWithException(Workbe nch.java:976)
at
org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:32)
at
org.eclipse.rwt.internal.lifecycle.UICallBackManager.addSync (UICallBackManager.java:135)
at org.eclipse.swt.widgets.Display$2.run(Display.java:649)
at
org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler. runNonUIThreadWithFakeContext(UICallBackServiceHandler.java: 423)
at
org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeC ontext(UICallBack.java:44)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:647)
at
org.eclipse.ui.internal.StartupThreading.runWithWorkbenchExc eptions(StartupThreading.java:55)
at
org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Wo rkbench.java:972)
at
org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Work bench.java:1793)
at
org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbe nch.java:1729)
at
org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWin dow(WorkbenchConfigurer.java:188)
at
org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:790)
at
org.eclipse.ui.internal.Workbench$25.runWithException(Workbe nch.java:1335)
at
org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:32)
at
org.eclipse.rwt.internal.lifecycle.UICallBackManager.addSync (UICallBackManager.java:135)
at org.eclipse.swt.widgets.Display$2.run(Display.java:649)
at
org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler. runNonUIThreadWithFakeContext(UICallBackServiceHandler.java: 423)
at
org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeC ontext(UICallBack.java:44)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:647)
at
org.eclipse.ui.internal.StartupThreading.runWithoutException s(StartupThreading.java:110)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1330)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:22 00)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:425)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:408)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:157)
at rap.SchedServGui.createUI(SchedServGui.java:13)
at
org.eclipse.rwt.internal.lifecycle.EntryPointManager.createU I(EntryPointManager.java:92)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWT LifeCycle.java:228)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadCont roller.run(RWTLifeCycle.java:116)
at java.lang.Thread.run(Thread.java:619)
Re: JNDI-Context on Tomcat 5.5 [message #116838 is a reply to message #115942] Sun, 21 December 2008 02:57 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
This is doable albeit a bit complicated.

In most (if not all) of the JNDI implementations I'm aware of your context
is scoped by whatever your context class loader is.
In addition another thing to be aware of is that some app servers will only
permit JNDI lookup on the thread that originated the request. (If you're
curious, this is normally enforced by a security token store in a
thread-local).

To get at the various things you've set you need to set up a try/finally
block that:
1) saves the current context class loader
2) set the context class loader to the web app class loader (The approach I
suggest is to get it from org.eclipse.equinox.servletbridge.BridgeServlet --
something like BridgeServlet.class.getClassLoader())
3) Do your JNDI calls
4) reset the context class loader saved in step 1.

HTH
-Simon

"Alex " <famagusta@gmx.de> wrote in message
news:04b5028423cc9d06d70e7d192ca273f7$1@www.eclipse.org...
> Hi,
>
> I want to deploy my RAP app on an external server (Tomcat 5.5) using the
> equinox servlet bridge. I need to instantiate the quartz scheduler and
> have it to be communicating with a derby database, but I'm not able to
> initialize the context (see the exception beneath).
> Here is what I've already tried (without success):
> - adding a folder "META-INF" to server-directory on the same level as my
> project's WEB-INF-folder; this contains a "context.xml" where the context
> is defined
> - same context.xml renamed as myproject.xml copied into
> jakarta-tomcat-5.5.9\conf\Catalina\localhost
> - jakarta-tomcat-5.5.9\conf\server.xml: adding a resource with the
> connection properties under "<GlobalNamingResources>"
> - adding following code to my project's web.xml:
> <resource-ref>
> <description>Supplycare DB</description>
> <res-ref-name>jdbc/quartz</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> here the jndi url that is given to the quartz-constructor with a few other
> properties:
> org.quartz.jobStore.dataSource = quartzDS1
> org.quartz.dataSource.quartzDS1.jndiURL = java:comp/env/jdbc/quartz
>
> The database is working fine in other (non-RAP) projects. Is it possible,
> that the context is overwritten by any RAP-feature?
>
> Thanks for your help.
>
> Regards, Alex
>
>
> ERROR JNDIConnectionProvider:129 - Error looking up datasource: Name
> java:comp is not bound in this Context
> javax.naming.NameNotFoundException: Name java:comp is not bound in this
> Context
> at org.apache.naming.NamingContext.lookup(NamingContext.java:76 9)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:15 2)
> at javax.naming.InitialContext.lookup(InitialContext.java:392)
> at
> org.quartz.utils.JNDIConnectionProvider.init(JNDIConnectionP rovider.java:127)
> at
> org.quartz.utils.JNDIConnectionProvider.<init>(JNDIConnectionProvider.java:105)
> at
> org.quartz.impl.StdSchedulerFactory.instantiate(StdScheduler Factory.java:917)
> at
> org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedule rFactory.java:1355)
> at
> scheduler.service.CommonSchedulerService.initializeScheduler (CommonSchedulerService.java:91)
> at
> scheduler.service.SchedulerControlService.initializeSchedule r(SchedulerControlService.java:55)
> at
> scheduler.service.CommonSchedulerService.<init>(CommonSchedulerService.java:78)
> at
> scheduler.service.SchedulerControlService.<init>(SchedulerControlService.java:34)
> at
> rap.SchedServCommunicationImpl.initScheduler(SchedServCommun icationImpl.java:82)
> at rap.BorderLayoutView.createPartControl(BorderLayoutView.java :80)
> at
> org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:371)
> at
> org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:230)
> at
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:594)
> at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:31 2)
> at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:53 6)
> at
> org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:180)
> at
> org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:265)
> at
> org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:64)
> at
> org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:478)
> at
> org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.java:1260)
> at org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1213)
> at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:16 13)
> at org.eclipse.ui.internal.PartStack.createControl(PartStack.ja va:651)
> at org.eclipse.ui.internal.PartStack.createControl(PartStack.ja va:577)
> at
> org.eclipse.ui.internal.PartSashContainer.createControl(Part SashContainer.java:569)
> at
> org.eclipse.ui.internal.PerspectiveHelper.activate(Perspecti veHelper.java:269)
> at org.eclipse.ui.internal.Perspective.onActivate(Perspective.j ava:930)
> at
> org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPa ge.java:2498)
> at
> org.eclipse.ui.internal.WorkbenchWindow$22.run(WorkbenchWind ow.java:2832)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:66)
> at
> org.eclipse.ui.internal.WorkbenchWindow.setActivePage(Workbe nchWindow.java:2813)
> at
> org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(Workben chWindow.java:718)
> at
> org.eclipse.ui.internal.Workbench$18.runWithException(Workbe nch.java:976)
> at
> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:32)
> at
> org.eclipse.rwt.internal.lifecycle.UICallBackManager.addSync (UICallBackManager.java:135)
> at org.eclipse.swt.widgets.Display$2.run(Display.java:649)
> at
> org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler. runNonUIThreadWithFakeContext(UICallBackServiceHandler.java: 423)
> at
> org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeC ontext(UICallBack.java:44)
> at org.eclipse.swt.widgets.Display.syncExec(Display.java:647)
> at
> org.eclipse.ui.internal.StartupThreading.runWithWorkbenchExc eptions(StartupThreading.java:55)
> at
> org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Wo rkbench.java:972)
> at
> org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Work bench.java:1793)
> at
> org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbe nch.java:1729)
> at
> org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWin dow(WorkbenchConfigurer.java:188)
> at
> org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:790)
> at
> org.eclipse.ui.internal.Workbench$25.runWithException(Workbe nch.java:1335)
> at
> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:32)
> at
> org.eclipse.rwt.internal.lifecycle.UICallBackManager.addSync (UICallBackManager.java:135)
> at org.eclipse.swt.widgets.Display$2.run(Display.java:649)
> at
> org.eclipse.rwt.internal.lifecycle.UICallBackServiceHandler. runNonUIThreadWithFakeContext(UICallBackServiceHandler.java: 423)
> at
> org.eclipse.rwt.lifecycle.UICallBack.runNonUIThreadWithFakeC ontext(UICallBack.java:44)
> at org.eclipse.swt.widgets.Display.syncExec(Display.java:647)
> at
> org.eclipse.ui.internal.StartupThreading.runWithoutException s(StartupThreading.java:110)
> at org.eclipse.ui.internal.Workbench.init(Workbench.java:1330)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
> at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:22 00)
> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:425)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:408)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:157)
> at rap.SchedServGui.createUI(SchedServGui.java:13)
> at
> org.eclipse.rwt.internal.lifecycle.EntryPointManager.createU I(EntryPointManager.java:92)
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWT LifeCycle.java:228)
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadCont roller.run(RWTLifeCycle.java:116)
> at java.lang.Thread.run(Thread.java:619)
>
Re: JNDI-Context on Tomcat 5.5 [message #116997 is a reply to message #116838] Tue, 23 December 2008 08:21 Go to previous message
Alex is currently offline AlexFriend
Messages: 6
Registered: July 2009
Junior Member
Thank you!

I resolved the problem by using the SimpleJNDI-Implementation.

Regards,
Alex
Previous Topic:Layout not working when reloading rap site
Next Topic:Problem with trees and Firefox 3.1 beta 2
Goto Forum:
  


Current Time: Tue Sep 24 19:31:57 GMT 2024

Powered by FUDForum. Page generated in 0.03304 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top