jianyu's blog

Deploy portlet to WebSphere Portal Server inside RAD

If you met this exception when add a portlet/EAR to WPS server by RAD WPS adapter (inside the Servers view):
 
The id=test-portlet already exists for stored standard portlet application Application Name not available for this Application in the XML element portlet-app test-portlet.
 
It means you should add id to the portlet-app portlet.xml, like:
 

M2E plugin doesn't work with tomcat server

There is an issue for M2E (version 1.0.0.20110607-2117) to generate correct eclipse configuration files especially the .classpath. Once imported a maven project, it will generate the .classpath like below:
 
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
 
But this will cause the eclipse server runtime like tomcat cannot find those jar libraries. After add the dynamic web application to the server from the server view, and start the server, it will throw exceptions like

Eclipse M2E plugin error: not covered by lifecycle configuration

M2E is formly known as M2eclipse, after transited to eclipse project, it introduced a new concept, life cycle connector. If some plugin has no corresponding connector, it will mark an error in eclipse IDE like below:
 
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.5:add-source (execution: default, phase: process-classes)
 
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:jaxws-maven-plugin:1.10:wsgen (execution: generate-wsdl, phase: process-classes)

Mount cygwin driver with permission disabled

Change the default cygdrive mount option (in file /etc/fstab):
 
none    /cygdrive       cygdrive        binary,user,noacl       0       0
 

Config maven to use socks proxy

This is not listed on maven official documents, I took several days to find a solution:
Create below environment viarible
set MAVEN_OPTS=-DsocksProxyHost=yourSocksProxyHost -DsocksProxyPort=yourSocksProxyPort

Add custom spring securtiy expression method

There are no offcial ways to add custom security expression, like hasRole / hasAuthority etc, the only way is to do some tweaking.
 
Solution 1. Create a static method and invoke by spel. Like below:
 
                <security:authorize access="T(com.Class).doSomething(request.parameterMap['parameterName'], 'ROLE_ADMIN')">

python, xpath and ElementTree

Failed to find a xpath solution in python2.6 standard library. Seems like ElementTree is the only API have limited xpath support. But...
 
http://effbot.org/zone/element-xpath.htm
http://codespeak.net/pipermail/lxml-dev/2006-May/001294.html
And for my test code:

deps = tree.findall("//dependency[@testP='testV']")
print deps

 
Error:

SyntaxError: expected path separator ([)
 
Also Find:

phpmyadmin, nginx, ssl and https

Several problems resolved:

1. Jump to http 80 after login, not https.

2. Jump to https://test.com/index.php, not https://test.com/phpmyadmin/index.php after login.

3. Static content location.

Below is my sample configuration:

Seam, JPA & Resin

These days I am transportting some seam-jpa based web applications from jboss to resin. But found there is a bug for seam to create EntityManagerFactory in resin:

[19:34:46.510]org.jboss.seam.InstantiationException: Could not instantiate Seam
component: application_form_Database
[19:34:46.510]  at org.jboss.seam.Component.newInstance(Component.java:2144)
[19:34:46.510]  at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)

...

Selenium-RC and https certification

It realy waste me several days to find a way to test our https application. Each time I start it manually I must add an exception of certificatioin into firefox, so it can't be ran in an automated test system. Until I found this:
 
http://townx.org/blog/elliot/dealing-self-signed-ssl-certificates-when-r...
 
Just in case of lost this article, I copied the solution here:
 

Syndicate content