You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Fabien R <th...@free.fr> on 2016/08/01 11:08:23 UTC
jsp handling between catalina.sh and eclipse
Hello,
I'm encountering a very strange problem when running my webapp (servlet
2.5).
If I use eclipse (run as -> run on server) to deploy the app and start
tomee plus 1.7.4, the jsp page is displayed with the data from postgreSQL.
If I use catalina.sh, the jsp page is displayed without any data.
Both configurations are similar in each server.xml:
<!-- eclipse.sh conf -->
<Host name="myHost" appBase="wtpwebapps"
unpackWARs="false" autoDeploy="false" deployOnStartup="false" >
<Alias>myHost.com</Alias>
<!-- deploy myapp.war by copying the file into mpapps -->
<Context docBase="myapp" path="" reloadable="false" />
</Host>
<!-- catalina.sh conf -->
<Host name="myHost" appBase="mpapps"
unpackWARs="false" autoDeploy="false" deployOnStartup="false" >
<Alias>myHost.com</Alias>
<!-- deploy myapp.war by copying the file into mpapps -->
<Context docBase="myapp" path="" reloadable="false" />
</Host>
The debug info on both configuration are similar. I see on record for
LATEST_PROPOSAL_LIST and POPULAR_PROPOSAL_LIST:
DEBUG [http-apr-8443-exec-1] (AbstractView.java:206) - Rendering view
with name 'latestProjectsView with
model={{LATEST_PROPOSAL_LIST=[com.myapp.tier.business.Proposal@6211a266],
POPULAR_PROPOSAL_LIST=[com.myapp.tier.business.Proposal@73bd08d6],
latestProjectsData=com.myapp.tier.web.LatestProjectData@7f8f54f6}} and
static attributes={{}}
The last debug info I see in my framework is:
DEBUG [http-apr-8443-exec-1] (InternalResourceView.java:95) - Showing
debug information, and including JSP with url '/jsp/index.jsp' in
InternalResourceView with name 'latestProjectsView'
And the next instructions are:
request.getRequestDispatcher("/jsp/index.jsp").include(request, response);
request.getRequestDispatcher("/jsp/debug/trace.jsp").include(request,
response);
I had no servlet entry for jsp in my web.xml but adding this one did not
change anything:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>development</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
The model data are displayed with:
<c:forEach var="pro" items="${LATEST_PROPOSAL_LIST}">
<tbody>
<tr>
<td>${pro.title}</td>
</tr>
</tbody>
</c:forEach>
How can I check if this instruction is executed when using catalina.sh ?
Are there differences in the libs used to handle JSP between eclipse and
the script ?
May it be due to security settings ?
I'm a bit lost.
--
Fabien
Re: jsp handling between catalina.sh and eclipse
Posted by Romain Manni-Bucau <rm...@gmail.com>.
The opposite logging would have been explained by eclipse breaking tomee
classloading and somehow excluding openwebbeans-* and openejb-core from the
OWB startup but in this order it looks like the tomee instance got
corrupted somehow.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-08-22 12:15 GMT+02:00 Fabien R <th...@free.fr>:
> On 21/08/16 16:04, Romain Manni-Bucau wrote:
>
>> can you do a quick test:
>>
>> - add any webapp needing CDI and ensure it is deployed before your
>> application
>>
> Good catch !
> Now, just for my information, what explains the difference during the
> starting:
>
> With eclipse:
>
> INFO: Existing thread singleton service in SystemInstance():
> org.apache.openejb.cdi.ThreadSingletonServiceImpl@74239156
> Aug 22, 2016 11:27:37 AM org.apache.openejb.cdi.OpenEJBLifecycle
> startApplication
> INFO: OpenWebBeans Container is starting...
> Aug 22, 2016 11:27:37 AM org.apache.webbeans.plugins.PluginLoader startUp
> INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
> Aug 22, 2016 11:27:37 AM org.apache.webbeans.plugins.PluginLoader startUp
> INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
> Aug 22, 2016 11:27:38 AM org.apache.webbeans.config.BeansDeployer
> validateInjectionPoints
> INFO: All injection points were validated successfully.
> Aug 22, 2016 11:27:38 AM org.apache.openejb.cdi.OpenEJBLifecycle
> startApplication
> INFO: OpenWebBeans Container has started, it took 328 ms.
> Aug 22, 2016 11:27:38 AM org.apache.openejb.assembler.classic.Assembler
> createApplication
>
> Without eclipse;
>
> INFO: Existing thread singleton service in SystemInstance():
> org.apache.openejb.cdi.ThreadSingletonServiceImpl@5c36a328
> Aug 22, 2016 12:00:32 PM org.apache.openejb.cdi.OpenEJBLifecycle
> startApplication
> INFO: OpenWebBeans Container is starting...
> Aug 22, 2016 12:00:32 PM org.apache.openejb.cdi.OpenEJBLifecycle
> startApplication
> INFO: OpenWebBeans Container has started, it took 710 ms.
> Aug 22, 2016 12:00:32 PM org.apache.openejb.assembler.classic.Assembler
> createApplication
>
> --
> Fabien
>
Re: jsp handling between catalina.sh and eclipse
Posted by Fabien R <th...@free.fr>.
On 21/08/16 16:04, Romain Manni-Bucau wrote:
> can you do a quick test:
>
> - add any webapp needing CDI and ensure it is deployed before your
> application
Good catch !
Now, just for my information, what explains the difference during the
starting:
With eclipse:
INFO: Existing thread singleton service in SystemInstance():
org.apache.openejb.cdi.ThreadSingletonServiceImpl@74239156
Aug 22, 2016 11:27:37 AM org.apache.openejb.cdi.OpenEJBLifecycle
startApplication
INFO: OpenWebBeans Container is starting...
Aug 22, 2016 11:27:37 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Aug 22, 2016 11:27:37 AM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Aug 22, 2016 11:27:38 AM org.apache.webbeans.config.BeansDeployer
validateInjectionPoints
INFO: All injection points were validated successfully.
Aug 22, 2016 11:27:38 AM org.apache.openejb.cdi.OpenEJBLifecycle
startApplication
INFO: OpenWebBeans Container has started, it took 328 ms.
Aug 22, 2016 11:27:38 AM org.apache.openejb.assembler.classic.Assembler
createApplication
Without eclipse;
INFO: Existing thread singleton service in SystemInstance():
org.apache.openejb.cdi.ThreadSingletonServiceImpl@5c36a328
Aug 22, 2016 12:00:32 PM org.apache.openejb.cdi.OpenEJBLifecycle
startApplication
INFO: OpenWebBeans Container is starting...
Aug 22, 2016 12:00:32 PM org.apache.openejb.cdi.OpenEJBLifecycle
startApplication
INFO: OpenWebBeans Container has started, it took 710 ms.
Aug 22, 2016 12:00:32 PM org.apache.openejb.assembler.classic.Assembler
createApplication
--
Fabien
Re: jsp handling between catalina.sh and eclipse
Posted by Romain Manni-Bucau <rm...@gmail.com>.
can you do a quick test:
- add any webapp needing CDI and ensure it is deployed before your
application
Guess is it can be linked to
https://issues.apache.org/jira/browse/TOMEE-1909 which means that if the
JspFactory is set before your deployment the application works. This test
should be pretty close to your app:
https://github.com/apache/tomee/blob/9d9d4cade7128ef14c545c19c7d806efadb3b298/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/jspcdi/JspCdiTest.java
https://github.com/apache/tomee/blob/9d9d4cade7128ef14c545c19c7d806efadb3b298/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/jspcdi/TheBean.java#L29
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-08-21 12:53 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
> Le 21 août 2016 11:54, "Fabien R" <th...@free.fr> a écrit :
> >
> > On 19/08/16 19:22, Romain Manni-Bucau wrote:
> >>
> >> I would recommand you to build a sample on github with
> tomee-maven-plugin.
> >> Would help switching libs and sharing tests easily.
> >
> > Yeah, I know. But I don't - need to - use maven. I'll dig into it when I
> have time...
> >
>
> Well mentionned it caue this kind of issue is solved in 2 days with that
> and your thread is 1 month old now so think it is a good investment ;)
>
> > Anyway, I tracked down the problem: the java code generated for my jsp
> is different on both environments.
> >
>
> Is it the case as well without jsvc and a plain standalone tomee?
>
> > The jsp test file:
> >
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
> > <jsp:directive.page contentType="text/html; charset=UTF-8"
> > pageEncoding="UTF-8" session="false" isELIgnored="false"
> >
> > />
> > <jsp:output doctype-root-element="html"
> > doctype-system="html"
> > omit-xml-declaration="true" />
> > <html xmlns:c="http://java.sun.com/jsp/jstl/core"
> > >
> > <head>
> > <title>test</title>
> > <meta name="viewport" content="width=device-width,
> initial-scale=1.0" />
> > <meta http-equiv="Content-Style-Type" content="text/html;
> charset=UTF-8" />
> > </head>
> > <body >
> > test = ${2 * 4 + 3 * 4}
> > <c:forEach var="pro" items="${POPULAR_PROPOSAL_LIST}">
> > <jsp:text>${pro.title}</jsp:text>
> > </c:forEach>
> > </body>
> > </html>
> > </jsp:root>
> >
> > The c:forEach is translated as a procedure on eclipse:
> > /*
> > * Generated by the Jasper component of Apache Tomcat
> > * Version: Apache Tomcat (TomEE)/7.0.62 (1.7.2)
> > * Generated at: 2016-08-21 08:58:51 UTC
> > * Note: The last modified time of this file was set to
> > * the last modified time of the source file after
> > * generation to assist with modification tracking.
> > */
> > package org.apache.jsp.jsp;
> >
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> > import javax.servlet.jsp.*;
> >
> > public final class index_jsp extends org.apache.jasper.runtime.
> HttpJspBase
> > implements org.apache.jasper.runtime.JspSourceDependent {
> >
> > private static final javax.servlet.jsp.JspFactory _jspxFactory =
> > javax.servlet.jsp.JspFactory.getDefaultFactory();
> >
> > private static java.util.Map<java.lang.String,java.lang.Long>
> _jspx_dependants;
> >
> > private org.apache.jasper.runtime.TagHandlerPool
> _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems;
> >
> > ...
> >
> > if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context))
> > return;
> >
> > But not with catalina started by jsvc.exe:
> >
> > /*
> > * Generated by the Jasper component of Apache Tomcat
> > * Version: Apache Tomcat (TomEE)/7.0.62 (1.7.2)
> > * Generated at: 2016-08-21 09:13:02 UTC
> > * Note: The last modified time of this file was set to
> > * the last modified time of the source file after
> > * generation to assist with modification tracking.
> > */
> > package org.apache.jsp.jsp;
> >
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> > import javax.servlet.jsp.*;
> >
> > public final class index_jsp extends org.apache.jasper.runtime.
> HttpJspBase
> > implements org.apache.jasper.runtime.JspSourceDependent {
> >
> > private static final javax.servlet.jsp.JspFactory _jspxFactory =
> > javax.servlet.jsp.JspFactory.getDefaultFactory();
> >
> > private static java.util.Map<java.lang.String,java.lang.Long>
> _jspx_dependants;
> >
> > private javax.el.ExpressionFactory _el_expressionfactory;
> > private org.apache.tomcat.InstanceManager _jsp_instancemanager;
> >
> > ...
> >
> > out.write("<c:forEach items=\"" + (java.lang.String)
> org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${POPULAR_PROPOSAL_LIST}",
> java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context,
> null, true) + "\" var=\"pro\">");
> > out.write((java.lang.String) org.apache.jasper.runtime.
> PageContextImpl.proprietaryEvaluate("${pro.title}",
> java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context,
> null, false));
> > out.write("</c:forEach>");
> >
> > Of course, I thought about forcing the compilation to JDT by changing
> the jsp servlet in the app web.xml:
> >
> >
> > <servlet>
> > <servlet-name>jsp</servlet-name>
> >
> > <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
> > <init-param>
> > <param-name>compiler</param-name>
> >
> > <param-value>org.apache.jasper.compiler.JDTCompiler</param-value>
> > </init-param>
> > <init-param>
> > <param-name>keepgenerated</param-name>
> > <param-value>true</param-value>
> > </init-param>
> > <init-param>
> > <param-name>scratchdir</param-name>
> > <param-value>/tmp</param-value>
> > </init-param>
> > <init-param>
> > <param-name>quoteAttributeEL</param-name>
> > <param-value>false</param-value>
> > </init-param>
> > <init-param>
> > <param-name>modificationTestInterval</param-name>
> > <param-value>5</param-value>
> > </init-param>
> > <init-param>
> > <param-name>compilerSourceVM</param-name>
> > <param-value>1.7</param-value>
> > </init-param>
> > <init-param>
> > <param-name>compilerTargetVM</param-name>
> > <param-value>1.7</param-value>
> > </init-param>
> > <init-param>
> > <param-name>fork</param-name>
> > <param-value>false</param-value>
> > </init-param>
> > <init-param>
> > <param-name>xpoweredBy</param-name>
> > <param-value>false</param-value>
> > </init-param>
> >
> > <init-param>
> > <param-name>development</param-name>
> > <param-value>true</param-value>
> > </init-param>
> > <load-on-startup>3</load-on-startup>
> > </servlet>
> >
> > But without success. The EL is active but the c:forEach is handled
> differently.
> >
> > Any hints ?
> >
> > --
> > Fabien
> >
> > Note: without eclipse, tomEE is started by this command from an init.d
> script:
> > jsvc.exec -java-home /usr/lib/jvm/java-7-openjdk-amd64 -user fabien
> -pidfile /media/travail/apache-tomee-plus-1.7.2/logs/catalina-daemon.pid
> -wait 10 -outfile /media/travail/apache-tomee-plus-1.7.2/logs/catalina-daemon.out
> -errfile &1 -classpath /media/travail/apache-tomee-
> plus-1.7.2/bin/bootstrap.jar:/media/travail/apache-tomee-
> plus-1.7.2/bin/commons-daemon.jar:/media/travail/apache-
> tomee-plus-1.7.2/bin/tomcat-juli.jar -Djava.util.logging.config.
> file=/media/travail/apache-tomee-plus-1.7.2/conf/logging.properties
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> -Djava.endorsed.dirs= -Dcatalina.base=/media/
> travail/apache-tomee-plus-1.7.2 -Dcatalina.home=/media/
> travail/apache-tomee-plus-1.7.2 -Djava.io.tmpdir=/media/
> travail/apache-tomee-plus-1.7.2/temp -Djava.library.path=/usr/local/lib
> org.apache.catalina.startup.Bootstrap
>
Re: jsp handling between catalina.sh and eclipse
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 21 août 2016 11:54, "Fabien R" <th...@free.fr> a écrit :
>
> On 19/08/16 19:22, Romain Manni-Bucau wrote:
>>
>> I would recommand you to build a sample on github with
tomee-maven-plugin.
>> Would help switching libs and sharing tests easily.
>
> Yeah, I know. But I don't - need to - use maven. I'll dig into it when I
have time...
>
Well mentionned it caue this kind of issue is solved in 2 days with that
and your thread is 1 month old now so think it is a good investment ;)
> Anyway, I tracked down the problem: the java code generated for my jsp is
different on both environments.
>
Is it the case as well without jsvc and a plain standalone tomee?
> The jsp test file:
>
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
> <jsp:directive.page contentType="text/html; charset=UTF-8"
> pageEncoding="UTF-8" session="false" isELIgnored="false"
>
> />
> <jsp:output doctype-root-element="html"
> doctype-system="html"
> omit-xml-declaration="true" />
> <html xmlns:c="http://java.sun.com/jsp/jstl/core"
> >
> <head>
> <title>test</title>
> <meta name="viewport" content="width=device-width,
initial-scale=1.0" />
> <meta http-equiv="Content-Style-Type" content="text/html;
charset=UTF-8" />
> </head>
> <body >
> test = ${2 * 4 + 3 * 4}
> <c:forEach var="pro" items="${POPULAR_PROPOSAL_LIST}">
> <jsp:text>${pro.title}</jsp:text>
> </c:forEach>
> </body>
> </html>
> </jsp:root>
>
> The c:forEach is translated as a procedure on eclipse:
> /*
> * Generated by the Jasper component of Apache Tomcat
> * Version: Apache Tomcat (TomEE)/7.0.62 (1.7.2)
> * Generated at: 2016-08-21 08:58:51 UTC
> * Note: The last modified time of this file was set to
> * the last modified time of the source file after
> * generation to assist with modification tracking.
> */
> package org.apache.jsp.jsp;
>
> import javax.servlet.*;
> import javax.servlet.http.*;
> import javax.servlet.jsp.*;
>
> public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
> implements org.apache.jasper.runtime.JspSourceDependent {
>
> private static final javax.servlet.jsp.JspFactory _jspxFactory =
> javax.servlet.jsp.JspFactory.getDefaultFactory();
>
> private static java.util.Map<java.lang.String,java.lang.Long>
_jspx_dependants;
>
> private org.apache.jasper.runtime.TagHandlerPool
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems;
>
> ...
>
> if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context))
> return;
>
> But not with catalina started by jsvc.exe:
>
> /*
> * Generated by the Jasper component of Apache Tomcat
> * Version: Apache Tomcat (TomEE)/7.0.62 (1.7.2)
> * Generated at: 2016-08-21 09:13:02 UTC
> * Note: The last modified time of this file was set to
> * the last modified time of the source file after
> * generation to assist with modification tracking.
> */
> package org.apache.jsp.jsp;
>
> import javax.servlet.*;
> import javax.servlet.http.*;
> import javax.servlet.jsp.*;
>
> public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
> implements org.apache.jasper.runtime.JspSourceDependent {
>
> private static final javax.servlet.jsp.JspFactory _jspxFactory =
> javax.servlet.jsp.JspFactory.getDefaultFactory();
>
> private static java.util.Map<java.lang.String,java.lang.Long>
_jspx_dependants;
>
> private javax.el.ExpressionFactory _el_expressionfactory;
> private org.apache.tomcat.InstanceManager _jsp_instancemanager;
>
> ...
>
> out.write("<c:forEach items=\"" + (java.lang.String)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${POPULAR_PROPOSAL_LIST}",
java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context,
null, true) + "\" var=\"pro\">");
> out.write((java.lang.String)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pro.title}",
java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context,
null, false));
> out.write("</c:forEach>");
>
> Of course, I thought about forcing the compilation to JDT by changing the
jsp servlet in the app web.xml:
>
>
> <servlet>
> <servlet-name>jsp</servlet-name>
>
> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
> <init-param>
> <param-name>compiler</param-name>
>
> <param-value>org.apache.jasper.compiler.JDTCompiler</param-value>
> </init-param>
> <init-param>
> <param-name>keepgenerated</param-name>
> <param-value>true</param-value>
> </init-param>
> <init-param>
> <param-name>scratchdir</param-name>
> <param-value>/tmp</param-value>
> </init-param>
> <init-param>
> <param-name>quoteAttributeEL</param-name>
> <param-value>false</param-value>
> </init-param>
> <init-param>
> <param-name>modificationTestInterval</param-name>
> <param-value>5</param-value>
> </init-param>
> <init-param>
> <param-name>compilerSourceVM</param-name>
> <param-value>1.7</param-value>
> </init-param>
> <init-param>
> <param-name>compilerTargetVM</param-name>
> <param-value>1.7</param-value>
> </init-param>
> <init-param>
> <param-name>fork</param-name>
> <param-value>false</param-value>
> </init-param>
> <init-param>
> <param-name>xpoweredBy</param-name>
> <param-value>false</param-value>
> </init-param>
>
> <init-param>
> <param-name>development</param-name>
> <param-value>true</param-value>
> </init-param>
> <load-on-startup>3</load-on-startup>
> </servlet>
>
> But without success. The EL is active but the c:forEach is handled
differently.
>
> Any hints ?
>
> --
> Fabien
>
> Note: without eclipse, tomEE is started by this command from an init.d
script:
> jsvc.exec -java-home /usr/lib/jvm/java-7-openjdk-amd64 -user fabien
-pidfile /media/travail/apache-tomee-plus-1.7.2/logs/catalina-daemon.pid
-wait 10 -outfile
/media/travail/apache-tomee-plus-1.7.2/logs/catalina-daemon.out -errfile &1
-classpath
/media/travail/apache-tomee-plus-1.7.2/bin/bootstrap.jar:/media/travail/apache-tomee-plus-1.7.2/bin/commons-daemon.jar:/media/travail/apache-tomee-plus-1.7.2/bin/tomcat-juli.jar
-Djava.util.logging.config.file=/media/travail/apache-tomee-plus-1.7.2/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=
-Dcatalina.base=/media/travail/apache-tomee-plus-1.7.2
-Dcatalina.home=/media/travail/apache-tomee-plus-1.7.2
-Djava.io.tmpdir=/media/travail/apache-tomee-plus-1.7.2/temp
-Djava.library.path=/usr/local/lib org.apache.catalina.startup.Bootstrap
Re: jsp handling between catalina.sh and eclipse
Posted by Fabien R <th...@free.fr>.
On 19/08/16 19:22, Romain Manni-Bucau wrote:
> I would recommand you to build a sample on github with tomee-maven-plugin.
> Would help switching libs and sharing tests easily.
Yeah, I know. But I don't - need to - use maven. I'll dig into it when I
have time...
Anyway, I tracked down the problem: the java code generated for my jsp
is different on both environments.
The jsp test file:
<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:directive.page contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" session="false" isELIgnored="false"
/>
<jsp:output doctype-root-element="html"
doctype-system="html"
omit-xml-declaration="true" />
<html xmlns:c="http://java.sun.com/jsp/jstl/core"
>
<head>
<title>test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Style-Type" content="text/html; charset=UTF-8" />
</head>
<body >
test = ${2 * 4 + 3 * 4}
<c:forEach var="pro" items="${POPULAR_PROPOSAL_LIST}">
<jsp:text>${pro.title}</jsp:text>
</c:forEach>
</body>
</html>
</jsp:root>
The c:forEach is translated as a procedure on eclipse:
/*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat (TomEE)/7.0.62 (1.7.2)
* Generated at: 2016-08-21 08:58:51 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long>
_jspx_dependants;
private org.apache.jasper.runtime.TagHandlerPool
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems;
...
if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context))
return;
But not with catalina started by jsvc.exe:
/*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat (TomEE)/7.0.62 (1.7.2)
* Generated at: 2016-08-21 09:13:02 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long>
_jspx_dependants;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
...
out.write("<c:forEach items=\"" + (java.lang.String)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${POPULAR_PROPOSAL_LIST}",
java.lang.String.class,
(javax.servlet.jsp.PageContext)_jspx_page_context, null, true) + "\"
var=\"pro\">");
out.write((java.lang.String)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pro.title}",
java.lang.String.class,
(javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</c:forEach>");
Of course, I thought about forcing the compilation to JDT by changing
the jsp servlet in the app web.xml:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>compiler</param-name>
<param-value>org.apache.jasper.compiler.JDTCompiler</param-value>
</init-param>
<init-param>
<param-name>keepgenerated</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>scratchdir</param-name>
<param-value>/tmp</param-value>
</init-param>
<init-param>
<param-name>quoteAttributeEL</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>modificationTestInterval</param-name>
<param-value>5</param-value>
</init-param>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.7</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.7</param-value>
</init-param>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>development</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
But without success. The EL is active but the c:forEach is handled
differently.
Any hints ?
--
Fabien
Note: without eclipse, tomEE is started by this command from an init.d
script:
jsvc.exec -java-home /usr/lib/jvm/java-7-openjdk-amd64 -user fabien
-pidfile /media/travail/apache-tomee-plus-1.7.2/logs/catalina-daemon.pid
-wait 10 -outfile
/media/travail/apache-tomee-plus-1.7.2/logs/catalina-daemon.out -errfile
&1 -classpath
/media/travail/apache-tomee-plus-1.7.2/bin/bootstrap.jar:/media/travail/apache-tomee-plus-1.7.2/bin/commons-daemon.jar:/media/travail/apache-tomee-plus-1.7.2/bin/tomcat-juli.jar
-Djava.util.logging.config.file=/media/travail/apache-tomee-plus-1.7.2/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=
-Dcatalina.base=/media/travail/apache-tomee-plus-1.7.2
-Dcatalina.home=/media/travail/apache-tomee-plus-1.7.2
-Djava.io.tmpdir=/media/travail/apache-tomee-plus-1.7.2/temp
-Djava.library.path=/usr/local/lib org.apache.catalina.startup.Bootstrap
Re: jsp handling between catalina.sh and eclipse
Posted by Romain Manni-Bucau <rm...@gmail.com>.
I would recommand you to build a sample on github with tomee-maven-plugin.
Would help switching libs and sharing tests easily.
Le 19 août 2016 19:18, "Fabien R" <th...@free.fr> a écrit :
> On 03/08/16 15:40, Romain Manni-Bucau wrote:
>
>> weird, looks like it is the default even on the 7.x branch. can be due to
>> another part of the setting or a change in tomcat we embedded in 1.7.4
>>
>> It's worse than I thought. I did not realize that it only worked when
> deploying with eclipse.
> It never worked when deploying manually (generation of a war from eclipse
> + drop into the relevant directory).
> I will investigate to see if there are differences between jsp, jstl or
> whatever.
>
> --
> Fabien
>
Re: jsp handling between catalina.sh and eclipse
Posted by Fabien R <th...@free.fr>.
On 03/08/16 15:40, Romain Manni-Bucau wrote:
> weird, looks like it is the default even on the 7.x branch. can be due to
> another part of the setting or a change in tomcat we embedded in 1.7.4
>
It's worse than I thought. I did not realize that it only worked when
deploying with eclipse.
It never worked when deploying manually (generation of a war from
eclipse + drop into the relevant directory).
I will investigate to see if there are differences between jsp, jstl or
whatever.
--
Fabien
Re: jsp handling between catalina.sh and eclipse
Posted by Romain Manni-Bucau <rm...@gmail.com>.
weird, looks like it is the default even on the 7.x branch. can be due to
another part of the setting or a change in tomcat we embedded in 1.7.4
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-08-03 15:29 GMT+02:00 Fabien R <th...@free.fr>:
> On 01/08/16 17:20, Romain Manni-Bucau wrote:
>
>>
>> In any case a testcase reproducing it will be the fastest way to get
>> relevant support here or on tomcat bugtracker.
>>
> Sorry, I don't have testcase for JSP.
> I noticed the following problem with the JSP engine.
> If I use the following template, EL is disabled:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
> <jsp:directive.page contentType="text/html; charset=UTF-8"
> pageEncoding="UTF-8" session="false"
> />
> <jsp:output doctype-root-element="html"
> doctype-system="html"
> omit-xml-declaration="true" />
> <html xmlns:c="http://java.sun.com/jsp/jstl/core">
> <head>
> ...
>
> I have to explicitely set isELIgnored="false" for the script or eclipse.
> Anyway, for now, I stick to 1.7.2.
>
> --
> Fabien
>
Re: jsp handling between catalina.sh and eclipse
Posted by Fabien R <th...@free.fr>.
On 01/08/16 17:20, Romain Manni-Bucau wrote:
>
> In any case a testcase reproducing it will be the fastest way to get
> relevant support here or on tomcat bugtracker.
Sorry, I don't have testcase for JSP.
I noticed the following problem with the JSP engine.
If I use the following template, EL is disabled:
<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:directive.page contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" session="false"
/>
<jsp:output doctype-root-element="html"
doctype-system="html"
omit-xml-declaration="true" />
<html xmlns:c="http://java.sun.com/jsp/jstl/core">
<head>
...
I have to explicitely set isELIgnored="false" for the script or eclipse.
Anyway, for now, I stick to 1.7.2.
--
Fabien
Re: jsp handling between catalina.sh and eclipse
Posted by Romain Manni-Bucau <rm...@gmail.com>.
If there is really a change it can be a tomcat one so a test can be to
reproduce it on a plain tomcat and compare versions 7.0.62 and 7.0.68.
In any case a testcase reproducing it will be the fastest way to get
relevant support here or on tomcat bugtracker.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-08-01 15:15 GMT+02:00 Fabien R <th...@free.fr>:
> On 01/08/16 13:41, Romain Manni-Bucau wrote:
>
>> Hi Fabien
>>
>> You can surely debug your business logic code or foreach tag impl.
>>
>> Also ensure you deploy with the same context name maybe.
>>
>> Strange,
> I reverted to 1.7.2 with the same conf files and everything is OK.
>
> --
> Fabien
>
Re: jsp handling between catalina.sh and eclipse
Posted by Fabien R <th...@free.fr>.
On 01/08/16 13:41, Romain Manni-Bucau wrote:
> Hi Fabien
>
> You can surely debug your business logic code or foreach tag impl.
>
> Also ensure you deploy with the same context name maybe.
>
Strange,
I reverted to 1.7.2 with the same conf files and everything is OK.
--
Fabien
Re: jsp handling between catalina.sh and eclipse
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Fabien
You can surely debug your business logic code or foreach tag impl.
Also ensure you deploy with the same context name maybe.
Le 1 août 2016 13:08, "Fabien R" <th...@free.fr> a écrit :
> Hello,
>
> I'm encountering a very strange problem when running my webapp (servlet
> 2.5).
> If I use eclipse (run as -> run on server) to deploy the app and start
> tomee plus 1.7.4, the jsp page is displayed with the data from postgreSQL.
> If I use catalina.sh, the jsp page is displayed without any data.
>
> Both configurations are similar in each server.xml:
> <!-- eclipse.sh conf -->
> <Host name="myHost" appBase="wtpwebapps"
> unpackWARs="false" autoDeploy="false" deployOnStartup="false" >
> <Alias>myHost.com</Alias>
> <!-- deploy myapp.war by copying the file into mpapps -->
> <Context docBase="myapp" path="" reloadable="false" />
> </Host>
> <!-- catalina.sh conf -->
> <Host name="myHost" appBase="mpapps"
> unpackWARs="false" autoDeploy="false" deployOnStartup="false" >
> <Alias>myHost.com</Alias>
> <!-- deploy myapp.war by copying the file into mpapps -->
> <Context docBase="myapp" path="" reloadable="false" />
> </Host>
>
>
> The debug info on both configuration are similar. I see on record for
> LATEST_PROPOSAL_LIST and POPULAR_PROPOSAL_LIST:
> DEBUG [http-apr-8443-exec-1] (AbstractView.java:206) - Rendering view with
> name 'latestProjectsView with
> model={{LATEST_PROPOSAL_LIST=[com.myapp.tier.business.Proposal@6211a266],
> POPULAR_PROPOSAL_LIST=[com.myapp.tier.business.Proposal@73bd08d6],
> latestProjectsData=com.myapp.tier.web.LatestProjectData@7f8f54f6}} and
> static attributes={{}}
>
> The last debug info I see in my framework is:
> DEBUG [http-apr-8443-exec-1] (InternalResourceView.java:95) - Showing
> debug information, and including JSP with url '/jsp/index.jsp' in
> InternalResourceView with name 'latestProjectsView'
>
> And the next instructions are:
> request.getRequestDispatcher("/jsp/index.jsp").include(request, response);
> request.getRequestDispatcher("/jsp/debug/trace.jsp").include(request,
> response);
>
> I had no servlet entry for jsp in my web.xml but adding this one did not
> change anything:
> <servlet>
> <servlet-name>jsp</servlet-name>
> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
> <init-param>
> <param-name>development</param-name>
> <param-value>true</param-value>
> </init-param>
> <load-on-startup>3</load-on-startup>
> </servlet>
>
> The model data are displayed with:
> <c:forEach var="pro" items="${LATEST_PROPOSAL_LIST}">
> <tbody>
> <tr>
> <td>${pro.title}</td>
> </tr>
> </tbody>
> </c:forEach>
>
> How can I check if this instruction is executed when using catalina.sh ?
> Are there differences in the libs used to handle JSP between eclipse and
> the script ?
> May it be due to security settings ?
>
> I'm a bit lost.
> --
> Fabien
>