javaee / glassfish-maven-plugin-legacy

Other
1 stars 5 forks source link

Unable to reuse a declared ConnectionFactory in another domain resource #9

Open glassfishrobot opened 13 years ago

glassfishrobot commented 13 years ago

When defining in a domain configuration more than one JMS destination (or one JMS destination and one JMS connection factory), the plugin tries to create the connection factory more than once, and fails.

As an example, with the following domain infos

<domain>
<name>TEST</name>
<httpPort>8080</httpPort>
<adminPort>4848</adminPort>
<resources>
<connectionFactory>
    <jndiName>jms/testConnectionFactory</jndiName>
    <type>connectionFactory</type>
</connectionFactory>
<jmsTopic>
    <jndiName>jms/testdestination</jndiName>
    <destinationName>jms_testdestination</destinationName>
    <connectionFactory>
        <jndiName>jms/testConnectionFactory</jndiName>
    </connectionFactory>
</jmsTopic>
</resources>
</domain>

Running mvn glassfish:create-domain -e will generate the following error log

ebug=true --domaindir "E:\\java-ext\\glassfish3\\glassfish\\domains" autocat
[INFO] Attempting to start pouet.... Please look at the server log for more details.....
[INFO] Deprecated syntax, instead use:
[INFO] asadmin --echo --terse=false --interactive=false --user autocat --passwordfile E:\JavaWorkspace\pouet\pouet-ear/src/main/config/glassfish.password --port 4848 create-jms-resource [options] ...
[INFO] asadmin --host localhost --port 4848 --user autocat --passwordfile E:\JavaWorkspace\pouet\pouet-ear/src/main/config/glassfish.password --interactive=false --echo=true --terse=false create-jms-resource --restype javax.jms.ConnectionFactory --enabled=true jms/testConnectionFactory
[INFO] Connector resource jms/testConnectionFactory created.
[INFO] Command create-jms-resource executed successfully.
[INFO] Deprecated syntax, instead use:
[INFO] asadmin --echo --terse=false --interactive=false --user autocat --passwordfile E:\JavaWorkspace\pouet\pouet-ear/src/main/config/glassfish.password --port 4848 create-jms-resource [options] ...
[INFO] asadmin --host localhost --port 4848 --user autocat --passwordfile E:\JavaWorkspace\pouet\pouet-ear/src/main/config/glassfish.password --interactive=false --echo=true --terse=false create-jms-resource --restype javax.jms.TopicConnectionFactory --enabled=true jms/testConnectionFactory
[INFO] Command create-jms-resource failed.
[ERROR] remote failure: Unable to create connection resource.
[ERROR] A ConnectorResource by name jms/testConnectionFactory already exists with resource-ref in target server.
[ERROR] Unable to create JMS resource jms/testConnectionFactory.
[ERROR] For more detail on what might be causing the problem try running maven with the --debug option
[ERROR] or setting the maven-glassfish-plugin "echo" property to "true".
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46.907s
[INFO] Finished at: Tue Aug 02 12:05:36 CEST 2011
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:deploy (default-cli) on project aut
ocat-ear: Unable to create JMS resource jms/testConnectionFactory. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.glassfish.maven.plugin:maven-glassfis
h-plugin:2.1:deploy (default-cli) on project autocat-ear: Unable to create JMS resource jms/testConnectionFactory.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoFailureException: Unable to create JMS resource jms/testConnectionFactory.
        at org.glassfish.maven.plugin.command.AsadminCommand.execute(AsadminCommand.java:121)
        at org.glassfish.maven.plugin.CreateDomainMacro.createJMSDestination(CreateDomainMacro.java:122)
        at org.glassfish.maven.plugin.CreateDomainMacro.addResources(CreateDomainMacro.java:104)
        at org.glassfish.maven.plugin.CreateDomainMacro.execute(CreateDomainMacro.java:76)
        at org.glassfish.maven.plugin.StartDomainMacro.execute(StartDomainMacro.java:65)
        at org.glassfish.maven.plugin.DeployGlassfishMojo.doExecute(DeployGlassfishMojo.java:63)
        at au.net.ocean.maven.plugin.OceanMojo.execute(OceanMojo.java:67)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more

Environment

Windows XP, Glassfish 3.0.1, maven-glassfish-plugin 2.1

Affected Versions

[current]

glassfishrobot commented 13 years ago

Reported by riduidel

glassfishrobot commented 13 years ago

riduidel said: Seems like it is due to CreateDomainMacro#createJMSDestination which creates, as first step, a resource corresponding to existing connectionFactory. I don't know how to do it, but, to my mind, a solution would be to query existing connection factories (using list-jms-resources with the correct type see http://download.oracle.com/docs/cd/E18930_01/html/821-2433/list-jms-resources-1.html#scrolltoc) before trying to create current one. No ?

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA MAVEN_GLASSFISH_PLUGIN-9