Eclipse Process Framework - Search with published war file

Markus Eisele
The new EPF Composer 1.5 is out since some time. The publishing process now got an option to publish sites for processes as .war files.
This is quite a big step forward. Before this, you had to publish html pages and copy them to your target webserver.
EPF build in is a lucene search. If you stick to tomcat you never will run into any problems with this construct. If you try to use the Oracle Weblogic to deploy your process.war file, you get into trouble.

The root of all evil is the spec. The org.eclipse.epf.web.servlet.SearchServlet uses
ServletConfig.getServletContext().getRealPath(index) to determine the lucene index location. If you look at the Servlet Specification you read this:

The real path returned will be in a form appropriate to the computer and
operating system on which the servlet container is running, including the
proper path separators. This method returns null if the servlet container
cannot translate the virtual path to a real path for any reason (such as
when the content is being made available from a .war archive).

Tomcat for example returns the path of the actual exploded deployment. Weblogic simply returns null here.

LD> _indexPath: null
LD> _currentSearchString: test
LD> unicodes: test
LD> analyzerName: null
LD> _hits: null
at org.eclipse.epf.web.servlet.SearchServlet.runQuery(
at org.eclipse.epf.web.servlet.SearchServlet.runSearch(SearchServlet.jav
at org.eclipse.epf.web.servlet.SearchServlet.doGet(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at weblogic.servlet.internal.StubSecurityHelper$
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
at Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC

Ok. What to do to get this working on Oracle Weblogic Server? You have different options.
1) you can simply deploy the process.war exploded. No NullPointerException, everything works fine. If this is no option for you, you need to digg deeper
2) you can change the org.eclipse.epf.web.servlet.SearchServlet a bit to refer to absolute paths. Look at lines 64/65 and change them to:

_indexPath = config.getInitParameter("searchIndex");
_xslURL = config.getInitParameter("xslFile");

This means, you have to move the index directory out of the war to a separate location on your disc. After this you should also change the web.xml:

This mean, you always have to distribute the search index as a separate directory. I Should mention here, that I realy did not try this out at all. You may come across some more issues with the after this.

3) you can do some heavier modifications on the codebase. Its an option to change the lucene directory driver. A good beginning for further research on this could be this thread in the lucene java-users mailinglist. I will possibly get the change to a more deeper look at the 3rd way in the future ...

Post a Comment


Post a Comment (0)