Turning Annoyances into Wonders Since Tuesday

Ken Fogel

Subscribe to Ken Fogel: eMailAlertsEmail Alerts
Get Ken Fogel via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Related Topics: Intel XML, XML Magazine, MySQL Journal

Blog Feed Post

Is Eclipse Faster than Netbeans for Arquillian Testing on a Remote GlassFish Server?

The following is a description of what I needed to do and how I felt about it to determine if Eclipse is any faster than NetBeans. I am a long time user of both IDEs and I admit to favouring NetBeans. Last year I used Eclipse at Dawson College to teach web development with JSF and JPA using Arquillian on TomEE. This year I am using NetBeans and GlassFish. This blog can also be subtitled:

How to Get a NetBeans Maven Project Running on Eclipse

I am working on a problem concerning the time it takes to test a web application on a remote Glassfish server using Arquillian and NetBeans. In doing my due diligence by searching on Google I occasionally come across the unhelpful answer that suggests I should use Eclipse. I have used Eclipse for years but I prefer NetBeans in the classroom. Nevertheless I decided to run my test with Eclipse.

The first step was to download the latest version, Luna 4.4.2. As has always been the case, Subversion is not supported without a plug-in. In the past I used Subclipse from Tigris. The Google search showed me that Subversive is now the ‘official’ plugin for Subversion. It even had a drag and drop icon for installation. I dragged and dropped and this happened:


WTF? As I have no idea if this is significant or not I answered Yes. Something installed.

Using File->Import I did have a Subversion choice but when I selected it I had to choose which connector to use. I picked the most recent for Windows 64bit. When I tried to access the repository it failed. Being a long time Eclipse user I knew what to do. I closed Eclipse and started it up again. Now I could connect to the repository and I selected the project.

Eclipse does not know what to do with a Maven project. I thought the answer was obvious, open it as a project. Instead I am confronted with four choices, the last of which is to open it as a project. With this done the project downloaded from the repository and an invalid project appeared in the workspace. This I expected. I right clicked on the project and selected Maven->Convert to Maven Project. The next step is to right mouse click again and select Maven->Update Project.

When it finished the update it declared that my pom.xml had two invalid sections. These were generated by NetBeans so I just commented them out. It also did not like my beans.xml file so I just deleted everything in it and saved it as an empty file because it only needed to be there to turn on CDI. My first attempt at compiling failed because Eclipse defaulted to the JRE folder but that was an easy fix. Then success, I had a war.

The next problem is that Eclipse does not know GlassFish. It does allow you to select an alternate server for which the plugin will be installed but GlassFish is not on the list. So back to Google and I found GlassFish Tools for Luna. It showed support for 4.0 and 3.1 but I suspected 4.1 will be fine. It also had an install icon and so I dragged it over and installed it.

Ok, let’s go! I go to the Servers tab just below the edit window and I can now add GlassFish. I fill everything else in and then when it comes time to add the project to the server I get the ‘cannot bridge runtimes’.

A stack overflow site suggested a solution, http://bit.ly/1aLA30Q. I did as instructed and added a line to the asenv.bat file but no change. I then took a different tack and went to the workspace properties and selected the server there. I could do this without any problems. My first attempt at running my code failed because it could not find the domain. Back into the Server properties and I pointed GlassFish to the same domain (domainA rather than domain1) that I used in NetBeans. In the Server tab below the editing window I added GlassFish and started it successfully. Hooray!

Spoke too soon. While I was about to Run on Server, a dialog box popped up informing me that GlassFish took too long to start and therefore did not start. Despite this I still went ahead and did a Run on Server. The result was that it started GlassFish again but hung for a few minutes before it displayed the following dialog.


Next I pointed GlassFish to its original domain1. I received all new errors and they referred to domainA. So it’s back to close Eclipse and restart Eclipse. It started up with an error about deploying the project. I deleted the server and put it back. This was probably all I needed to do rather than restart Eclipse because the new server I put back had the correct domain.

