try {
InitialContext context = new InitialContext();
DataSource dataSource = (DataSource) context.lookup("jboss/datasources/ExampleDS");
return new JDBCStateRepository(dataSource, "MYTABLE");
} catch (NamingException e) {
throw new IllegalArgumentException("Could not find datasource");
}