<div dir="ltr"><div>Jeff,</div><div><br></div><div>Thanks for looking into this issue. All the help we receive on Mondrian is greatly appreciated, especially when it comes to supporting different environments.</div><div><br>

</div><div>Your understanding of the DefaultRules-&gt;Version scheme is right.</div><div><br></div>Your fix would definitely be useful. We can&#39;t merge this fix directly as we are nearly done with our next release, but we&#39;d gladly accept a pull request on GitHub. Could you also create a Jira case in our bug tracker to track this? By referring to your pull request, the team will be able to quickly review and integrate your change.<div>

<br></div><div>Before we accept it though, let&#39;s make sure that this is the right way to access resources. This might break other things in other environments. I&#39;m thinking in places where people create plugin frameworks and override the default behavior of their class loader(s). The JVM docs state that:</div>

<div><br></div><div><span style="color:rgb(0,0,0);font-family:Arial,&#39;Liberation Sans&#39;,&#39;DejaVu Sans&#39;,sans-serif;font-size:14px;line-height:18px;background-color:rgb(238,238,238)">This method delegates the call to its class loader, after making these changes to the resource name: if the resource name starts with &quot;/&quot;, it is unchanged; otherwise, the package name is prepended to the resource name after converting &quot;.&quot; to &quot;/&quot;. If this object was loaded by the bootstrap loader, the call is delegated to ClassLoader.getSystemResource.</span></div>

<div><font color="#000000" face="Arial, Liberation Sans, DejaVu Sans, sans-serif"><span style="font-size:14px;line-height:18px"><br></span></font></div><div><font color="#000000" face="Arial, Liberation Sans, DejaVu Sans, sans-serif"><span style="font-size:14px;line-height:18px">How exactly is this helping in the case before us? If Glassfish merges all the paths, wouldn&#39;t we be at square one? Why does it fix the problem for you then? Food for thought... I just want to make sure that we understand this change before making it.<br>

</span></font><div><br></div><div>Thanks a bunch </div><div><br></div><div>Luc</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 19, 2013 at 1:17 PM, Jeff Rosen <span dir="ltr">&lt;<a href="mailto:jeffrey.leigh.rosen@gmail.com" target="_blank">jeffrey.leigh.rosen@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Luc,<div><br></div><div>I have debugged the issue and you&#39;re close - in this case it is finding a VERSION.txt, but the wrong one.  What is happening on glassfish is that VERSION.txt is getting picked up from the JSP classpath.  I don&#39;t understand why VERSION.txt is showing up there - intuitively, one would only expect that classpath entry to contain generated JSP classes.  Whatever the reason, it is there and the difference is that on Windows that location contains the VERSION.txt from mondrian.jar, but on centos it contains the one from olap4j.jar which has a different format, i.e. a single line: &quot;olap4j 1.0.1.539&quot;.  I guess there is a race condition that makes which specific file end up there indeterminate.</div>


<div><br></div><div>After understanding the problem, the code that had seemed a little &quot;odd&quot; in MondrianServerRegistry.loadVersionFile that looks for DefaultRules.xml and then changes the filename to VERSION.txt suddenly made sense - it is there to ensure that VERSION.txt is picked up from the correct jar when multiple jars have VERSION.txt in the root.  Unfortunately, this trick breaks down in the glassfish case because DefaultRules.xml also appears in the generated jsp classpath location.</div>


<div><br></div><div>I propose that a better solution to ensure that the proper VERSION.txt is always located is to store it in the mondrian.server package and then use Class.getResource() to locate it rather than ClassLoader.getResource().  I have made local modifications to do just that and tested it on Windows and Centos with Glassfish and it works.  I just copy VERSION.txt to the root and mondrian.server during the build and then modified the loadFileVersion to match.  I&#39;m happy to submit the change if you think it would be useful.</div>

<span class="HOEnZb"><font color="#888888">
<div><br></div><div>--Jeff</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 19, 2013 at 8:30 AM, Luc Boudreau <span dir="ltr">&lt;<a href="mailto:lucboudreau@gmail.com" target="_blank">lucboudreau@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Jeff,<div><br></div><div>This exception usually happens when the version file cannot be found in the classpath. Let&#39;s do a quick sanity check. What are the files at the root of that Mondrian JAR?</div>




</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Fri, Aug 16, 2013 at 8:05 PM, Jeff Rosen <span dir="ltr">&lt;<a href="mailto:jeffrey.leigh.rosen@gmail.com" target="_blank">jeffrey.leigh.rosen@gmail.com</a>&gt;</span> wrote:<br>




</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><br></div><div>I have a very strange problem that I&#39;ve been battling and I can&#39;t seem to</div>




<div>figure out.  Any help would be greatly appreciated.</div><div><br></div><div>I am trying to deploy Mondrian 3.5 in glassfish 3.1 on a hosted server running</div>
<div>centos 6.  I have successfully deployed the same mondrian.war in the same</div><div>version of glassfish running on a Windows workstation.  It seems that whenever</div><div>mondrian attempts to initialize on centos, I get an NPE at line 85 of</div>





<div>MondrianServerRegistry.  </div><div><br></div><div>I have created a simple test that simply calls</div><div>MondrianServerRegistry.INSTANCE.getOrLoadVersion();  It executes successfully</div><div>on the centos environment and returns the following information from</div>





