users@glassfish.java.net

Re: Embedded testing: glassfish-resources.xml causes error?

From: Bhavanishankar <bshankar_at_sun.com>
Date: Thu, 03 Feb 2011 12:24:45 +0530

On 02/03/2011 01:55 AM, Laird Nelson wrote:
> Since @Remote EJB testing doesn't work with
> javax.ejb.embeddable.EJBContainer, and since
> http://java.net/jira/browse/GLASSFISH-15775 is preventing me from
> using Glassfish embedded directly, I looked into using
> maven-embedded-glassfish-plugin.
>
> In order to do this, I need to be able to set up an H2 data source.
> When I was using the EJBContainer and the embedded Glassfish
> approaches, this was easy: I just hacked up a domain.xml and added my
> data source in there.
When using maven plugin also, you can supply your hacked up domain.xml
to the embedded glassfish by specify it under 'configFile' option, like
this:

<configuration>
<goalPrefix>glassfish</goalPrefix>
<app>target/securewebapp.war</app>
<configFile>your-domain.xml</configFile>
...
</configuration>

In 3.1 suports more configurable options for the plugin. Refer this :
http://java.net/projects/glassfish/sources/svn/content/trunk/v3/tests/embedded/maven-plugin/secureWebApp/pom.xml?rev=44853

_Bhavani.

>
> With the maven plugin, I don't see an obvious way to do this, and
> frankly that's probably a good thing. OK, I thought, time to finally
> put together a glassfish-resources.xml file.
>
> So I did.
>
> The plugin barfs because it now cannot find a local copy of the DTD
> (I'm developing on a Mac, hence the rather confusing temp directories):
>
> SEVERE: Failue while processing glassfish-resources.xml(s) in the
> archive --
> /var/folders/Xd/XdAtuoEzHdOh7AR5tSGFJ++++TI/-Tmp-/gfembed1141588345015992204tmp/lib/dtds/glassfish-resources_1_5.dtd
> (No such file or directory)
> org.glassfish.deployment.common.DeploymentException: Failue while
> processing glassfish-resources.xml(s) in the archive --
> /var/folders/Xd/XdAtuoEzHdOh7AR5tSGFJ++++TI/-Tmp-/gfembed1141588345015992204tmp/lib/dtds/glassfish-resources_1_5.dtd
> (No such file or directory)
> at
> org.glassfish.admin.cli.resources.ResourcesXMLParser.initProperties(ResourcesXMLParser.java:235)
> at
> org.glassfish.admin.cli.resources.ResourcesXMLParser.<init>(ResourcesXMLParser.java:165)
> at
> com.sun.enterprise.connectors.module.ResourcesDeployer.processArchive(ResourcesDeployer.java:207)
> at
> com.sun.enterprise.connectors.module.ResourcesDeployer.processResources(ResourcesDeployer.java:793)
> at
> com.sun.enterprise.connectors.module.ResourcesDeployer.event(ResourcesDeployer.java:746)
> at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
> at
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:397)
> at
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
> at
> org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
> at
> com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:354)
> at
> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:369)
> at
> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1080)
> at
> com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
> at
> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1260)
> at
> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1248)
> at
> com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.executeCommand(CommandExecutorImpl.java:118)
> at
> com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:97)
> at
> com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:88)
> at org.glassfish.maven.PluginUtil.doDeploy(PluginUtil.java:102)
>
> How do I get past THIS error?
>
> Thwacking away,
> Laird