Archive for the ‘long tweets’ Category
(long tweet) How to get the average of a Date column in MySQL?
Case
You have a column of type Date in MySQL. How to get the average value of this series?
(Don’t think to execute select AVG(myColumnDate)
, it won’t work!)
Fix
Use a query similar to this:
SELECT FROM_UNIXTIME( ROUND( AVG( UNIX_TIMESTAMP( myDateColumn ) ) ) ) FROM `myTable` WHERE 1
(long tweet) Undeploy issue with Tomcat on Windows
Case
I had the following issue: when I undeployed the WAR from Tomcat using the manager instance, the undeploy failed. As a workaround, I had to restart Tomcat for the undeploy to be taken in account.
This issue occured only in Windows ; when the exact same WAR and the same version of Tomcar on Debian, I was able to deploy and undeploy many times.
Quick Fix
In the %CATALINA_HOME%\conf\context.xml
, replace:
<Context>
with:
<Context antijarlocking="true" antiResourceLocking="true"/>
(long tweet) How to use comments in JSF 2?
If you write comments in an XHTML file (used by JSF2) as regular XML comments (ie starting with <!--
and ending with -->
), you may probably find them in the HTML source generated “by” JSF. To prevent that, add the following bloxk in your web.xml
:
<context-param> <param-name>facelets.SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param>
(long tweet) Jetty / Unified Expression Language / NoSuchMethodError: javax.el.ELResolver.invoke
Case
On deploying a JSF project on Jetty (via Maven plugin), when I display the XHtml page I get an error, which starts with:
java.lang.NoSuchMethodError: javax.el.ELResolver.invoke(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object; at com.sun.el.parser.AstValue.getValue(AstValue.java:111) at com.sun.el.parser.AstValue.getValue(AstValue.java:163) at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionIm
Quick fix
I fixed the issue by removing the dependencies to Unified Expression Language (EL API), either direct or induced:
<dependency> <groupId>org.glassfish.web</groupId> <artifactId>el-impl</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.sun.el</groupId> <artifactId>el-ri</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>javax.el</groupId> <artifactId>el-api</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>com.sun.el</groupId> <artifactId>el-ri</artifactId> <version>1.0</version> </dependency>
Actually, some JARs that had to be depended on have been included within Tomcat and Jetty, that’s why some conflict of JARs happen to be. What prevented me to fix quickly the issue was that Tomcat and Jetty seem not to embed the same version on EL
(long tweet) Failure to find javax.transaction:jta:jar:1.0.1B
Case
Getting and building a project got on the internet, I got the following stractrace:
[ERROR] Failed to execute goal on project skillsPoC: Could not resolve dependencies for project lalou.jonathan.poc:skillsPoC:war:1.0-SNAPSHOT: Failure to find javax.transaction:jta:jar:1.0.1B in http://192.168.0.39:8081/nexus/content/repositories/central/ was cached in the local repository, resolution will not be reattempted until the update interval of localRepository has elapsed or updates are forced -> [Help 1] [ERROR]
Actually, the needed JAR (javax.transaction:jta:jar:1.0.1B
) is depended on by Spring 2.5.
Quick fix
- Add the following repository in your
pom.xml
:<repository> <id>java.net.m2</id> <name>java.net m2 repo</name> <url>http://download.java.net/maven/2</url> </repository>
- Unlike what I could read on Padova’s JUG blog, you need not get and install manually the jar any longer.
- Possibly, you may have to disable the block related to the
<mirrors>
in yoursettings.xml
.