September 2nd, 2010
If you want to serve static content from the same WAR as Jeresy resources, it is possible to configure Jersey to run as a filter rather than a Servlet.
You can then define the property com.sun.jersey.config.property.WebPageContentRegex to exclude URLs matching the regular expression from being handled by Jersey. Instead request matching the pattern will fall through to the next filter and eventually the default Servlet, which can respond with your static content in the normal way.
<filter>
<filter-name>jerseyFilter</filter-name>
<filter-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</filter-class>
<init-param>
<param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
<param-value>/static/.*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>jerseyFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Posted in glassfish, java, jax-rs | No Comments »
August 9th, 2010
:let j=[] | %s/xxxx/\=printf(”%04d”, “”.len(add(j,”)))/g
(adapted from this tip)
Posted in unix, vim | No Comments »
April 13th, 2010
I have a CruiseControl CI build running as a windows service. Unfortunately when unit tests involving FEST Swing are run they fail as they need to actually render the UI components to a logged in user’s desktop.
My CruiseControl machines are virtual windows server 2003 machines running on vmware. So each build has its own dedicated virtual machine.
I followed the instructions for hudson builds on windows from the FEST Swing site.
Configure the server to auto login your build user:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon=1
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName=testuser
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword=secret
Start CruiseControl on login by creating a batch file in the users “Start Up” start menu folder containing:
"C:\Program Files\CruiseControl\Wrapper.exe" -c "C:\Program Files\CruiseControl\wrapper.conf"
Make sure that the screen saver is disabled.
Posted in Continuous Integration, java | No Comments »
January 19th, 2010
It seems that in ActiveMq 5.3.0 someone has change the way that the JMX Management Context is discovered.
If you simply upgrade from version 5.2.0 to 5.3.0 you will need to define the system property jboss.platform.mbeanserver
I think this tells JBoss to use the platform MBean server instead of starting it own; and it is the platform MBean server that ActiveMQ uses for its org.apache.activemq:BrokerName=localhost,* MBeans.
Posted in java, jboss | No Comments »
January 12th, 2010
So, I am in the unfortunate position of having to run Glassfish v3 on Windows 2003 server. Sun seem to have improved the asadmin create-service command so that it can create windows services as well as Solaris services.
Unfortunately, this new windows service creation functionality doesn’t seem to be documented anywhere.
Posted in glassfish, java | No Comments »
January 12th, 2010
I’ve managed to get the glassfish v3 silent install working.
Maybe I should have just used the zip file distribution… anyway….
Here is the answer file I used. all the ${variables} need to be filled in with the values relevant to your situation. You have to pass the -s option as well as the -a option to the glassfish installer exe.
RegistrationOptions.regoptions.CREATE_NEWACCT=CREATE_NEWACCT
glassfish.Administration.HTTP_PORT=${glassfish.http.port}
updatetool.Configuration.PROXY_PORT=
glassfish.Administration.ADMIN_PASSWORD=${glassfish.admin.password}
JDKSelection.directory.JDK_FROM_LIST_CHOICE=false
RegistrationOptions.regoptions.SKIP_REGISTRATION=SKIP_REGISTRATION
updatetool.Configuration.PROXY_HOST=
SOAccountCreation.accountinfo.COUNTRY=
InstallHome.directory.INSTALL_HOME=${INSTALL_PATH}
RegistrationOptions.regoptions.USE_EXISTINGACCT=USE_EXISTINGACCT
SOAccountCreation.accountinfo.FIRSTNAME=
updatetool.Configuration.ALLOW_UPDATE_CHECK=false
glassfish.Administration.ADMIN_USER=${glassfish.admin.user}
JDKSelection.directory.JDK_LIST=
SOAccountCreation.accountinfo.PASSWORD=
SOAccountCreation.accountinfo.COMPANYNAME=
JDKSelection.directory.HIDDEN_JDK=
SOAccountCreation.accountinfo.COUNTRY_DROP_DOWN=
SOAccountCreation.accountinfo.REENTERPASSWORD=
License.license.ACCEPT_LICENSE=0
RegistrationOptions.regoptions.USERNAME=
updatetool.Configuration.BOOTSTRAP_UPDATETOOL=false
SOAccountCreation.accountinfo.LASTNAME=
glassfish.Administration.ADMIN_PORT=${glassfish.admin.port}
RegistrationOptions.regoptions.USERPASSWORD=
JDKSelection.directory.JDK_TYPED_IN_CHOICE=true
SOAccountCreation.accountinfo.EMAIL=
JDKSelection.directory.JDK_TYPE_IN=${JDKPath}
RegistrationOptions.regoptions.DUMMY_PROP=
Posted in glassfish, java | No Comments »
January 12th, 2010
I’m struggling with the Glassfish v3 automated installation. I’m trying to follow the instructions in the glassfish install documentation. But the variables they mention as configurable don’t correspond with the variables that are in the generated answer file.
Things I know so far are:
- you can generate an answer file using the -n option
- you can read the answer file in using the -a option
- you have to specify -s if you want the installer to run silently
- you can create a windows service using asadmin create-service which seems to be new to version 3
Posted in glassfish, java | No Comments »
January 5th, 2010
Here is my first working XML for running unit tests against an application deployed on an embedded glassfish v3 instance:
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.0</version>
<configuration>
<goalPrefix>glassfish</goalPrefix>
<app>App.war</app>
<port>8080</port>
<contextRoot>App</contextRoot>
</configuration>
<executions>
<execution>
<id>start-glassfish</id>
<phase>generate-test-resources</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>deploy-glassfish</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-glassfish</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
Posted in glassfish, java | No Comments »
January 5th, 2010
Apparently there is a plugin for Maven that allows you to deploy your application against an embedded maven server http://blogs.sun.com/sirajg/entry/using_maven_plugin_for_v3
If it works, I’ll be able to get rid of all the complicated Maven XML I have for downloading and installing Glassfish V2.
There is documentation available for the plugin in the Sun GlassFish Enterprise Server v3 Embedded Server Guide
Posted in glassfish, java | No Comments »
December 17th, 2009
For historical reasons, I have the personalisation information for some users stored in a Sun LDAP server, and I have some data about them stored in a Microsoft SQL Server. Unfortunately we are using Microsoft Reporting services.
In the database users are referred to by a system wide unique identifier. The mapping from this unique identifier to the user’s display name is stored in the LDAP directory server.
Fine, I thought, I think SQL Server has a way to do queries which span multiple data sources. And I think Microsoft has a way to talk to Active Directory servers over LDAP. So, I should be able to co-opt that for my purpose.
Only it turns out that you can’t.
[OLE/DB Provider 'ADSDSOObject' IRowset::GetData returned 0x40eda: Data status returned from the provider: [COLUMN_NAME=sn STATUS=DBSTATUS_E_CANTCONVERTVALUE]]
A lot of LDAP attributes are marked as multi-valued in the schema. And, even though I know that there will only be one value (I am happy to treat multiple values as an error condition) – the ADSDSOObject just doesn’t support multi-valued attributes, no matter how many values there actually are. Its in the distributed query documentation. For various other reasons I can’t change the LDAP schema.
The first limitation is that multivalued properties cannot be returned in the result set to SQL Server. ADSI will read schema information from the LDAP server that defines the structure and syntax of the classes and attributes used by the server. If the attribute that is requested from the LDAP server is defined in the schema as being multi-valued it cannot be returned in an OPENQUERY statement.
So near, and yet so far away as to be nearly incomprehensible. Why, oh why did they design it that way?
Posted in ldap, sql server | No Comments »