I looked at my display and I got excited. It showed that GlassFish had started! Now for a Run on Server. This appeared.


I figured this one out quickly. NetBeans deploys the MySQL driver to the server but Eclipse does not. So I copied mysql-connector-java-5.1.23-bin.jar into the domain’s lib folder. I restarted GlassFish and tried again. This is what I got.


Close Eclipse and start Eclipse. No Change.

I decided that I needed to know if the problem was the war file. Within Eclipse I opened the GlassFish admin application and manually deployed the application that was in the target folder of the project. GlassFish allowed me to point the server at the folder in project’s target folder that contained the compiled code. I could also point at the war file. What I noticed in both cases was that the name of the application did not match the project name.

  • Project was called JPAGlassFish03.
  • When pointing to the folder it became JPAGlassFish03-0.0.
  • When pointing to the war it, called JPAGlassFish03-0.0.1-SNAPSHOT

The good news was that once deployed though the domain console I could access the application through the browser using the deployed name. The admin console also allowed me to change the name of the application to whatever I wanted.

Oh, wait a minute. By renaming the context and application it no longer shows up in the list of applications in the admin display. It appears in a branch below Applications but by not being on the Applications screen there is no way to get rid of it. False alarm, I just needed to click on the Deploy button and the application appeared in the list and so I undeployed it.

Back at Eclipse it continued to fail with “the deploy is failing” error. I noticed that the project was showing as deployed. So I removed it by right clicking on it and did one more Run on Server. It finally worked. Conclusion, after adding the missing mysql jar I needed to remove the project from the server. Finally I can try Arquillian.


The Arquillian tests ran without any issues. The first run took 54 seconds and the second run took 1 min and 28 seconds doing the same test. This is almost exactly the same performance as on NetBeans. Therefore Eclipse does NOT run Arquillian tests on a remote server any faster or slower than NetBeans.

It only took two and a half hours to come to this conclusion. Part of this time was spent writing this blog.

The solution to the time problem? Ignore the best practice of always testing on a remote server in a classroom situation and test with the embedded Glassfish server. Tests take less than 20 seconds.

Remote Server:

Running com.kenfogel.test.FishActionBeanTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, 
Time elapsed: 84.87 sec - in com.kenfogel.test.FishActionBeanTest

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

[INFO] -----------------------------------------------------------
[INFO] -----------------------------------------------------------
[INFO] Total time: 01:28 min
[INFO] Finished at: 2015-03-04T12:52:23-05:00
[INFO] Final Memory: 10M/245M
[INFO] -----------------------------------------------------------

Embedded Server

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

[INFO] -----------------------------------------------------------
[INFO] -----------------------------------------------------------
[INFO] Total time: 15.230 s
[INFO] Finished at: 2015-03-04T12:53:56-05:00
[INFO] Final Memory: 10M/245M
[INFO] -----------------------------------------------------------

Read the original blog entry...

More Stories By Ken Fogel

In 1980 I bought for myself the most wonderful toy of the day, the Apple ][+. Obsession followed quickly and by 1983 I was writing software for small and medium sized businesses in Montreal for both the Apple and the IBM PC under the company name Omnibus Systems. In the evenings I taught continuing education courses that demystified the computer to the first generation of workers who found themselves with their typewriter on the scrap heap and a PC with WordStar taking its place.

In 1990 I was invited to join the faculty at Dawson College in the Computer Science Technology program. When I joined the program the primary language was COBOL and my responsibility was to teach small systems languages such as BASIC and C/C++.

Today I am now the chairperson and program coordinator of the Computer Science Technology program at Dawson. The program's primary language is Java and the focus is on enterprise programming.

I like to write about the every day problems my students and I face in using various languages and platforms to get the job done. And from time to time I stray from the path and write about what I plan to do, what I actually get around to doing, and what I imagine I am doing.