title: Liferay jboss : Handle 500 exception
body: <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>JBWEB000069: description JBWEB000145: The server encountered an internal error that prevented it from fulfilling this request.
  
  JBWEB000070: exception
  
  java.io.FileNotFoundException: /jboss/jboss-eap-6.1/standalone/tmp/work/jboss.web/default-host/empAppMgmt-portlet/aggregate/https_/empAppMgmt-portlet/js/empAppMgmt.jsbrowserId=firefox&amp;minifierType=js&amp;languageId=en_US&amp;b=6210&amp;t=1424361709000&amp;fakeParam=%24{76428%2b66104%2b%27f60cec015d33e6f70fc90789dd6659ff6b83da4d49f58d1fb7d1f0ae210ff7a8de500d534018c03aa77a440178e47b9e9dc66b53afa119163810502c2d1946f2%27}_E_CONTENT_TYPE (File name too long)
   java.io.FileOutputStream.open(Native Method)
   java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:221)
   com.liferay.portal.util.FileImpl.write(FileImpl.java:949)
   com.liferay.portal.util.FileImpl.write(FileImpl.java:927)
   com.liferay.portal.util.FileImpl.write(FileImpl.java:922)
   com.liferay.portal.kernel.util.FileUtil.write(FileUtil.java:425)
   com.liferay.portal.servlet.filters.aggregate.AggregateFilter.getContent(AggregateFilter.java:408)
   com.liferay.portal.servlet.filters.aggregate.AggregateFilter.processFilter(AggregateFilter.java:508)
   com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:74)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   java.lang.reflect.Method.invoke(Method.java:606)
   com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
   com.sun.proxy.$Proxy1748.doFilter(Unknown Source)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
   com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
   com.liferay.portal.servlet.filters.language.LanguageFilter.processFilter(LanguageFilter.java:84)
   com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:74)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   java.lang.reflect.Method.invoke(Method.java:606)
   com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
   com.sun.proxy.$Proxy1748.doFilter(Unknown Source)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
   com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
   com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
   com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:74)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   java.lang.reflect.Method.invoke(Method.java:606)
   com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
   com.sun.proxy.$Proxy1748.doFilter(Unknown Source)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
   com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
   com.liferay.portal.servlet.filters.cache.CacheFilter.processFilter(CacheFilter.java:421)
   com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:74)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   java.lang.reflect.Method.invoke(Method.java:606)
   com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
   com.sun.proxy.$Proxy1748.doFilter(Unknown Source)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
   com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
   com.liferay.portal.servlet.filters.etag.ETagFilter.processFilter(ETagFilter.java:86)
   com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:74)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   java.lang.reflect.Method.invoke(Method.java:606)
   com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
   com.sun.proxy.$Proxy1748.doFilter(Unknown Source)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
   com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
   com.liferay.portal.servlet.filters.header.HeaderFilter.processFilter(HeaderFilter.java:154)
   com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:74)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   java.lang.reflect.Method.invoke(Method.java:606)
   com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
   com.sun.proxy.$Proxy1748.doFilter(Unknown Source)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
   com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:74)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
  
  JBWEB000072: note JBWEB000073: The full stack trace of the root cause is available in the JBoss Web/7.2.2.Final-redhat-1 logs.</code></pre>
  </div>
  </div>
  </p>
  
  <p>Enviorment: </p>
  
  <p>liferay 6.2 </p>
  
  <p>App server: jboss</p>
  
  <p>I am trying to display the custom error message whenever the 500 exception i.e internal server error occurs.
  Below are setting available in web.xml</p>
  
  <pre><code>&lt;error-page&gt;
          &lt;error-code&gt;404&lt;/error-code&gt;
          &lt;location&gt;/errors/code.jsp&lt;/location&gt;
      &lt;/error-page&gt;
      &lt;error-page&gt;
          &lt;error-code&gt;500&lt;/error-code&gt;
          &lt;location&gt;/errors/code.jsp&lt;/location&gt;
      &lt;/error-page&gt; 
  </code></pre>
  
  <p>Also i changed the code.jsp and added the custom code. Just simple text error message. But it is not calling the code.jsp instead complete stack trace is getting printed on browser.
  The url i am hitting is:</p>
  
  <pre><code>https://localhost/xyzportlet/js/xyz.js?browserId=firefox&amp;minifierType=js&amp;languageId=en_US&amp;b=6210&amp;t=1424361709000&amp;fakeParam=%24{76428%2b66104%2b%27f60cec015d33e6f70fc90789dd6659ff6b83da4d49f58d1fb7d1f0ae210ff7a8de500d534018c03aa77a440178e47b9e9dc66b53afa119163810502c2d1946f2%27}
  </code></pre>
  
  <p>And the error message i am getting is:</p>
  
  <pre><code>JBWEB000065: HTTP Status 500 - /jboss/jboss-eap-6.1/standalone/tmp/work/jboss.web/default-host/xyz-portlet/aggregate/https_/xyz-portlet/js/xyz.jsbrowserId=firefox&amp;minifierType=js&amp;languageId=en_US&amp;b=6210&amp;t=1424361709000&amp;fakeParam=%24{76428%2b66104%2b%27f60cec015d33e6f70fc90789dd6659ff6b83da4d49f58d1fb7d1f0ae210ff7a8de500d534018c03aa77a440178e47b9e9dc66b53afa119163810502c2d1946f2%27}_E_CONTENT_TYPE (File name too long)
  </code></pre>
  
  <p>Also instead of calling js if i call other jsp,css or other , it gives resource not found error instead of 500.</p>
  
  <p>Anyone let me know what i am missing to handle 500 exceptions</p>