Saturday 11 December 2010

cleaning frequency of /tmp and /var/tmp

/tmp normally gets cleared after every reboot on ubuntu which is a bit quick for me. For example I sometimes want to save a screenshot and maybe quickly edit it and e-mail it, but I don't want to loose it if my system reboots for whatever reason (including forgetting that I was busy with something).
It turns out that you can set how long to keep stuff in /tmp by setting TMPTIME in /etc/default/rcS to the number of days to keep stuff (I'm going for 7days now).
http://linuxers.org/article/differences-between-tmp-and-vartmp

Apparently you normally should put temp stuff you want to keep a bit longer in /var/tmp [1] but that does not seem to get cleared out regularly.
So I made a weekly cronjob to clean out stuff older than 60 days:/etc/cron.weekly/clean_var_tmp.sh
#!/bin/bash
days=60
tmpdir=/var/tmp/
find -P ${tmpdir} -type f -mtime +$days        -exec su amanica -c "notify-send 'weekly clean ${tmpdir}' 'rm {}'" \; -exec rm {} \;
find -P ${tmpdir} -type d -mtime +$days -empty -exec su amanica -c "notify-send 'weekly clean ${tmpdir}' 'rm {}'" \; -exec rm -r {} \;

http://ubuntu-virginia.ubuntuforums.org/showthread.php?t=1524077

[1] http://www.pathname.com/fhs/2.2/fhs-5.15.html

Wednesday 27 October 2010

@Entity(name != table_name !!!

Normally if you get "org.hibernate.hql.ast.QuerySyntaxException: is not mapped" then you used the table name in stead of the class name. In my case I'm ashamed to admit, 
I though setting @Entity(name is setting the table name,
where in fact it is setting the JPQL alias! 
I thought it was weird that you can set that and the @Table(name . 


@Entity(name != table_name !!!
@Entity(name != table_name !!!
@Entity(name != table_name !!!
@Entity(name != table_name !!!
@Entity(name != table_name !!!
@Entity(name != table_name !!!
@Entity(name != table_name !!!
@Entity(name != table_name !!!
@Entity(name != table_name !!!
@Entity(name != table_name !!!


Thanks Matt Raible for showing me the light:

If you specify a name value for your @Entity annotation (for example
@Entity(name="person")), this will be the alias for HQL queries. If you
don't specify this value, the name will match the short name of your class (
Person). If you want to change the table name that's generated, use the
@Table
with a "name" value.

Tuesday 19 October 2010

IncompatibleClassChangeError: Implementing class

In my case this was caused by incompatible versions of hibernate in the classpath...


2010-10-19 12:40:32,271:ERROR   Problem encountered during View.servePage       - com.icesoft.faces.context.View
java.lang.IncompatibleClassChangeError: Implementing class
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:983)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1501)
        at za.co.enerweb.nampower.report.hibernate.HibernateSessionFactory.(HibernateSessionFactory.java:60)

Wednesday 13 October 2010

Overheating laptop

A couple of weeks ago I could reliably get my laptop to overheat by just running the bazaar unit tests.

By googling I found that it could help to clean out the fan,
so I opened it a bit but gave up because I didn't have time to open it up completely.

Recently it got much worse, I could not even open eclipse without having a household fan directed at my laptop.

I decided today is the day. I had to remove about 30 screws and the processing unit heat sinks to get at them little radiators. They were a bit filthy of coarse, but its all cleaned now. I had to file off 1mm of a 3mm flat screwdriver bit so that I can unscrew about 11 2mm hexagonal screws.. . One screw got lost somewhere, I hope its not stuck somewhere where it can cause problems - that must be what doctors think if they are missing something after performing surgery.

It seems much better now, the fan doesn't even come on so often any more.

Tuesday 12 October 2010

inconsistent datatypes with JPA.. eish

I've been having some weird errors with JPA eg.
(pasted here so you can find it with google)
==
INFO - batching 1 statements: 1: insert into dds.DDS_EMAIL_STATUS (DOC_REGISTER_ID, EMAIL_ADDRESS_FROM,
EMAIL_ADDRESS_TO, LAST_UPDATE_TIME, MESSAGE_ID, SEND_DATETIME, STATUS_ID, SUBJECT, DDS_EMAIL_STATUS_ID)
values (1001, 'dds-test@example.com', 'test@example.com', to_date('10/12/2010 12:41:05', 'mm/dd/yyyy
hh24:mi:ss'), NULL, to_date('10/12/2010 12:41:05', 'mm/dd/yyyy hh24:mi:ss'), 0, 'testSend',
800)  {executed in 4 msec}
INFO - executeBatch()
ERROR - 2. PreparedStatement.executeBatch() batching 2 statements:
1:  insert into dds.DDS_EMAIL_STATUS_LOG (DATE_TIME, DDS_EMAIL_STATUS_ID, MESSAGE, DDS_EMAIL_STATUS_LOG_ID) values (to_date('10/12/2010 12:41:05', 'mm/dd/yyyy hh24:mi:ss'), '', 'html body:
html body', 750)
java.sql.BatchUpdateException: ORA-00932: inconsistent datatypes: expected NUMBER got BINARY
    at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
    at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10720)
    at net.sf.log4jdbc.StatementSpy.executeBatch(StatementSpy.java:523)
    at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
    at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
    at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
    at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:304)
    at org.apache.openejb.persistence.JtaEntityManager.flush(JtaEntityManager.java:130)
==
java.sql.SQLException: incompatible data types in combination in statement [alter table DDS_EMAIL_STATUS_LOG add constraint FKB7F2A8E6BAAD6FBB foreign key (DDS_EMAIL_STATUS_ID) references DDS_EMAIL_STATUS]
 at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
 at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
 at org.hsqldb.jdbc.JDBCStatement.executeUpdate(Unknown Source)
 at net.sf.log4jdbc.StatementSpy.executeUpdate(StatementSpy.java:694)
 at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
 at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
 at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:383)
 at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:341)
 at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:262)
 at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:211)
 at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:343)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
 at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
 at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
...
Caused by: org.hsqldb.HsqlException: incompatible data types in combination
 at org.hsqldb.error.Error.error(Unknown Source)
 at org.hsqldb.error.Error.error(Unknown Source)
 at org.hsqldb.Table.checkColumnsMatch(Unknown Source)
 at org.hsqldb.TableWorks.checkCreateForeignKey(Unknown Source)
 at org.hsqldb.TableWorks.addForeignKey(Unknown Source)
 at org.hsqldb.ParserDDL.processAlterTableAddForeignKeyConstraint(Unknown Source)
 at org.hsqldb.ParserDDL.processAlterTable(Unknown Source)
 at org.hsqldb.ParserDDL.processAlter(Unknown Source)
 at org.hsqldb.StatementSchema.getResult(Unknown Source)
 at org.hsqldb.StatementSchema.execute(Unknown Source)
 at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
 at org.hsqldb.Session.executeDirectStatement(Unknown Source)
 at org.hsqldb.Session.execute(Unknown Source)
==
javax.persistence.PersistenceException: org.hibernate.type.SerializationException: could not deserialize
    at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
    at org.hibernate.ejb.AbstractEntityManagerImpl.remove(AbstractEntityManagerImpl.java:259)
    at org.apache.openejb.persistence.JtaEntityManager.remove(JtaEntityManager.java:107)
==
1:  update DDS_EMAIL_STATUS_LOG set DATE_TIME='10/12/2010 13:11:54.206', DDS_EMAIL_STATUS_ID='', MESSAGE='text body:
text body' where DDS_EMAIL_STATUS_LOG_ID=1 {FAILED after 0 msec}
java.sql.BatchUpdateException: data exception: string data, right truncation
 at org.hsqldb.jdbc.JDBCPreparedStatement.executeBatch(Unknown Source)
 at net.sf.log4jdbc.StatementSpy.executeBatch(StatementSpy.java:523)
 at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
 at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
 at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
 at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
==
I tried different databases because it looked to me like the hsqldb is getting a bit confused with the column order. But in the end it turned out that I made a bit of a mistake:
I converted an embedded complex primary key to have a generated Id. In stead of annotating the referenced object with a @ManyToOne(optional = false)
it was still using @Column(name = "DDS_EMAIL_STATUS_ID"). After much debugging, googling and figuring out how to print the actual sql using http://code.google.com/p/log4jdbc-remix/ I figured out that I neglegted to change @Column to @ManyToOne.

Why is nothing ever easy ;-P

Saturday 2 October 2010

eclipse + tomcat + maven pain again

Banging my head against the wall again today
because my app just does not want to start up :'(
Between eclipse, tomcat and maven my classpath was messed up, getting all sorts of exceptions like NoClassDefFoundError etc.

Finally I figured out again that for each project involved you have to check "Maven Dependencies"
in the "Order and Export" tab of the Java build path settings.
Then when you tell tomcat to include these projects,
it will actually include it and its dependencies.

I'm not sure how this got lost because my app used to work. Maybe when I imported the same project in
another workspace that got reset :(

Tuesday 7 September 2010

cannot execute binary file

I had this really weird issue on Ubuntu:
* An executable works fine on my laptop.
* Then I scp it to the server.
* On the server I get the following error messsage: "cannot execute binary file"
* So after some googling I found:
You are probably trying to run a 64-bit [executable] on a 32-bit Linux system...
http://www.kods.net/transferred-to-install-oracle-9i-in-linux-the-whole-document/

Go figure. I've been so spoiled with java and python, that I forget there are still things you need to compile for the platform you want to run it on...

Monday 23 August 2010

Archiva gives the maven site plugin an invalid site_en.xml

I got the following nasty error since friday:

$ mvn -U -e -X clean site
...
[DEBUG] Reading site descriptor from /home/amanica/.m2/repository/za/co/my_company/super-pom/1.0.3/super-pom-1.0.3-site_en.xml
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] SiteToolException: Error parsing site descriptor

Expected root element 'project' but found 'html' (position: START_TAG seen ... Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r\n<html>... @8:7)
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: SiteToolException: Error parsing site descriptor
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: SiteToolException: Error parsing site descriptor
at org.apache.maven.plugins.site.AbstractSiteRenderingMojo.createSiteRenderingContext(AbstractSiteRenderingMojo.java:232)
at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:137)
at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:120)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: org.apache.maven.doxia.tools.SiteToolException: Error parsing site descriptor
at org.apache.maven.doxia.tools.DefaultSiteTool.readDecorationModel(DefaultSiteTool.java:1298)
at org.apache.maven.doxia.tools.DefaultSiteTool.getDecorationModel(DefaultSiteTool.java:1252)
at org.apache.maven.doxia.tools.DefaultSiteTool.getDecorationModel(DefaultSiteTool.java:1260)
at org.apache.maven.doxia.tools.DefaultSiteTool.getDecorationModel(DefaultSiteTool.java:511)
at org.apache.maven.plugins.site.AbstractSiteRenderingMojo.createSiteRenderingContext(AbstractSiteRenderingMojo.java:225)
... 21 more
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Expected root element 'project' but found 'html' (position: START_TAG seen ... Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r\n<html>... @8:7)
at org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader.parseDecorationModel(DecorationXpp3Reader.java:619)
at org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader.read(DecorationXpp3Reader.java:1387)
at org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader.read(DecorationXpp3Reader.java:1401)
at org.apache.maven.doxia.tools.DefaultSiteTool.readDecorationModel(DefaultSiteTool.java:1294)

It turns out that maven looks for a site_en.xml for my parent project on archiva and archiva seems to generate a return file which is actually an error message.
The maven site plugin then tries to parse it and fails horribly :(
I worked around this by just adding the following content to src/site/site_en.xml in my parent project and everything was well!

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
<body>
</body>
</project>


I got really frustrated by this cryptic error message. I wanted to bash my head against the table and throw my laptop against the wall. Instead I cried out to God and not long after that I figured it out. Some would say thats just coincidence, I say: "Thank God", "Praise God" and "Why didn't I ask You sooner?".

Friday 20 August 2010

Chromium happy again

After getting the message below on each chromium start for months, I finally googled it:

Your profile could not be opened correctly.
Some features may be unavailable.
Please check that the profile exists and you have permission to read and write its contents.

The solution for me was simple:
rm ~/.config/chromium/Default/History




I can't believe I suffered so long with a broken awesomebar which never found new history :(
Previously I assumed its something broken in chromium that would get fixed by a newer Ubuntu packages. The fix never came so I'm really happy that I finally found the solution today:
see Ariel's solution.

Monday 28 June 2010

Apache url filtering corrupts compressed output.

While trying to set up Hudson behind apache again, I kept on getting garbage out.
After some googling I realized Hudson compress its output, therefore you can not use the normal proxy-html filter to modify urls coming from hudson:
SetOutputFilter proxy-html
Instead you can use the following:
SetOutputFilter INFLATE;proxy-html;DEFLATE
ProxyHTMLURLMap http://your_server:8080/hudson /hudson
http://wiki.uniformserver.com/index.php/Reverse_Proxy_Server_2:_mod_proxy_html_2
But since hudson seems to be well behaved it even better to just not use SetOutputFilter and ProxyHTMLURLMap.

http://wiki.hudson-ci.org/display/HUDSON/Running+Hudson+behind+Apache

Thursday 24 June 2010

Internet Explorer 7 with Wine

After searching a lot and trying some recipes, the following worked beautifully for me to install Internet Explorer 7 on ubuntu 10.04 (lucid)
http://rkpisanu.altervista.org/doku.php?
id=wineie7eng#internet_explorer_7_with_wine

(I changed the last step to get it to work for me, because its installed in your home dir, not in your current dir)

Download dependencies:
sudo apt-get install wine cabextract

Download and run IE4WINE:
Warning: All wine program running must be closed before install and run IE4WINE
wget http://rkpisanu.altervista.org/download/ie4wine
chmod +x ./ie4wine
./ie4wine

Finally:
type ~/wineie7 (Stable Version )
type ~/wineie7https (Unstable Version with https support)

Archiva On GlassFish with Derby

I added the following to the archiva wiki, but keeping a copy here for reference and backup.
https://cwiki.apache.org/confluence/display/ARCHIVA/Archiva+On+GlassFish+with+Derby
(based on https://cwiki.apache.org/confluence/display/ARCHIVA/Archiva+on+GlassFish+with+mySQL)



Glassfish web configuration


Deploy the war file on your Glassfish server from the admin page (http://localhost:4848).
Or copy the the war file into your <GLASSFISH_FOLDER>/domains/domain1/autodeploy/archiva.war
Glassfish file configuration
Edit the file <GLASSFISH_FOLDER>/domains/domain1/config/domain.xml to add the following tags:

Go to Ressources -> JavaMail Sessions and create a new ressource with jndi-name='mail/Session', otherwise you will get "Error creating bean with name 'mailSession'" on startup. Or add it to the config file:

...
<resources>
<mail-resource from="me@email.example.com" host="email.example.com" jndi-name="mail/Session" object-type="user"
store-protocol="imap" store-protocol-class="com.sun.mail.imap.IMAPStore"
transport-protocol="smtp" transport-protocol-class="com.sun.mail.smtp.SMTPTransport"
user="me"/>
...

Set appserver.base and appserver.home properties


Ensure that the property appserver.base is set. Archiva uses this to locate log files.

...
<java-config ...
<jvm-options>-Dappserver.base=${com.sun.aas.installRoot}/domains/domain1
<jvm-options>-Dappserver.home=${com.sun.aas.installRoot}/domains/domain1
...


JDBC resources


...
</applications>
<resources>
<jdbc-resource pool-name="archivaUsersPool" jndi-name="jdbc/users" />
<jdbc-resource pool-name="archivaPool" jndi-name="jdbc/archiva" />
..

Connection pool


<jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource" name="archivaUsersPool">
<property name="databaseName" value="/archiva/data/databases/users" />
<property name="connectionAttributes" value=";create=true" />
</jdbc-connection-pool>
<jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource" name="archivaPool">
<property name="databaseName" value="/archiva/data/databases/arvhiva" />
<property name="connectionAttributes" value=";create=true" />
</jdbc-connection-pool>

Resources ref


<servers>
<server config-ref="server-config" name="server">
...
<resource-ref enabled="true" ref="jdbc/users"/>
<resource-ref enabled="true" ref="jdbc/archiva"/>
...


Now restart you Glassfish server, and open the archiva location. The last thing you have to do is create the admin user.

Thursday 15 April 2010

dns cache

I installed dnsmasq a long time ago, but it turns out I never told my dhcp to use it.
All done now thanks to the following post:
http://www.ubuntugeek.com/local-dns-cache-for-faster-browsing-on-ubuntu-machine.html

My steps (for in case I need to do it again :) :
sudo apt-get install dnsmasq

Now edit /etc/dhcp3/dhclient.conf
and uncomment the following line:
prepend domain-name-servers 127.0.0.1;

I didn't have a /etc/dnsmasq.conf , and it does not seem to be needed because my dns caching works fine now without it; I assume its got good defaults.

To test it quickly add nameserver 127.0.0.1 to the top of /etc/resolv.conf
(it normally gets overwritten by the network manager)
dig yahoo.com

You will see something like
;; Query time: 38 msec
there.
Now do it again, and you should see something like:
;; Query time: 2 msec

sweet!

Wednesday 7 April 2010

Vaadin addons and maven and eclipse.

Afters struggling for almost 3 days, I finally got some vaadin add-ons working for me.
No matter what I did, I could not get maven to compile the custom widget sets :'-(

Wanting to do it with maven I started off with the instructions at http://dev.vaadin.com/wiki/Articles/MavenIntegration.

I got error messages like:
Failed to load the widgetset: 
/my-project/VAADIN/widgetsets/my.company.my.project.widgetset.My_ProjectWidgetset/
my.company.my.project.widgetset.My_ProjectWidgetset.nocache.js?1270654337749

Building it with the eclipse plugin said:
Compiling widgetset my.company.my.project.widgetset.My_ProjectWidgetset
Updating GWT module description file...
07 Apr 2010 5:46:09 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
INFO: Widgetsets found from classpath:
com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:/stf/opt/maven/repository/com/vaadin/vaadin/6.2.6/vaadin-6.2.6.jar!/
my.company.my.project.widgetset.My_ProjectWidgetset in file:/stf/prj/My_Project/src/main/resources

Done.
Starting GWT compiler
Widgetset compilation completed

But when running the webapp, I got:
Widgetset does not contain implementation for org.vaadin.browsercookies.BrowserCookies. Check its @ClientWidget mapping, widgetsets GWT module descrioption file and re-compile your widgetset. Unrendered UIDL:

org.vaadin.browsercookies.BrowserCookies(NO CLIENT IMPLEMENTATION FOUND) id=PID7

variables
Widgetset does not contain implementation for com.github.wolfie.meteorcursor.MeteorCursor. Check its @ClientWidget mapping, widgetsets GWT module descrioption file and re-compile your widgetset. Unrendered UIDL:

com.github.wolfie.meteorcursor.MeteorCursor(NO CLIENT IMPLEMENTATION FOUND) id=PID8 gr=75 th=10 pl=1000 di=2 im=theme://images/logo.png fr=0 disabled=false

I thought that it was building, since the addons that I wanted to use got detected.
Little did I know that it was not actually building!
Building with maven said:
[INFO] Updating widgetset my.company.my.project.widgetset.My_ProjectWidgetset
[INFO] establishing classpath list (scope = compile)
[ERROR] 07 Apr 2010 5:38:31 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
[ERROR] INFO: Widgetsets found from classpath:
[ERROR] com.github.wolfie.meteorcursor.MeteorcursorWidgetset in jar:file:/stf/opt/maven/repository/com/github/wolfie/meteorcursor/1.0.0/meteorcursor-1.0.0.jar!/
[ERROR] org.vaadin.browsercookies.widgetset.BrowserCookiesApplicationWidgetset in jar:file:/stf/opt/maven/repository/com/vaadin/sami/browsercookies/1.0.2/browsercookies-1.0.2.jar!/
[ERROR] com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:/stf/opt/maven/repository/com/vaadin/vaadin/6.2.6/vaadin-6.2.6.jar!/
[ERROR] my.company.my.project.widgetset.My_ProjectWidgetset in file:/stf/prj/My_Project/src/main/resources
[ERROR]


The reason it was not building was because I was trying to use the stable version of the gwt-maven-plugin: 1.2
After reading this forum post again, I tried 1.3-SNAPSHOT of this plugin; and all my troubles went away.


So now I build it with maven, and it should give output like this:
[INFO] [gwt:compile {execution: default}]                                                                                                                    
[INFO] using GWT jars from project dependencies : 1.7.1
[INFO] auto discovered modules [za.co.enerweb.ebr.gui.vaadin.widgetset.Ebr_vaadin_webWidgetset]
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] Compiling module my.company.my.project.widgetset.My_ProjectWidgetset
[INFO] Scanning for additional dependencies: jar:file:/stf/opt/maven/repository/com/vaadin/vaadin/6.2.6/vaadin-6.2.6.jar!/com/vaadin/terminal/gwt/client/DefaultWidgetSet.java
[INFO] Computing all possible rebind results for 'com.vaadin.terminal.gwt.client.WidgetMap'
[INFO] Rebinding com.vaadin.terminal.gwt.client.WidgetMap
[INFO] Invoking
[INFO] Detecting Vaadin components in classpath to generate WidgetMapImpl.java ...
[INFO] Widget set will contain implementations for following components:
[INFO] com.github.wolfie.meteorcursor.MeteorCursor
[INFO] com.vaadin.ui.AbsoluteLayout
[INFO] com.vaadin.ui.Accordion
[INFO] com.vaadin.ui.Button
[INFO] com.vaadin.ui.CheckBox
[INFO] com.vaadin.ui.ComboBox
[INFO] com.vaadin.ui.CssLayout
[INFO] com.vaadin.ui.CustomComponent
[INFO] com.vaadin.ui.CustomLayout
[INFO] com.vaadin.ui.DateField
[INFO] com.vaadin.ui.Embedded
[INFO] com.vaadin.ui.Form
[INFO] com.vaadin.ui.FormLayout
[INFO] com.vaadin.ui.GridLayout
[INFO] com.vaadin.ui.HorizontalLayout
[INFO] com.vaadin.ui.Label
[INFO] com.vaadin.ui.Link
[INFO] com.vaadin.ui.ListSelect
[INFO] com.vaadin.ui.MenuBar
[INFO] com.vaadin.ui.NativeButton
[INFO] com.vaadin.ui.NativeSelect
[INFO] com.vaadin.ui.OptionGroup
[INFO] com.vaadin.ui.OrderedLayout
[INFO] com.vaadin.ui.Panel
[INFO] com.vaadin.ui.PopupView
[INFO] com.vaadin.ui.ProgressIndicator
[INFO] com.vaadin.ui.RichTextArea
[INFO] com.vaadin.ui.Select
[INFO] com.vaadin.ui.Slider
[INFO] com.vaadin.ui.SplitPanel
[INFO] com.vaadin.ui.TabSheet
[INFO] com.vaadin.ui.Table
[INFO] com.vaadin.ui.TextField
[INFO] com.vaadin.ui.Tree
[INFO] com.vaadin.ui.TwinColSelect
[INFO] com.vaadin.ui.Upload
[INFO] com.vaadin.ui.UriFragmentUtility
[INFO] com.vaadin.ui.VerticalLayout
[INFO] com.vaadin.ui.Window
[INFO] org.vaadin.browsercookies.BrowserCookies
[INFO] Done. (2seconds)
[INFO] Compiling 1 permutations
[INFO] Permutation compile succeeded
[INFO] Linking into /stf/prj/My_Project/src/main/webapp/VAADIN/widgetsets
[INFO] Link succeeded
[INFO] Compilation succeeded -- 40.785s


To be able to serve my webapp using tomcat launched from eclipse I need to compile the GWT stuff into src/main/webapp . So unlike the instructions I mention at the top of this post, some key parts of my pom is as follows:
  <properties>
<vaadin-widgets-dir>src/main/webapp/VAADIN/widgetsets</vaadin-widgets-dir>
</properties>
<build>
<plugins>
<!-- Compiles your custom GWT components with the GWT compiler -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.3-SNAPSHOT</version>
<executions>
<execution>
<configuration>
<webappDirectory>${vaadin-widgets-dir}</webappDirectory>
<extraJvmArgs> -Dgwt.style=PRETTY -Xmx512M -Xss1024k</extraJvmArgs>
</configuration>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Updates Vaadin 6.2 widgetset definitions based on project dependencies -->
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<goals>
<goal>update-widgetset</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<!-- also delete the generated vaadin web content -->
<directory>${vaadin-widgets-dir}</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>

Thursday 4 March 2010

vaadin 6.3 ant build target

The vaadin source web page still has out-dated build instructions.
I tried:
vaadin/6.3/build>$ ant package-linux                                                                                                         
Buildfile: build.xml

BUILD FAILED
Target "package-linux" does not exist in the project "Vaadin".

Total time: 0 seconds


Looking at the following I realised that things have changed a bit:
$ ant -p
Buildfile: build.xml

Main targets:

build Build package required files, without packing them.
compile-widgetset Compiles the widgetset given as the first parameter
package-all Build public packages.
package-jar Create vaadin-x.y.z.jar file.
package-jar-quick Create vaadin-x.y.z.jar file quick.
test-build used for testing build.xml
test-package used for testing build.xml
Default target: package-all

So I tried the following starting building like crazy:
$ ant package-all                                                      
Buildfile: build.xml
...

But it got stuck on:

manual-checkout:
[echo] Checking out manual from repository http://dev.vaadin.com/svn/doc/trunk
[mkdir] Created dir: /stf/prj/fs/vaadin/6.3/build/checkout

Finally I did:
$ ant package-jar

and the jar finally got built!

BUILD SUCCESSFUL
Total time: 10 minutes 49 seconds


Will try out package-jar-quick next...

This made me shout out complaints about ant (ask my co-workers) and fall in love with maven all over again.

Tuesday 2 March 2010

How to make Archiva less paranoid about passwords

After just 3 login attempts a user's account is locked by Archiva, which is quite bad if a whole team and continuous integration servers uses the same account.

I think you should just add an exponentially growing timeout to when the user can log in (maybe per source ip) or at least make it configurable from the frontend. But anyways, for our internal/firewalled archiva this sort of thing is a bit of over kill.

I finally found out how to convince it to be more lenient.
Just add the following content:
security.policy.password.expiration.days=999999
security.policy.password.expiration.enabled=false
security.policy.allowed.login.attempt=300
security.policy.password.previous.count=1
security.policy.password.rule.reuse.enabled=false


to the equivalent file to your system:
glassfish_2.1/domains/archiva/lib/classes/org/apache/maven/archiva/security.properties


http://osdir.com/ml/users-archiva-apache/2009-02/msg00031.html