1 Reply Latest reply: Jun 25, 2014 9:12 AM by e6ee476b-0da4-4e71-b0cc-18221d41534c RSS

    Web application runs fine on Tomcat fails on Weblogic

    e6ee476b-0da4-4e71-b0cc-18221d41534c

      Hi

      We are currently running all of our webapps on Tomcat Servers. Recently we were requested to migrate them to weblogic servers and we are facing issues while running the app on weblogic.

      It seems that the tiles are not being read by the weblogic server and the required data is not being read for display in JSP.

      We are  using Weblogic 10.3 , Maven apache-maven-3.0.3 .

       

      Problem:

      In the following code snippet  HttpServletRequest request is not able to render the tiles definition .

       

      StringResponseWrapper wrappedResponse = new StringResponseWrapper(response);

      TilesContainer container = TilesAccess.getContainer(request.getSession().getServletContext());

      container.render(tileDefinition, request,wrappedResponse.getResponse());

      String result = wrappedResponse.toString();

       

      The result is coming as empty string because Tiles Container is not able to render the tileDefinition.


      Error in weblogic while the code is executed using local weblogic server:

      java.lang.IllegalStateException: strict servlet API: cannot call getWriter() after getOutputStream()

      at com.gm.gmds.exceptions.ExceptionHandler.execute(ExceptionHandler.java:36)

      at sun.reflect.GeneratedMethodAccessor362.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:597)

      at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)

      at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)

      at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)

      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)

      at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)

      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)

      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

      at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)

      at com.opensymphony.xwork2.ActionChainResult.execute(ActionChainResult.java:222)

      at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)

      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)

      at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)

      at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)

      at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)

      at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

      at com.gm.gmds.filters.UTF8EncodingFilter.doFilter(UTF8EncodingFilter.java:38)

      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)

      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)

      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)

      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)

      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)

      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)

      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)

      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)

      at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)



      Any help you can provide us to debug the above issue is much appreciated.


      Additional information:

      In the web.xml we reference the filter :

      <filter>

        <filter-name>Set Character Encoding</filter-name>

              <filter-class>com.gm.gmds.filters.UTF8EncodingFilter</filter-class>

          </filter>

       

          <!-- Define filter mappings for the defined filters -->

          <filter-mapping>

              <filter-name>Set Character Encoding</filter-name>

              <url-pattern>/*</url-pattern>

          </filter-mapping>

       

      Code Snippet for :

       

      public class UTF8EncodingFilter implements javax.servlet.Filter

      {

         public void init( FilterConfig filterConfig )  throws ServletException

         {

            // This would be a good place to collect a parameterized

            // default encoding type.  For brevity, we're going to

            // use a hard-coded value in this example.

         }

         public void doFilter( ServletRequest request,

      ServletResponse response,

      FilterChain filterChain )

      throws IOException, ServletException

         {

            // Wrap the response object.  You should create a mechanism

            // to ensure the response object only gets wrapped once.

            // In this example, the response object will inappropriately

            // get wrapped multiple times during a forward.

            response = new UTF8EncodingServletResponse( (HttpServletResponse) response );

      request.setCharacterEncoding( "UTF-8" );

       

      filterChain.doFilter( request, response );

         }

         public void destroy()

         {

            // no-op

         }



      In Tomcat the result string contains the following data:

      \r\n\r\n\t\r\n \t<div id=\"Summaryabc\" class=\"Summaryabc\">\r\n \t\t\r\n\r\n<div id=\"Descriptionabc\" class=\"Descriptionabc\">\r\n\t<span id=\"YearDisplay\" class=\"YearDisplay\">\r\n\t\t\r\n\t<\/span>\r\n \t<span id=\"LineDisplay\" class=\"LineDisplay\">\r\n \t\t\r\n \t<\/span>\r\n \t<span id=\"Displayxyz\" class=\"Displayxyz\">\r\n \t\t\r\n \t<\/span>\r\n \t<span id=\"Displayijk\" class=\"Displayijk\">\r\n \t\t\r\n \t<\/span>\r\n \t<span id=\"Displayaaa\" class=\"Displayaaa\">\r\n \t\t\r\n \t<\/span>\r\n \t<span id=\"Displaybbb\" class=\"Displaybbb\">\r\n \t\t\r\n \t<\/span>\r\n<\/div>\r\n\r\n \t<\/div>\t\r\n   <div class=\"Selectorabc\">\r\n   \t<div id=\"Criteriayyy\" class=\"Criteriayyy\">\r\n   \t\t\r\n   \t<\/div>\r\n\t<\/div>\r\n\t<div id=\"Containerabc\" class=\"Containerabc\">\r\n\t\t\r\n\t<\/div>\r\n\r\n"

      regards

      Padmaja