[GLASSFISH-20281] SDK 4.0 - Connector samples (mailconnector) fails to deploy Created: 11/Apr/13  Updated: 20/Dec/16  Resolved: 14/May/13

Status: Resolved
Project: glassfish
Component/s: sample_apps
Affects Version/s: 4.0_dev
Fix Version/s: 4.0_dev

Type: Bug Priority: Major
Reporter: Alex Pineda Assignee: dapeng_hu
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Installed java_ee_sdk-7-b83-unix.sh*, on OEL6 machine, using Maven version 3.0.5. Configured Maven environment as noted in http://aseng-wiki.us.oracle.com/asengwiki/display/GlassFish/BG+Development+Environment+Guide


Tags: 4_0-approved

 Description   

Following the "Building, Deploying, Running the Application" instructions that came with the Connector sample, one is not able to deploy the sample. The exact commands executed were:

1. [test@wolfrun] $ cd $WORKSPACE/glassfish4/samples/connectors
2. [test@wolfrun] $ mvn clean install
3. [test@wolfrun] $ mvn cargo:start -Dglassfish.home=$WORKSPACE/glassfish4

Step 1 and 2 work without problem. Please note that when executing "mvn install", the sample is built as follows
[INFO] ------------------------------------------------------------------------
[INFO] Building Mail Enterprise Application 4.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] — maven-enforcer-plugin:1.2:enforce (enforce-maven) @ mailconnector-ear —
[INFO]
[INFO] — maven-enforcer-plugin:1.2:enforce (enforce-versions) @ mailconnector-ear —
[INFO]
[INFO] — maven-ear-plugin:2.8:generate-application-xml (default-generate-application-xml) @ mailconnector-ear —
[INFO] Generating application.xml
[INFO]
[INFO] — maven-resources-plugin:2.4.3:resources (default-resources) @ mailconnector-ear —
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/agpineda/workspace/glassfish4/samples/connectors/mailconnector/mailconnector-ear/src/main/resources
[INFO]
[INFO] — maven-ear-plugin:2.8:ear (default-ear) @ mailconnector-ear —
[INFO] Copying artifact [ejb:org.glassfish-samples:mailconnector-mdb:4.0-SNAPSHOT] to [mailconnector-mdb.jar]
[INFO] Copying artifact [war:org.glassfish-samples:mailconnector-web:4.0-SNAPSHOT] to [mailconnector-web.war]
[INFO] Copying artifact [rar:org.glassfish-samples:mailconnector-ra:4.0-SNAPSHOT] to [mailconnector.rar]
[INFO] Copy ear sources to /home/agpineda/workspace/glassfish4/samples/connectors/mailconnector/mailconnector-ear/target/mailconnector-ear-4.0-SNAPSHOT
[INFO] Including custom manifest file [/home/agpineda/workspace/glassfish4/samples/connectors/mailconnector/mailconnector-ear/target/mailconnector-ear-4.0-SNAPSHOT/META-INF/MANIFEST.MF]
[INFO] Building jar: /home/agpineda/workspace/glassfish4/samples/connectors/mailconnector/mailconnector-ear/target/mailconnector-ear.ear
[INFO]
[INFO] — maven-install-plugin:2.3.1:install (default-install) @ mailconnector-ear —
[INFO] Installing /home/agpineda/workspace/glassfish4/samples/connectors/mailconnector/mailconnector-ear/target/mailconnector-ear.ear to /home/agpineda/.m2/repository/org/glassfish-samples/mailconnector-ear/4.0-SNAPSHOT/mailconnector-ear-4.0-SNAPSHOT.ear
[INFO] Installing /home/agpineda/workspace/glassfish4/samples/connectors/mailconnector/mailconnector-ear/pom.xml to /home/agpineda/.m2/repository/org/glassfish-samples/mailconnector-ear/4.0-SNAPSHOT/mailconnector-ear-4.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] mailconnector application ......................... SUCCESS [0.975s]
[INFO] MailConnector Resource Adapter .................... SUCCESS [2.695s]
[INFO] Mail MDB Reciever ................................. SUCCESS [1.261s]
[INFO] Mail Web Application .............................. SUCCESS [0.784s]
[INFO] Mail Enterprise Application ....................... SUCCESS [0.336s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.378s
[INFO] Finished at: Wed Apr 10 20:46:54 PDT 2013
[INFO] Final Memory: 28M/346M
[INFO] ------------------------------------------------------------------------

To deploy the sample, "mvn cargo:start -Dglassfish.home=$WORKSPACE/glassfish4" is executed and the following errors are seen
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.glassfish-samples:mailconnector-ra:rar:4.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-rar-plugin is missing. @ line 86, column 17
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 71, column 17
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] mailconnector application
[INFO] MailConnector Resource Adapter
[INFO] Mail MDB Reciever
[INFO] Mail Web Application
[INFO] Mail Enterprise Application
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mailconnector application 4.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] — cargo-maven2-plugin:1.3.2:start (default-cli) @ mailconnector-app —
[INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-glassfish:jar:1.3.2 for container glassfish3x
[INFO] [talledLocalContainer] Using port 4848 for Admin.
[INFO] [talledLocalContainer] Using port 8080 for HTTP Instance.
[INFO] [talledLocalContainer] Using port 7676 for JMS.
[INFO] [talledLocalContainer] Using port 3700 for IIOP.
[INFO] [talledLocalContainer] Using port 8181 for HTTP_SSL.
[INFO] [talledLocalContainer] Using port 3820 for IIOP_SSL.
[INFO] [talledLocalContainer] Using port 3920 for IIOP_MUTUALAUTH.
[INFO] [talledLocalContainer] Using port 8686 for JMX_ADMIN.
[INFO] [talledLocalContainer] Using port 6666 for OSGI_SHELL.
[INFO] [talledLocalContainer] Using port 9009 for JAVA_DEBUGGER.
[INFO] [talledLocalContainer] Distinguished Name of the self-signed X.509 Server Certificate is:
[INFO] [talledLocalContainer] [CN=wolfrun.us.oracle.com,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US]
[INFO] [talledLocalContainer] Distinguished Name of the self-signed X.509 Server Certificate is:
[INFO] [talledLocalContainer] [CN=wolfrun.us.oracle.com-instance,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US]
[INFO] [talledLocalContainer] Domain cargo-domain created.
[INFO] [talledLocalContainer] Domain cargo-domain admin port is 4848.
[INFO] [talledLocalContainer] Domain cargo-domain admin user is "admin".
[INFO] [talledLocalContainer] Command create-domain executed successfully.
[INFO] [talledLocalContainer] GlassFish 3.x starting...
[INFO] [talledLocalContainer] Waiting for cargo-domain to start .......
[INFO] [talledLocalContainer] Successfully started the domain : cargo-domain
[INFO] [talledLocalContainer] domain Location: /home/agpineda/workspace/glassfish4/glassfish/domains/cargo-domain
[INFO] [talledLocalContainer] Log File: /home/agpineda/workspace/glassfish4/glassfish/domains/cargo-domain/logs/server.log
[INFO] [talledLocalContainer] Admin Port: 4848
[INFO] [talledLocalContainer] Command start-domain executed successfully.
[INFO] [talledLocalContainer] Application deployed with name cargocpc.
[INFO] [talledLocalContainer] Command deploy executed successfully.
[INFO] [talledLocalContainer] GlassFish 3.x started on port [8080]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MailConnector Resource Adapter 4.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] — cargo-maven2-plugin:1.3.2:start (default-cli) @ mailconnector-ra —
[INFO] [talledLocalContainer] Port for cargo-domain (4848) is in use. Try a different port number.
[INFO] [talledLocalContainer] CLI130: Could not create domain, cargo-domain
[INFO] [talledLocalContainer] Command create-domain failed.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] mailconnector application ......................... SUCCESS [32.192s]
[INFO] MailConnector Resource Adapter .................... FAILURE [1.596s]
[INFO] Mail MDB Reciever ................................. SKIPPED
[INFO] Mail Web Application .............................. SKIPPED
[INFO] Mail Enterprise Application ....................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.321s
[INFO] Finished at: Wed Apr 10 20:50:33 PDT 2013
[INFO] Final Memory: 8M/212M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.3.2:start (default-cli) on project mailconnector-ra: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.3.2:start failed: Failed to create a GlassFish 3.x standalone configuration: GlassFish admin command failed: asadmin exited 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :mailconnector-ra



 Comments   
