Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RWT Standalone WAR to WebLogic contextDirectory null(The parameter 'contextDirectory' must not be null)
RWT Standalone WAR to WebLogic contextDirectory null [message #1278566] Thu, 27 March 2014 10:12 Go to next message
Eclipse UserFriend
Attempting to do an RWT standalone to WebLogic in a WAR for my RAP application, without OSGi, getting this error in the WebLogic console:

Caused by: 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:27)
        at org.eclipse.rap.rwt.internal.application.ApplicationContextImpl.doActivate(ApplicationContextImpl.java:329)
        at org.eclipse.rap.rwt.internal.application.ApplicationContextImpl.activate(ApplicationContextImpl.java:205)
        at org.eclipse.rap.rwt.application.ApplicationRunner.start(ApplicationRunner.java:82)
        at org.eclipse.rap.rwt.engine.RWTServletContextListener.contextInitialized(RWTServletContextListener.java:50)
        at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1872)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)


My web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
  version="2.4">

  <context-param>
    <param-name>org.eclipse.rap.applicationConfiguration</param-name>
    <param-value>uk.co.iet.rapide.tabris.Configuration</param-value>
  </context-param>

  <listener>
    <listener-class>org.eclipse.rap.rwt.engine.RWTServletContextListener</listener-class>
  </listener>

  <servlet>
    <servlet-name>rwtServlet</servlet-name>
    <servlet-class>org.eclipse.rap.rwt.engine.RWTServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>rwtServlet</servlet-name>
    <url-pattern>/test</url-pattern>
  </servlet-mapping>
</web-app> 


My WAR contains a bunch of jars in the WEB-INF/lib directory:

index.php/fa/17850/0/

What is the 'ContextDirectory' parameter? I cannot find any information on this anywhere. How do I specify it, and where?

Perhaps it is a red-herring and there is another underlying problem?

The list of JARs in the WAR is probably way too much anyway - this is the same list that I deploy when a create a WAR for OSGi (which works ok by the way), so I suspect there are lots of JARs in there which are not necessary - and perhaps MUST NOT be included?

Guidance appreciated, as ever!
Thanks, John
Re: RWT Standalone WAR to WebLogic contextDirectory null [message #1279152 is a reply to message #1278566] Fri, 28 March 2014 05:55 Go to previous messageGo to next message
Eclipse UserFriend
Any thoughts on this one?

Here's a bit more from the trace:

<28-Mar-2014 09:48:03 o'clock GMT> <Warning> <HTTP> <BEA-101162> <User defined listener org.eclipse.rap.rwt.engine.RWTServletContextListener failed: java.lang.NullPointerException: The parameter 'cont
extDirectory' must not be null..
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:27)
        at org.eclipse.rap.rwt.internal.application.ApplicationContextImpl.doActivate(ApplicationContextImpl.java:329)
        at org.eclipse.rap.rwt.internal.application.ApplicationContextImpl.activate(ApplicationContextImpl.java:205)
        at org.eclipse.rap.rwt.application.ApplicationRunner.start(ApplicationRunner.java:82)
Re: RWT Standalone WAR to WebLogic contextDirectory null [message #1281217 is a reply to message #1279152] Mon, 31 March 2014 10:41 Go to previous messageGo to next message
Eclipse UserFriend
Amazingly, this same WAR under WebSphere (the one I expected to be the biggest problem of all AppServers) works perfectly, so the contextDirectory issue only occurs under WebLogic. I'm thinking there is some sort of bug in RWT/RWP relating to this...?

JBoss gets a totally different error relating to xerces xml parsers, but I suspect this is a classloader sequence issue.

Why oh why can't AppServers be consistent in their behaviour!!! argh

Perhaps if someone on the RAP team can comment on the contextDirectory question, this could be useful in progressing WebLogic...?

Thanks, John
Re: RWT Standalone WAR to WebLogic contextDirectory null [message #1281224 is a reply to message #1281217] Mon, 31 March 2014 10:54 Go to previous messageGo to next message
Eclipse UserFriend
Hi John,
the context directory is obtained from servletContext.getRealPath() (see
ApplicationContextImpl#getContextDirectory()). Obviously, the servlet
container is unable to translate the given /virtual/ path ("/") to a
/real/ path and return null. To workaround the issue try to specify the
context directory path manually by setting "resource_root_location"
attribute of the servlet context.
HTH,
Ivan

--
Ivan Furnadjiev

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RWT Standalone WAR to WebLogic contextDirectory null [message #1281748 is a reply to message #1281224] Tue, 01 April 2014 05:47 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Ivan, makes sense in principle, but how and where is this specified?
The error is being thrown on deployment, not on startup of a session, so I guess it needs to be set in the EntryPoint (Configuration) somehow?

This code doesn't work in the EntryPoint because there is no session/request at that stage:
	        ServletContext srvContext;
	        srvContext = RWT.getRequest().getServletContext();
	        srvContext.setAttribute(ApplicationConfiguration.RESOURCE_ROOT_LOCATION, "/");


Sorry if this is basic servlet programming, but I'm not coming from that background, so not sure how it is done!
Thanks, John

[Updated on: Tue, 01 April 2014 05:52] by Moderator

Re: RWT Standalone WAR to WebLogic contextDirectory null [message #1282491 is a reply to message #1281748] Wed, 02 April 2014 07:30 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jonh,
I thought that the ApplicationConfiguration.RESOURCE_ROOT_LOCATION is a
context parameter and could be specified in web.xml, but it is
attribute. Could you please open a bugzilla about this issue ( null
context directory) and we will try to investigate it.
Thanks,
Ivan

--
Ivan Furnadjiev

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RWT Standalone WAR to WebLogic contextDirectory null [message #1283308 is a reply to message #1282491] Thu, 03 April 2014 05:15 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Ivan.
Here is the BugZilla link: https://bugs.eclipse.org/bugs/show_bug.cgi?id=431883
Re: RWT Standalone WAR to WebLogic contextDirectory null [message #1283723 is a reply to message #1278566] Thu, 03 April 2014 15:06 Go to previous messageGo to next message
Eclipse UserFriend
This is a known strange behavior of Weblogic.

By default getRealPath() will return null if you don't use the exploded install mode.

You can find the solution to your problem here: http://my-java-planet.blogspot.fr/2011/11/how-to-fix-weblogic-servletcontextgetre.html


Regards,
-Seb
Re: RWT Standalone WAR to WebLogic contextDirectory null [message #1284271 is a reply to message #1283723] Fri, 04 April 2014 05:31 Go to previous message
Eclipse UserFriend
Thanks Sebastien...
The WebLogic server-level option doesn't seem to exist anymore (11 and 12 Oracle), and the one that looked similar had no effect, but putting the weblogic.xml into the application WAR file did work ok, so all happy... for reference, here is the complete content of the weblogic.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
<container-descriptor>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>
</weblogic-web-app>

All good - thanks for pointing me at that blog!
Cheers, John
Previous Topic:RWT Standalone - WEB.XML help
Next Topic:How to configure Apache as Reverse Proxy for RAP Application
Goto Forum:
  


Current Time: Thu Jul 24 23:15:30 EDT 2025

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

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

Back to the top