Category Archives: IT Stuff

Dynamic Web Module 3.0 requires Java 1.6 or newer

I’m using STS and I configured my Web application to use Maven but, when I try to use Maven > Update project configuration, I’m getting this really annoying project error:

Dynamic Web Module 3.0 requires Java 1.6 or newer. [...] Maven WTP Configuration Problem
One or more constraints have not been satisfied.

STS/Eclipse are configured to use Java 1.6 but my project apparently isn’t. So I go change that, but it doesn’t fix that error, and any time I update project config with Maven, it’s back to using JRE 1.5 and my Java source files are no longer on the build path as source files. This because the Maven compiler plugin doesn’t use Eclipse settings and just imposes its own defaults, i.e. Java 5, unless otherwise configured by a POM. And since a “Dynamic Web Project” uses Servlet 3.0 it requires Java 6.

To fix, just add under the top-level POM:

<build>
	<plugins>
	   <plugin>
		  <groupId>org.apache.maven.plugins</groupId>
		  <artifactId>maven-compiler-plugin</artifactId>
		  <version>2.1</version>
		  <configuration>
			 <source>1.6</source>
			 <target>1.6</target>
		  </configuration>
	   </plugin>
	</plugins>
 </build>
Tagged ,

Ubuntu md5 hash of a string

Just use md5sum with no options:

echo 'String' | md5sum
Tagged

Apt-get: Cannot initiate the connection to 8080:80

To fix this issue, open the apt.conf configuration file:

vi /etc/apt/apt.conf

Add this row or check it if already exists:

Acquire::http::proxy “http://proxy.localdomain:8080/”;
Tagged

Change Eclipse settings to ignore jquery errors on a specific file

In my dynamic web project in eclipse, I have jQuery in my js source folder. For some reason, Eclipse is not handling it correctly and interpreting many lines as errors in the standard jQuery file (even though I have the javascript development tools installed).

I have found that I can leave the JavaScript Validator enable and ignore specific files by adding a suitable exclusion pattern e.g. **/jquery*.js to the JavaScript/Include Path/Source/Excluded group (Project->Properties->JavaScript->Include Path->Source).

Tagged , ,

Resolving java.lang.OutOfMemoryError: PermGen

Today our Alfresco doesn’t start due to this error:

java.lang.OutOfMemoryError: PermGen

The PermGen (permanent generation) holds data needed by the virtual machine to describe objects that do not have an equivalence at the Java language level like objects describing classes and methodse. So often large, complex apps will need lots of PermGen space. Similarly if you are doing frequent war/ear/jar deployments to running servers like Tomcat or JBoss you may need to issue a server restart after a few deploys or increase your PermGen space.

To increase the PermGen space use something like:

-XX:MaxPermSize=128m

The default is 64MB.

Note that Xmx is separate from the PermGen space, so increasing Xmx will not help with the PermGen errors (PermGen memory is in addition to the Xmx memory)

Java has other settings that could help control how much memory it uses:

-Xmx sets the maximum memory heap size
-Xms sets the minimum memory heap size.

Tagged ,

MacOS X – Remove an agent from launchd

launchd is a daemon/agent manager and to remove a service from it, use the following syntax with the launchctl command:

launchctl remove name

It’s possible to get a list of daemon/agent with:

launchctl list

Usually the daemon/agent configuration files are in: /Users/andrea.girardi/Library/LaunchAgents

Tagged

Oracle admin on Ubuntu server

To be able to admin Oracle instance from sqlplus command line on Ubuntu server, for first you need to set the enviroment variables:

source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh

At this point, is possible to login as sysdba using:

sqlplus / as sysdba

if you get insufficient privileges error, you need to add your user to dba group:

usermod [username] -G oracle, dba

a this point is possible to startup and shutdown the Oracle instance on sqlplus prompt using:

SHUTDOWNN IMMEDIATE;
Tagged ,

Oracle 11gR2 Express Edition on Linux Ubuntu 11.10 howto

To install Orace 11gR2 Express Edition, please take a look to this tutorial (tutorial? THE TUTORIAL!)

https://forums.oracle.com/forums/thread.jspa?threadID=2301639

Tagged ,

Quit from psql command-line utility

To quit from Postgres psql command-line utility use:

health_coach=# \q

and press enter

Tagged

Show post categories using Webscript

To show all categories of a post, check if the cm:categories child association exists and, if yes, list all childs into the ftl file:

<#if node.properties["cm:categories"]?exists>
	<categories>
		<#list node.properties["cm:categories"] as prop>${prop.name}</#list>
	</categories>
</#if>
Tagged