Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » "start parameters" for RAP applications?
"start parameters" for RAP applications? [message #64868] Fri, 07 December 2007 09:31 Go to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

hi!

i communicate with an oracle database in my rap app. until now, the
connection properties like address, username and pw are hardcoded in the
source. i need a solution to submit these properties from "outside" like a
conf file, for the case the connection data changes. is there a
possibility to use the web.xml for example, or do i get access to a file
in the web-app folder? the database connection starts when a user opens
the application, so i need a solution to get these properties during the
runtime.

i would be very grateful for any advice :).

mfg
-ben
Re: "start parameters" for RAP applications? [message #65792 is a reply to message #64868] Wed, 12 December 2007 05:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

ok, now i can decribe my problem more specific :P

i tried to set environment entries in my web.xml and tried to access them
as described here:

http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto .html



my entry in the web.xml:

<env-entry>
<env-entry-name>blabla</env-entry-name>
<env-entry-value>jageilomatic</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>



my code in the rap application:

try {
Context env = (Context)new InitialContext().lookup("java:comp/env");
String blaString = (String)env.lookup("blabla");
System.out.println(blaString);
} catch (NamingException e) {
e.printStackTrace();
}



i always get the exception:

osgi> javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.naming.java.javaURLContextFactory [Root exception is
java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at
de.ineos.azubidb.ApplicationWorkbenchWindowAdvisor.preWindow Open(ApplicationWorkbenchWindowAdvisor.java:49)
at
org.eclipse.ui.internal.WorkbenchWindow.fireWindowOpening(Wo rkbenchWindow.java:1082)
at
org.eclipse.ui.internal.WorkbenchWindow.<init>(WorkbenchWindow.java:288)
at
org.eclipse.ui.internal.Workbench.newWorkbenchWindow(Workben ch.java:1663)
at
org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Wo rkbench.java:925)
at
org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Work bench.java:1775)
at
org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbe nch.java:1722)
at
org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWin dow(WorkbenchConfigurer.java:184)
at
org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:755)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1284)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2246)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:382)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:153)
at de.ineos.azubidb.Application.createUI(Application.java:15)
at
org.eclipse.rwt.internal.lifecycle.EntryPointManager.createU I(EntryPointManager.java:92)
at
org.eclipse.rwt.internal.lifecycle.PrepareUIRoot.execute(Pre pareUIRoot.java:36)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.executePhase (RWTLifeCycle.java:124)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.execute(RWTL ifeCycle.java:86)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler$1.r un(LifeCycleServiceHandler.java:59)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler.int ernalService(LifeCycleServiceHandler.java:175)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler.acc ess$1(LifeCycleServiceHandler.java:167)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler$Lif eCycleServiceHandlerSync.doService(LifeCycleServiceHandler.j ava:132)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync.serviceInternal(RWTLifeCycleServiceHandlerSync.java:51 )
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync.access$0(RWTLifeCycleServiceHandlerSync.java:43)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync$1.service(RWTLifeCycleServiceHandlerSync.java:38)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleBlockControl$ ServiceHandlerProcessor.run(RWTLifeCycleBlockControl.java:68 )
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleThreadPool$Po olRunnable.run(RWTLifeCycleThreadPool.java:38)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleThreadPool$Po olWorker.run(RWTLifeCycleThreadPool.java:66)
Caused by: java.lang.ClassNotFoundException:
org.apache.naming.java.javaURLContextFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.eclipse.core.runtime.internal.adaptor.ContextFinder.load Class(ContextFinder.java:129)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
... 32 more



the same happens if i try to use a JDNI datasource for the database for
example, is also tried to set these parameters:

System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.naming.java.javaURLContextFactory");
System.setProperty(Context.PROVIDER_URL, "org.apache.naming");


without success. the org.apache.naming.java.javaURLContextFactory is in
the catalina.jar in tomcat6.0/lib

maybe the problem lies between the equinox servlet bridge and the rap
app???!?!??