Comment by shreedhar_ganapathy [ 19/Apr/13 ]

Hi Siva
Can you please take a look at this connector sample issue?
We need to resolve soon.

Comment by Sivakumar Thyagarajan [ 19/Apr/13 ]

I don't know why cargo tries to create the cargo-domain again during the deployment of the RAR. This appears to be the reason the maven invocation has failed. Requesting Dapeng to investigate.

Comment by dapeng_hu [ 24/Apr/13 ]

The mail connector project is an ear application which contains multiple sub modules: MDB, web and rar. In this case, the cargo goals should be executed in the mailconnector-ear module, instead of the parent module "mailconnector". This is a limitation of the cargo plugin.

As mentioned in the document of mailconnector "connectors/mailconnector/docs/index.html", this sample project should be built, deployed, undeployed in these steps:
1. $ cd $WORKSPACE/glassfish4/samples/connectors
2. $ mvn clean install
3. $ cd mailconnector/mailconnector-ear
4. $ mvn cargo:install
5. Add 3rd party library mock-javamail.jar in GlassFish. which is a dummy mail server. Without this library, the sample can be deployed, but do not work.
6. $ mvn cargo:start -Dglassfish.home=$WORKSPACE/glassfish4
7. $ mvn antrun:run # this goal will add some user accounts in GlassFish File realm.
8. $ mvn cargo:deployer-undeploy
9. $ mvn cargo:stop clean