<div>MondrianVersion:</div><div><br></div><div>VersionString: 3.50</div><div>Product: mondrian</div><div>MajorVersion: 3</div><div>MinorVersion: 0</div><div><br></div><div>I have looked at the code for MondrianServerRegistry and it would seem that</div>





<div>&quot;versionString&quot; is null.  Looking at loadVersionFile(), I don&#39;t see how that is</div><div>possible. I guess I can setup to try and remotely debug (over the internet,</div><div>yuk!), but while I&#39;m doing that, has anyone seen anything like this or have</div>





<div>any idea what might cause something like this?</div><div><br></div><div>java.lang.NullPointerException</div><div><span style="white-space:pre-wrap">        </span>at mondrian.server.MondrianServerRegistry.getOrLoadVersion(MondrianServerRegistry.java:85)</div>





<div><span style="white-space:pre-wrap">        </span>at mondrian.olap.MondrianServer.getVersion(MondrianServer.java:107)</div><div><span style="white-space:pre-wrap">        </span>at mondrian.rolap.RolapSchema.checkSchemaVersion(RolapSchema.java:448)</div>





<div><span style="white-space:pre-wrap">        </span>at mondrian.rolap.RolapSchema.load(RolapSchema.java:408)</div><div><span style="white-space:pre-wrap">        </span>at mondrian.rolap.RolapSchema.(RolapSchema.java:216)</div>
<div><span style="white-space:pre-wrap">        </span>at mondrian.rolap.RolapSchemaPool.get(RolapSchemaPool.java:214)</div><div><span style="white-space:pre-wrap">        </span>at mondrian.rolap.RolapSchemaPool.get(RolapSchemaPool.java:66)</div>





<div><span style="white-space:pre-wrap">        </span>at mondrian.rolap.RolapConnection.(RolapConnection.java:160)</div><div><span style="white-space:pre-wrap">        </span>at mondrian.rolap.RolapConnection.(RolapConnection.java:90)</div>





<div><span style="white-space:pre-wrap">        </span>at mondrian.olap.DriverManager.getConnection(DriverManager.java:112)</div><div><span style="white-space:pre-wrap">        </span>at com.tonbeller.jpivot.mondrian.MondrianModel.initialize(MondrianModel.java:518)</div>





<div><span style="white-space:pre-wrap">        </span>at com.tonbeller.jpivot.olap.model.OlapModelDecorator.initialize(OlapModelDecorator.java:132)</div><div><span style="white-space:pre-wrap">        </span>at com.tonbeller.jpivot.tags.OlapModelProxy$MyState.initialize(OlapModelProxy.java:77)</div>





<div><span style="white-space:pre-wrap">        </span>at com.tonbeller.jpivot.tags.StackStateManager.initializeAndShow(StackStateManager.java:76)</div><div><span style="white-space:pre-wrap">        </span>at com.tonbeller.jpivot.tags.OlapModelProxy.initializeAndShow(OlapModelProxy.java:160)</div>





<div><span style="white-space:pre-wrap">        </span>at com.tonbeller.jpivot.tags.OlapModelTag.doEndTag(OlapModelTag.java:81)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.jsp.WEB_002dINF.queries.mondrian_jsp._jspx_meth_jp_mondrianQuery_0(mondrian_jsp.java from :114)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.jsp.WEB_002dINF.queries.mondrian_jsp._jspService(mondrian_jsp.java from :62)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)</div>





<div><span style="white-space:pre-wrap">        </span>at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)</div>





<div><span style="white-space:pre-wrap">        </span>at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:809)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:626)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:556)</div>





<div><span style="white-space:pre-wrap">        </span>at com.tonbeller.wcf.utils.IncludeTag.doStartTag(IncludeTag.java:59)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.jsp.testpage_jsp._jspx_meth_wcf_include_0(testpage_jsp.java from :263)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.jsp.testpage_jsp._jspService(testpage_jsp.java from :123)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)</div>





<div><span style="white-space:pre-wrap">        </span>at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)</div>





<div><span style="white-space:pre-wrap">        </span>at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)</div>





<div><span style="white-space:pre-wrap">        </span>at com.tonbeller.wcf.controller.RequestFilter$MyHandler.normalRequest(RequestFilter.java:139)</div><div><span style="white-space:pre-wrap">        </span>at com.tonbeller.wcf.controller.RequestFilter.doFilter(RequestFilter.java:264)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)</div><div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)</div>





<div><span style="white-space:pre-wrap">        </span>at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)</div><div><span style="white-space:pre-wrap">        </span>at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)</div>





<div><span style="white-space:pre-wrap">        </span>at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)</div><div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)</div>





<div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)</div><div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)</div>





<div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)</div><div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)</div>





<div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)</div><div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)</div>





<div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)</div><div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)</div>





<div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)</div><div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.ContextTask.run(ContextTask.java:71)</div>





<div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)</div><div><span style="white-space:pre-wrap">        </span>at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)</div>





<div><span style="white-space:pre-wrap">        </span>at java.lang.Thread.run(Thread.java:662)</div><div><br></div><div>Thanks!</div><span><font color="#888888"><div><br></div><div>--Jeff</div><div><br></div></font></span></div>





<br></div></div>_______________________________________________<br>
Mondrian mailing list<br>
<a href="mailto:Mondrian@pentaho.org" target="_blank">Mondrian@pentaho.org</a><br>
<a href="http://lists.pentaho.org/mailman/listinfo/mondrian" target="_blank">http://lists.pentaho.org/mailman/listinfo/mondrian</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>