i don't see what i'm doing wrong or how this is supposed to work. couldn't
find a solution until now. i hope someone can help me because to my mind
this is a critical issue if someone uses a datasource like a database for
example and not want to recompile and redeploy the app when the database
changes.
Re: "start parameters" for RAP applications? [message #65815 is a reply to message #65792] Wed, 12 December 2007 05:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

i should add that i try this while the rap is deployed on the tomcat, this
is an outlet of the tomcat log. if i run the app in eclipse the exception
i get is:

javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file: java.naming.factory.initial
at
javax.naming.spi.NamingManager.getInitialContext(NamingManag er.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext .java:288)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialCo ntext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
de.ineos.azubidb.ApplicationWorkbenchWindowAdvisor.preWindow Open(ApplicationWorkbenchWindowAdvisor.java:49)
at
org.eclipse.ui.internal.WorkbenchWindow.fireWindowOpening(Wo rkbenchWindow.java:1082)
at
org.eclipse.ui.internal.WorkbenchWindow.<init>(WorkbenchWindow.java:288)
at
org.eclipse.ui.internal.Workbench.newWorkbenchWindow(Workben ch.java:1663)
at
org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Wo rkbench.java:925)
at
org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Work bench.java:1775)
at
org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbe nch.java:1722)
at
org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWin dow(WorkbenchConfigurer.java:184)
at
org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:755)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1284)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2246)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:382)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:153)
at de.ineos.azubidb.Application.createUI(Application.java:15)
at
org.eclipse.rwt.internal.lifecycle.EntryPointManager.createU I(EntryPointManager.java:92)
at
org.eclipse.rwt.internal.lifecycle.PrepareUIRoot.execute(Pre pareUIRoot.java:36)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.executePhase (RWTLifeCycle.java:124)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.execute(RWTL ifeCycle.java:86)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler$1.r un(LifeCycleServiceHandler.java:59)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler.int ernalService(LifeCycleServiceHandler.java:175)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler.acc ess$1(LifeCycleServiceHandler.java:167)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler$Lif eCycleServiceHandlerSync.doService(LifeCycleServiceHandler.j ava:132)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync.serviceInternal(RWTLifeCycleServiceHandlerSync.java:51 )
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync.access$0(RWTLifeCycleServiceHandlerSync.java:43)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync$1.service(RWTLifeCycleServiceHandlerSync.java:38)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleBlockControl$ ServiceHandlerProcessor.run(RWTLifeCycleBlockControl.java:68 )
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleThreadPool$Po olRunnable.run(RWTLifeCycleThreadPool.java:38)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleThreadPool$Po olWorker.run(RWTLifeCycleThreadPool.java:66)


but thats ok, because i don't know where the web.xml for the embedded
jetty server is located =)) so i can't set the env-value. but it should
work deployed on tomcat...
Re: "start parameters" for RAP applications? [message #66009 is a reply to message #65792] Wed, 12 December 2007 11:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Ben,

sorry for the late response, we have been quite busy with the 1.0.1
service release.
I would assume that this is a class-loader problem. As you can see from
the stackt-trace the core-runtime class-loader is used to load the
javaURLContextFactory and by default does not know about classes outside
the OSGi framework like those provided by catalina.jar.

The extendedFrameworkExports init-param in the web.xml may help to
expose those classes to Equinox.
Here are some resources I found:
http://www.eclipsezone.com/eclipse/forums/t103850.html
http://www.eclipsezone.org/eclipse/forums/m92163351.html
http://dev.eclipse.org/newslists/news.eclipse.technology.equ inox/msg04043.html

For a quick-and-dirty solution it might as well help to change the
launch.ini properties, namely osgi.parentClassloader and
osgi.contextClassLoaderParent. See here for a description:
http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/misc/runtime-options.html

And last but not least there is the Equinox newsgroup, where the real
experts linger around;)

HTH
Rüdiger



