Discussion:
maven-glassfish-plugin
Nicolas Delsaux
2011-08-02 09:55:36 UTC
Permalink
Salut
je vous interromps sur la plage pour une question limite couillonne.
Est-ce que vous avez déja utilisé maven-glassfish-plugin pour créer des
ressources JMS ?
ca fait une journée que j'essaye, et ça merde à chaque fois.
J'ai eu du mal à comprendre, mais maintenant, ça y est, j'ai compris.
Il semble que les développeurs n'aient jamais imaginé qu'on puisse utiliser
la même connectionfactory pour plusieurs queues. je m'explique.
Avec maven-glassfish-plugin, on peut déclarer un domaine dans son pom. C'est
très pratique pour partager la conf du domaine entre développeurs, je
trouve.
Donc, je me suis dit que j'allais tout flanquer là-dedans, et piloter mon
glassfish à grands coups de mvn glassfish:deploy (qui crée et démarre le
domaine si nécessaire, le confort quoi !).
J'ai donc créé mon domaine comme ça :

<domain>
<name>autocat</name>
<httpPort>8080</httpPort>
<adminPort>4848</adminPort>
<!-- TODO maybe replace global resources with application specific ones
using
http://blogs.oracle.com/JagadishPrasath/entry/application_scoped_resources_in_glassfish-->
<resources>
<!-- JMS Connection factory -->
<connectionFactory>
<jndiName>jms/pouet/ConnectionFactory</jndiName>
<type>connectionFactory</type>
</connectionFactory>
<jmsTopic>
<jndiName>jms/CrudServiceNotifier</jndiName>
<destinationName>jms_CrudServiceNotifier</destinationName>
<connectionFactory>
<jndiName>jms/pouet/ConnectionFactory</jndiName>
</connectionFactory>
</jmsTopic>
</resources>
</domain>

Et quand je tape mvn glassfish:deploy, il me sort ce log :

l (2 KB at 2.5 KB/sec)
[INFO] Domain pouet isn't started. Starting it for you.
[INFO] Domain pouet does not exist. Creating it for you.
[INFO] Deprecated syntax, instead use:
[INFO] asadmin --echo --terse=false --interactive=false --user pouet
--passwordfile
E:\JavaWorkspace\pouet\pouet-ear/src/main/config/glassfish.password
create-domain [options] ...
[INFO] CLI031 Warning: Option "profile" is obsolete and will be ignored.
[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-domain --adminport 4848
--profile developer --domaindir
"E:\\java-ext\\glassfish3\\glassfish\\domains" --instanceport 8080
--savemasterpassword=false --usemasterpassword=false --savelogin=false
--nopassword=false --checkports=true autocat
[INFO] Using port 4848 for Admin.
[INFO] Using port 8080 for HTTP Instance.
[INFO] Using default port 7676 for JMS.
[INFO] Using default port 3700 for IIOP.
[INFO] Using default port 8181 for HTTP_SSL.
[INFO] Using default port 3820 for IIOP_SSL.
[INFO] Using default port 3920 for IIOP_MUTUALAUTH.
[INFO] Using default port 8686 for JMX_ADMIN.
[INFO] Using default port 6666 for OSGI_SHELL.
[INFO] Using default port 9009 for JAVA_DEBUGGER.
[INFO] The file in given locale [fr_FR] at:
[E:\java-ext\glassfish3\glassfish\lib\templates\locales\fr_FR\index.html]
could not be found. Using default (en_US) index.html instead.
[INFO] Distinguished Name of the self-signed X.509 Server Certificate is:
[INFO] [CN=perigee-567125f,OU=GlassFish,O=Oracle Corporation,L=Santa
Clara,ST=California,C=US]
[INFO] Distinguished Name of the self-signed X.509 Server Certificate is:
[INFO] [CN=perigee-567125f-instance,OU=GlassFish,O=Oracle
Corporation,L=Santa Clara,ST=California,C=US]
[INFO] No domain initializers found, bypassing customization step
[INFO] Domain autocat created.
[INFO] Domain autocat admin port is 4848.
[INFO] Domain autocat admin user is "autocat".
[INFO] Command create-domain executed successfully.
[INFO] Deprecated syntax, instead use:
[INFO] asadmin --echo --terse=false --interactive=false --user autocat
--passwordfile E:\JavaWorkspace\ pouet \ pouet -e
ar/src/main/config/glassfish.password start-domain [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 start-domain --verbose=false
--upgrade=false --debug=true --domaindir
"E:\\java-ext\\glassfish3\\glassfish\\domains" autocat
[INFO] Attempting to start autocat.... 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.Connecti
onFactory --enabled=true jms/ pouet /ConnectionFactory
[INFO] Connector resource jms/ pouet /ConnectionFactory 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/ pouet
/ConnectionFactory
[INFO] Command create-jms-resource failed.
[ERROR] remote failure: Unable to create connection resource.
[ERROR] A ConnectorResource by name jms/ pouet /ConnectionFactory already
exists with resource-ref in target server.
[ERROR] Unable to create JMS resource jms/ pouet /ConnectionFactory.
[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: 51.672s
[INFO] Finished at: Tue Aug 02 11:23:44 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/ pouet /ConnectionFactory. ->
[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/AutoCat/ConnectionFactory.
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/AutoCat/ConnectionFactory.
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
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Bref,,; ça foire. Et ça foire parce qu'il essaye de créer deux fois la
ConnectionFactory.
En fouillant un peu dans le code du plugin, je me suis rendu compte que
c'était parce que, dans CreateDomainMacro#createJMSDestination, on essaye
toujours de créer la ConnectionFactory associée à la destination JMS. C'est
voulu ? Ca n'en donne pas l'impression en tout cas.
Donc, ça foire dans les grandes largeurs dans mon cas.
Alors que puis-je faire ?
Faire un fork de ce plugin ? Berk !
Faire un bug report ? J'ai l'impression, au vu des ML, que le projet est
loin d'être dynamique. Cela dit, je veux bien essayer.
Utiliser une autre méthode de partage des informations relatives à mon
domaine ?
Je veux bien, mais je sais pas trop comment faire. En effet, si la doc
semble mentionner l'existence d'un resources.xml jouant un rôle analogue,
mais dans un format différent, à celui des ressources décrites dans maven,
ce format n'est vraiment pas très documenté.
Et à part ces solutions spécifiques Glassfish, existe-t-il des moyens de
partager la configuration des sources de données d'un serveur d'application
? Autrement dit, vous faites comment, chez vous ?
--
Nicolas Delsaux
Continuer la lecture sur narkive:
Loading...