Comment by Alex Pineda [ 24/Apr/13 ]

Thanks for the information on how to run the sample. Request that you transfer the information to the sample documentation (index.html file) and provide the details on the 3rd party library mock-javamail.jar and how to use it for running the sample.

However, I wonder why you want to call cargo:install. My understanding is this command will install a container distribution. I normally use "cargo: start" with "-Dglassfish.home=<GF Install Directory>" as to use the container (or server) that I install from the SDK distribution.

Comment by dapeng_hu [ 24/Apr/13 ]

[1] In the sample document, there is sections which introduce the mock javamail library, along with how to use it.

[2] Yes, the cargo:install only download the GF distribution to local host. But this sample project depends on 3rd library mock-javamail. This library should be added manually to the directory glassfish4/glassfish/lib/ before GlassFish is starting up. That is why we inset the step 5 above between cargo:install and cargo:start. Other sample projects do not have this kind of runtime dependency. So they can directly run the goal cargo:start.

Comment by dapeng_hu [ 24/Apr/13 ]

The assumption behind the my instruction is that: you use the cargo plugin to download and manage GlassFish distribution.

If you download and manage GlassFish by yourself, of cause you can skip the step 4 cargo:install and go the step 5.

Comment by Alex Pineda [ 24/Apr/13 ]

Not sure I made my point clear, but I think we're saying the same thing. As part of testing the sample, I plan to copy the mock library to the GlassFish lib directory, then invoke cargo:start. This command starts the server, creates a cargo-domain and deploys the sample. By using the -Dglassfish.home option, it will use my local GF installation. Afterwards run cargo: undeploy stop clean.

I'm assuming you have already added the instructions to the sample documentation. Just got the official (for QA) build 85 SDK builds. I will give look for the update in the index.html file.

Comment by Alex Pineda [ 24/Apr/13 ]