Ben W. wrote:
> ok, now i can decribe my problem more specific :P
>
> i tried to set environment entries in my web.xml and tried to access
> them as described here:
>
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto .html
>
>
>
> my entry in the web.xml:
>
> <env-entry> <env-entry-name>blabla</env-entry-name>
> <env-entry-value>jageilomatic</env-entry-value>
> <env-entry-type>java.lang.String</env-entry-type> </env-entry>
>
>
>
> my code in the rap application:
>
> try {
> Context env = (Context)new InitialContext().lookup("java:comp/env");
> String blaString = (String)env.lookup("blabla");
> System.out.println(blaString);
> } catch (NamingException e) {
> e.printStackTrace();
> }
>
>
>
> i always get the exception:
>
> osgi> javax.naming.NoInitialContextException: Cannot instantiate class:
> org.apache.naming.java.javaURLContextFactory [Root exception is
> java.lang.ClassNotFoundException:
> org.apache.naming.java.javaURLContextFactory]
> at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
> at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
> at javax.naming.InitialContext.init(Unknown Source)
> at javax.naming.InitialContext.<init>(Unknown Source)
> at
> de.ineos.azubidb.ApplicationWorkbenchWindowAdvisor.preWindow Open(ApplicationWorkbenchWindowAdvisor.java:49)
>
> at
> org.eclipse.ui.internal.WorkbenchWindow.fireWindowOpening(Wo rkbenchWindow.java:1082)
>
> at
> org.eclipse.ui.internal.WorkbenchWindow.<init>(WorkbenchWindow.java:288)
> at
> org.eclipse.ui.internal.Workbench.newWorkbenchWindow(Workben ch.java:1663)
> at
> org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Wo rkbench.java:925)
>
> at
> org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Work bench.java:1775)
>
> at
> org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbe nch.java:1722)
> at
> org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWin dow(WorkbenchConfigurer.java:184)
>
> at
> org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:755)
>
> at org.eclipse.ui.internal.Workbench.init(Workbench.java:1284)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2246)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:382)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:153)
> at de.ineos.azubidb.Application.createUI(Application.java:15)
> at
> org.eclipse.rwt.internal.lifecycle.EntryPointManager.createU I(EntryPointManager.java:92)
>
> at
> org.eclipse.rwt.internal.lifecycle.PrepareUIRoot.execute(Pre pareUIRoot.java:36)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.executePhase (RWTLifeCycle.java:124)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.execute(RWTL ifeCycle.java:86)
>
> at
> org.eclipse.rwt.internal.service.LifeCycleServiceHandler$1.r un(LifeCycleServiceHandler.java:59)
>
> at
> org.eclipse.rwt.internal.service.LifeCycleServiceHandler.int ernalService(LifeCycleServiceHandler.java:175)
>
> at
> org.eclipse.rwt.internal.service.LifeCycleServiceHandler.acc ess$1(LifeCycleServiceHandler.java:167)
>
> at
> org.eclipse.rwt.internal.service.LifeCycleServiceHandler$Lif eCycleServiceHandlerSync.doService(LifeCycleServiceHandler.j ava:132)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync.serviceInternal(RWTLifeCycleServiceHandlerSync.java:51 )
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync.access$0(RWTLifeCycleServiceHandlerSync.java:43)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync$1.service(RWTLifeCycleServiceHandlerSync.java:38)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycleBlockControl$ ServiceHandlerProcessor.run(RWTLifeCycleBlockControl.java:68 )
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycleThreadPool$Po olRunnable.run(RWTLifeCycleThreadPool.java:38)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycleThreadPool$Po olWorker.run(RWTLifeCycleThreadPool.java:66)
>
> Caused by: java.lang.ClassNotFoundException:
> org.apache.naming.java.javaURLContextFactory
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at
> org.eclipse.core.runtime.internal.adaptor.ContextFinder.load Class(ContextFinder.java:129)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Unknown Source)
> at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
> ... 32 more
>
>
>
> the same happens if i try to use a JDNI datasource for the database for
> example, is also tried to set these parameters:
>
> System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.naming.java.javaURLContextFactory");
> System.setProperty(Context.PROVIDER_URL, "org.apache.naming");
>
>
> without success. the org.apache.naming.java.javaURLContextFactory is in
> the catalina.jar in tomcat6.0/lib
>
> maybe the problem lies between the equinox servlet bridge and the rap
> app???!?!??
>
> i don't see what i'm doing wrong or how this is supposed to work.
> couldn't find a solution until now. i hope someone can help me because
> to my mind this is a critical issue if someone uses a datasource like a
> database for example and not want to recompile and redeploy the app when
> the database changes.
>
>
>
Re: "start parameters" for RAP applications? [message #66031 is a reply to message #66009] Wed, 12 December 2007 13:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

thanks for the response, the links were quite helpful.

after about 8hrs struggling with this issue i found this thread in the
newsgroup:
http://dev.eclipse.org/newslists/news.eclipse.technology.rap /msg00521.html

i can't explain how i could miss this thread, i searched the newsgroup
several times :P

nevertheless, this solution works. when i find the time i will sum up this
issue for the rap wiki.

but why do u think the contextClassLoaderParent=ccl option is
"quick-and-dirty"? what could be possible side-effects?
maybe the solution frank suggested in the link i posted above, with the
helper class, is a more convenient method to tackle this problem. but this
almost seems like too much "hacking" to me :PPP

but i'm really thrilled to have a working solution so far.
life can go on, for now :))))
Re: "start parameters" for RAP applications? [message #66052 is a reply to message #66031] Wed, 12 December 2007 13:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Hi Ben,

good to hear you finally found a solution;) See my comments below.

Cheers,
Rüdiger

Ben W. wrote:
> thanks for the response, the links were quite helpful.
>
> after about 8hrs struggling with this issue i found this thread in the
> newsgroup:
> http://dev.eclipse.org/newslists/news.eclipse.technology.rap /msg00521.html
>
> i can't explain how i could miss this thread, i searched the newsgroup
> several times :P
>
> nevertheless, this solution works. when i find the time i will sum up
> this issue for the rap wiki.

That would be very kind:)

> but why do u think the contextClassLoaderParent=ccl option is
> "quick-and-dirty"? what could be possible side-effects? maybe the

These options are not very fine-grained. As long as you need a distinct
set of packages I would recommend the extendedFrameworkExports.
With the launch.ini settings you might export classes that you don't
want to, or "override" classes that are also exposed by bundles and
wonder why they aren't loaded.

> solution frank suggested in the link i posted above, with the helper
> class, is a more convenient method to tackle this problem. but this
> almost seems like too much "hacking" to me :PPP
>
> but i'm really thrilled to have a working solution so far.
> life can go on, for now :))))
>
>
>
Re: "start parameters" for RAP applications? [message #638102 is a reply to message #66052] Tue, 09 November 2010 17:38 Go to previous message
Eclipse UserFriend
Did this approach ever get written up? I'm having trouble getting it working.

I keep getting
javax.naming.NameNotFoundException: Name 'test-entry' is not bound in this Context

I've created a sample web app that is able to access it, but when I try to access it through a class in the RAP application, it doesn't work.
Previous Topic:Deploy RAP in tomcat
Next Topic:AJAX World Presentation on RAP
Goto Forum:
  


Current Time: Thu Mar 13 15:36:22 EDT 2025

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

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

Back to the top