Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » java.lang.NullPointerException: The parameter 'contextDirectory' must not be null.
java.lang.NullPointerException: The parameter 'contextDirectory' must not be null. [message #1402163] Wed, 16 July 2014 16:06 Go to next message
Edmundo López Bóbeda is currently offline Edmundo López BóbedaFriend
Messages: 15
Registered: October 2012
Junior Member
Hello,

I'm trying to deploy an RAP application to Heroku, but I get the following exception (see later). The setup of my application is without the workbench and packaged as a war. In heroku they use Tomcat 7 using a wrapper to launch the app.

My research lead me to the following problem. The RAP app (in the class org.eclipse.rap.rwt.internal.application.ApplicationContextImpl) is trying to create a file to put the resources (it's not me but the framework) and to define where to write it either obtains it from the servlet context using the parameter name 'resource_root_location' or the default value, the root directory "/".

Somehow, in the wrapper, the function servletContext.getRealPath( "/" ) returns null. Even though I try to set the variable to use another directory, putting the following in web.xml:

	<context-param>
		<param-name>resource_root_location</param-name>
		<param-value>./tmp</param-value>
	</context-param>


I still get null. I use that directory (I mean the tmp directory), because Heroku won't let the app write in any other directory, which is another problem. In fact, they do not guarantee that whatever the framework wrote will remain there. If you want to test the error, you can try any war using RWT with the heroku launcher available here: https://github.com/heroku/devcenter-webapp-runner.git

So my questions are the following:

- Is there a way for the RAP-framework to avoid writing?
- If not, how can I configure the 'resource_root_location' variable?


Best regards,

Edmundo

---- here is the exception ----

argos:net.lopezbobeda.dplus.myapp mundacho$ java -jar ../../devcenter-webapp-runner/target/dependency/webapp-runner.jar target/net.lopezbobeda.dplus.myapp-1.0.0.qualifier.war 
deploying app from: /Users/mundacho/git/net.lopezbobeda.dplus.myapp/net.lopezbobeda.dplus.myapp/target/net.lopezbobeda.dplus.myapp-1.0.0.qualifier.war
juil. 16, 2014 5:37:10 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
juil. 16, 2014 5:37:10 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
juil. 16, 2014 5:37:10 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.22
juil. 16, 2014 5:37:11 PM org.apache.catalina.startup.ContextConfig webConfig
INFO: No global web.xml found
juil. 16, 2014 5:37:12 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.eclipse.rap.rwt.engine.RWTServletContextListener
java.lang.NullPointerException: The parameter 'contextDirectory' must not be null.
	at org.eclipse.rap.rwt.internal.util.ParamCheck.notNull(ParamCheck.java:40)
	at org.eclipse.rap.rwt.internal.resources.ResourceDirectory.configure(ResourceDirectory.java:28)
	at org.eclipse.rap.rwt.internal.application.ApplicationContextImpl.doActivate(ApplicationContextImpl.java:254)
	at org.eclipse.rap.rwt.internal.application.ApplicationContextImpl.activate(ApplicationContextImpl.java:131)
	at org.eclipse.rap.rwt.application.ApplicationRunner.activateApplicationContext(ApplicationRunner.java:115)
	at org.eclipse.rap.rwt.application.ApplicationRunner.start(ApplicationRunner.java:83)
	at org.eclipse.rap.rwt.engine.RWTServletContextListener.contextInitialized(RWTServletContextListener.java:49)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

juil. 16, 2014 5:37:12 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
juil. 16, 2014 5:37:12 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
juil. 16, 2014 5:37:12 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Re: java.lang.NullPointerException: The parameter 'contextDirectory' must not be null. [message #1402608 is a reply to message #1402163] Thu, 17 July 2014 08:16 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1931
Registered: July 2009
Senior Member
Hi,
there is such a problem with WebLogic server (getRealPath returns null).
See bug:
431883: contextDirectory null exception in RWT standalone under WebLogic
https://bugs.eclipse.org/bugs/show_bug.cgi?id=431883
In the bug entry comment#2 there is a configuration parameter to "show"
the real path. Maybe such configuration exists in your case also.
We already have an enhancement request for using RAP without access to
the file system:
430091: Deliver static resources by servlet
https://bugs.eclipse.org/bugs/show_bug.cgi?id=430091
HTH,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: java.lang.NullPointerException: The parameter 'contextDirectory' must not be null. [message #1402616 is a reply to message #1402608] Thu, 17 July 2014 08:31 Go to previous messageGo to next message
Edmundo López Bóbeda is currently offline Edmundo López BóbedaFriend
Messages: 15
Registered: October 2012
Junior Member
Thanks a lot for your answer. I guess I'll try to find a workaround.

Otherwise, do you know how to set the property 'resource_root_location' ? in the documentation there is no hint of how to set it. Is the way I did it right? Or is it set at another place?

Best regards,

Edmundo
Re: java.lang.NullPointerException: The parameter 'contextDirectory' must not be null. [message #1402825 is a reply to message #1402163] Thu, 17 July 2014 15:50 Go to previous messageGo to next message
Edmundo López Bóbeda is currently offline Edmundo López BóbedaFriend
Messages: 15
Registered: October 2012
Junior Member
I found a workaround for the issue and I wrote a blog post about it if you are interested. Basically to set the attribute, you need subclass the RWTServletContextListener class (that's the only solution I found). Here is the link:

http://edmundo.lopezbobeda.net/blog/how-deploy-your-eclipse-rap-application-heroku

Re: java.lang.NullPointerException: The parameter 'contextDirectory' must not be null. [message #1402830 is a reply to message #1402825] Thu, 17 July 2014 16:49 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1931
Registered: July 2009
Senior Member
Thanks for the great blog post, Edmundo! It's really useful.
Best,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Logging in JBoss 7
Next Topic:Issue with KeyBinding containing '+'
Goto Forum:
  


Current Time: Wed Apr 01 13:19:03 GMT 2015

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

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