Which Glassfish distribution to use is a point of debate. As a QA person, I believe we should have the use use what they get through the SDK distribution. This is the reason why we're testing the product sa to make sure the SDK contents are useable and working. Some like you, want the user to get the latest from our open source repository. I understand why, but this is an option that is not tested daily or continuously. Again, we have a difference in opinion. Our PM has the final word on this option.

Comment by dapeng_hu [ 24/Apr/13 ]

In the pom.xml of top-most parent project, there is property as follows:
<cargo.maven.containerUrl>http://javaweb.us.oracle.com/java/re/glassfish/4.0/promoted/b85/archive/bundles/latest-glassfish.zip</cargo.maven.containerUrl>

This is where cargo plugin will download the GF distribution. So far, this URL address point to the latest GF available. And the value of this property is updated for each new build. But I guess it finally will be a stable version after GF4.0 is officially published.

Moreover, this property is shared by all sample projects, other sample project also use cargo to download and manage GF by default (not only me _). I guess this is because the sample projects can be shipped standalone (perhaps will be here: https://java.net/projects/glassfish-samples/downloads). If users only download the samples without GlassFish, this will save their time to install GlassFish and quickly start to play with the samples.

By the way, to suppress the warning message as you mentioned, I will add version for maven-rar-plugin and maven-jar-plugin in the pom.xml of mailconnector-rar module.

Comment by dapeng_hu [ 24/Apr/13 ]
  • What is the impact on the customer of the bug?
    In the pom.xml of sample project mailconnector-rar, the version number of plugin maven-rar-plugin and maven-jar-plugin are not specified.
    Maven will print out warning messages as follows when it loads the pom.xml.

[WARNING] Some problems were encountered while building the effective model for org.glassfish-samples:mailconnector-ra:rar:4.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-rar-plugin is missing. @ line 86, column 17
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 71, column 17

This problem has no impact on CTS, security, performance, etc.

  • What CTS failures are caused by this bug?
    None
  • What is the cost/risk of fixing the bug?
    None
  • How risky is the fix? How much work is the fix? Is the fix complicated?
    The fix is quite straightforward: add version number for plugin maven-rar-plugin and maven-jar-plugin in pom.xml.
  • Is there an impact on documentation or message strings?
    None
  • Which tests should QA (re)run to verify the fix did not destabilize GlassFish?
    None
  • Which is the targeted build of 4.0 for this fix?
    b86
  • If this an integration of a new version of a component from another project, what are the changes that are being brought in?
    None
Comment by dapeng_hu [ 28/Apr/13 ]

Move plugin version definition to top level pom.xml

Comment by Alex Pineda [ 01/May/13 ]

I went the instructions as noted in this report and what came with sample. The steps worked as mentioned and documented, however, when I tried to build the javamail mock library, I got a build error. The exact steps that I followed are:

o [test@wolfrun] $ cd $TEST/glassfish4/samples/connectors
o [test@wolfrun] $ svn checkout https://svn.java.net/svn/mock-javamail~svn/trunk/mock-javamail
Checked out revision 92.

o [test@wolfrun] cd mock-javamail
o [test@wolfrun] mvn clean
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

o [test@wolfrun] $ mvn install
[WARNING] Some problems were encountered while building the effective model for org.jvnet.mock-javamail:mock-javamail:jar:1.12-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-idea-plugin is missing. @ line 71, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 64, column 15
[WARNING] 'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 114, column 15
[WARNING] 'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-jxr-plugin is missing. @ line 117, column 15
[WARNING] 'repositories.repository.layout' for java.net uses the unsupported value 'legacy', artifact resolution might fail. @ line 35, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building JavaMail mock objects 1.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.716s
[INFO] Finished at: Tue Apr 30 17:07:38 PDT 2013
[INFO] Final Memory: 5M/149M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project mock-javamail: Could not resolve dependencies for project org.jvnet.mock-javamail:mock-javamail:jar:1.12-SNAPSHOT: Failed to collect dependencies for [javax.mail:mail:jar:1.4 (compile), junit:junit:jar:3.8 (compile)]: Failed to read artifact descriptor for javax.mail:mail:jar:1.4: Could not transfer artifact javax.mail:mail:pom:1.4 from/to internal-glassfish-nexus (http://gf-maven.us.oracle.com/nexus/content/groups/internal-gf-nexus/): No connector available to access repository internal-glassfish-nexus (http://gf-maven.us.oracle.com/nexus/content/groups/internal-gf-nexus/) of type legacy using the available factories WagonRepositoryConnectorFactory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/DependencyResolutionException

Comment by Alex Pineda [ 01/May/13 ]

Re-opening bug, although, I'm aware that this issue is not a product issue. Is more of missing instructions or configuration that is probably missing in the sample documentation.

Comment by dapeng_hu [ 01/May/13 ]

This is an issue of pom.xml of the project mock-javamail. The fix is as follows:

Index: pom.xml
===================================================================
— pom.xml (revision 92)
+++ pom.xml (working copy)
@@ -27,7 +27,7 @@
<archive>http://java.net/projects/mock-javamail/lists/users/archive</archive>
</mailingList>
</mailingLists>
-
+ <!--
<repositories>
<repository>
<id>java.net</id>
@@ -41,7 +41,7 @@
<layout>default</layout>
</repository>
</repositories>
-
+ -->
<distributionManagement>
<snapshotRepository>
<id>jvnet-nexus-snapshots</id>
@@ -86,7 +86,7 @@
</configuration>
</plugin>
</plugins>
-
+ <!--
<extensions>
<extension>
<groupId>org.jvnet.wagon-svn</groupId>
@@ -94,6 +94,7 @@
<version>1.6</version>
</extension>
</extensions>
+ -->
</build>

<dependencies>

I have created a new issue on JIRA to keep track of the issue: https://java.net/jira/browse/MOCK_JAVAMAIL-12

Comment by dapeng_hu [ 01/May/13 ]

The mock-javamial's issue will be tracked by another issue: https://java.net/jira/browse/MOCK_JAVAMAIL-12

Comment by michael.y.chen [ 01/May/13 ]

Does this mean the connector sample still fail to deploy / build?

The mock_javamail is a project no one is actively working on, I am pretty sure we won't get a fix for it in next week. We are 1 week from our last build, we either need to find another solution to work around the mock_javamail problem, remove usage of mock_javamail, or remove this connector sample. We can't ship the broken sample.

Comment by dapeng_hu [ 02/May/13 ]

That is an easy issue. I have found the fix for it. Please give me a chance to solve it.

Comment by dapeng_hu [ 03/May/13 ]

Because it involves a few tricks to build the mock-javamail project. The mock-javamail library is added in the connector sample project. So user and tester can directly deploy the library and do not have to download/build the mock-javamail project. The deployment instruction in the sample document has been updated too.

Comment by dapeng_hu [ 03/May/13 ]

Code change has been submitted.

Comment by Alex Pineda [ 14/May/13 ]

I was able to run the sample using the mock_javamail jar file that is now included in the SDK samples distribution. All the instructions work as documented, however, there's one small minor issue. The instructions says go to "samples_install_dir/javaee7/connectors", however, the correct directory is just "samples_install_dir/connectors". Would it possible to update the document in the next build. If it's too risky, then not a problem. I'm sure any intermediate or advance user will figure this out.

Re-opening the issue to see what can be done if anything.

Comment by Alex Pineda [ 14/May/13 ]

Request to see if the sample instructions can be updated to resolve an issue on the location of the sample. Not a major issue if the fix is too risky.

Comment by dapeng_hu [ 14/May/13 ]

Good catch, I am fixing it.

Comment by dapeng_hu [ 14/May/13 ]

The directory error in the sample document has been fixed.

Generated at Sun Apr 30 08:17:25 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.