Enterprise grade Java.
You'll read about Conferences, Java User Groups, Java, Integration, Reactive, Microservices and other technologies.

Tuesday, January 27, 2009

Eclipse Process Framework - Search with published war file

09:54 Tuesday, January 27, 2009 Posted by 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(SearchServlet.java
at org.eclipse.epf.web.servlet.SearchServlet.runSearch(SearchServlet.jav
at org.eclipse.epf.web.servlet.SearchServlet.doGet(SearchServlet.java:12
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:821)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
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 weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

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 org.eclipse.epf.web.search.IndexSearch 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 ...