Adam Bien's Weblog

Five Days With Netbeans6.8m1, JSF20, EJB31, Maven and Glassfish v2/v3 ...And The Result

NetBeans 6.7.1 worked well for me, even the new Java EE 6 stuff can be used after some tweaks. Netbeans 6.8m1 supports Java EE 6 out-of-the-box, so I switched some projects and worked intensively with it. Conclusion:

  1. Glassfish v3 integration is stable and fast. "Deploy On Save" works surprisingly well. EJB 31 + JSF 2.0 + REST takes significantly less, than a second (tested on different machines).
  2. WAR EJB deployment works.
  3. Java EE 6 is tightly integrated: JavaDoc, JPA 2.0, EJB 3.1, BeanValidation, JSF 2.0 are already available. 
  4. Code Completion for JSF components in HTML-editor works as expected - with JavaDoc.
  5. @ManagedBean, @RequestScoped annotations are already in classpath and can be directly used. Dependency Injection of no-interface views into managed beans works. 
  6. Page flow editor is available, but seems only to visualize the faces-config.xml. 
  7. No fiddling with libraries or plugins. Everything is well integrated - Java EE 6 API are already included. 
  8. JDBC driver deployment and installation from Netbeans to Glassfish v3 works, as well as DataSource / ConnectionPool creation.
  9. Tester for REST-ful services works. EJB 3.1 can be exposed as REST-resources at the same time.
  10. Maven is well integrated. You can either create "native" Netbeans projects (=ant), or Maven with archetypes.

I used Netbeans 6.8m1 also for some Java EE 5 + Glassfish v2.1 production projects with Maven. I just migrated the project groups from Netbeans 6.7.1 and developed them further with 6.8m1. It worked without any problems.

In one case I re-opened Netbeans 6.8m1 with many Maven projects, and Netbeans reported "Slowness Detected" (AWT-Thread blocked for longer than 5s...) and opened an issue/bug in the Netbeans Bug Tracking system for me. 

I switched entirely from 6.7.1 to 6.8m1 - let see what happens :-). 


NEW workshop: Microservices with Java EE 7 and Java 8, January 26th, 2015, Airport Munich

A book about rethinking Java EE Patterns

Comments:

Can you please comment on Java EE6 development as Maven project(s) in NetBeans 6.8m1?

Posted by Ryan de Laplante on August 09, 2009 at 07:09 PM CEST #

Sun says they will be supporting Java EE6 Maven projects in NB 6.8

http://forums.netbeans.org/viewtopic.php?p=44315

Posted by Ryan de Laplante on August 09, 2009 at 11:20 PM CEST #

@Ryan,

I only used NB 6.8 with Java EE 5 Maven projects and created some Java EE 6 POCs in the old (=ant) way. I assume Maven will work too - in worst case you will have to add some additional libraries...

Posted by Adam Bien on August 09, 2009 at 11:53 PM CEST #

why are so many people using Maven? This is typical bloat crap. What's the matter with the NetBeans build script? Not complicated enough? I know, I know, "but the Maven script isn't complicated" -- (that is, until you actually need to use it to do something).

And why do I have to learn it? What about learning CUDA or JavaFX or even better, studying algorithms or OLAP/MDX, numerical analysis, liquid state machines, I can think of about 100 things that are many many orders of magnitude more useful than another XML build tool -- oh but I guess if 1.5 million Java developers (not computer scientists, 'developers') think it's great, then we gotta get that in the build! I mean, their opinion counts, right? Isn't that the reason? Since their bosses are 5 times more clueless, right? So if billy wants tv dinners, I guess we're all eating tv dinners!!!

Posted by anon on August 10, 2009 at 12:53 AM CEST #

I switched to maven in the current project. I used to be skeptic now I love it.

It only took me a few hours to figure it out and run with it, so there I don't think that the learning curve is as steep as learning OLAP\MDX.

Its just another build tool, if you don't like it you can stick with javac.

Posted by Faisal on August 10, 2009 at 09:44 AM CEST #

@Anon,

sometimes I use maven and sometimes not: http://www.adam-bien.com/roller/abien/entry/maven_vs_ant

Btw. learning Java FX is actually a very good idea - its fun!

Netbeans build-script is complicated (=generic) - but you don't have to understand it. Btw. you can work with any ant-script you want as well. But: it isn't a Netbeans 6.8m1 feature - it is already possible for ages...
Thanks for the bitter comment - it seems like someone forces you to use maven :-),

regards,

adam

Posted by Adam Bien on August 10, 2009 at 01:26 PM CEST #

Well, his comment was not really about how difficult it is to learn, but why should I learn it? What can it do, that we can't do "the old way"?

Posted by mohamz on August 10, 2009 at 01:26 PM CEST #

@Mohamz,

I'm not a maven fanboy. Here is my opinion: http://www.adam-bien.com/roller/abien/entry/maven_vs_ant.

Shortly: if you need modularization - maven is the way to go. If your are developing individual software, without any needs for modularization - you can take whatever you want.

"Well, his comment was not really about how difficult it is to learn, but why should I learn it?"

In my opinion: it is always good thing to learn something new - this time is never lost. ...and it is lot of fun!

Just be pragmatic!,

thanks,

adam

Posted by Adam Bien on August 10, 2009 at 06:18 PM CEST #

". If your are developing individual software, without any needs for modularization "

You seem to imply that without Maven, the code isn't modular. The NetBeans source code base is over 1.8 GB (resources and all) and it uses no Maven to build. The NetBeans approach is to create modules and each module exports a public API using the manifest. GUI logic is pluggable via layer.xml files. This is a level of modularity that continues to be available at runtime enabling dynamic pluggability.

Java supports the SPI "Service Provider Interface" used for example in JPA.

None of this requires Maven.

And finally, no, it may not always be good to learn something new, because of the lost opportunity costs associated with not having learned something better. There are an infinite amount of things to learn, and not everything is equally useful or helpful down the road.

Posted by anon on August 11, 2009 at 12:11 PM CEST #

@Anon,

it is easier to build separated modules with maven, than without - if you are starting from scratch. I don't think that learning maven is not a good investment. However: none of my kenai projects (http://kenai.com/projects/javaee-patterns/) are maven based - all are "native" netbeans :-).

And: java.util.ServiceLoader rocks. See also: http://www.adam-bien.com/roller/abien/entry/eclipse_rcp_vs_netbeans_rcp

btw. anon is an interesting name. She (http://www.anon-music.com/) was a D.J. at the last two JavaONE conferences :-)

Posted by Adam Bien on August 11, 2009 at 12:26 PM CEST #

Adam,

first, I'm happy to hear everything works for you. That's good.

Now when you say "Page flow seems only to visualize the faces-config.xml" what do you mean by that? What else would you expect it to visualize? Please elaborate.

Thanks, David

Posted by David Konecny on August 12, 2009 at 01:48 AM CEST #

@David,

I used page flow in the past all the time. For my POC I didn't used that, because I entirely relied on direct binding to action-methods. Page flow just didn't visualized anything.

It would be nice to visualize the flow without having XML - but it isn't possible without looking into the managed bean code.

Sorry for the confusion. If you are working on Java EE 6 support - kudos to you. I was really surprised by the quality of the 6.8m1 release.

thanks!,

adam

Posted by Adam Bien on August 12, 2009 at 09:47 PM CEST #

Please dream team appply those dreams.

For netBeans performance issue in 512mb ram or to work more faster is it possible to apply a special option to switch only editor mode? Very very advanced coders with only autocompletes supports.
- http://notepad-plus.sourceforge.net/commun/screenshots/scrsh_notepadLookFeel.png

Is that possible to add code folding under line?

- http://notepad-plus.sourceforge.net/commun/screenshots/scrsh_multiView.gif

Is it possible to apply zoom in , zoom out?
- http://notepad-plus.sourceforge.net/commun/screenshots/scrsh_zoom.gif

Is it possible to apply code indent for switch, select, elseif, else, (, { , [ , case
- http://notepad-plus.sourceforge.net/commun/screenshots/scrsh_braceIndentGuideHiLiting.gif

Is it possible to apply ADA language syntax?

Posted by shamun on August 25, 2009 at 10:23 PM CEST #

Hi Adam,

I created "Maven Enterprise Application" that runs on GlassFish v2, with this structure :
pom.xml
/ejbnb68-ear
/ejbnb68-ejb
/ejbnb68-web

But I can not "run" the ear from Netbeans on GlassFish v3. And I got this message :

"java.lang.IllegalArgumentException: Expected to find an expanded directory for submodule ejbnb68-ejb-1.0.jar but found a JAR. If this is a directory deployment be sure to expand all submodules."

Posted by Bakann on August 31, 2009 at 09:22 PM CEST #

@Bakann,

you created? Actually it is created by netbeans with the provided archetypes. Could you try that, or reopen an existing maven project?

adam

Posted by Adam Bien on September 01, 2009 at 12:47 AM CEST #

Hi Adam,

Sorry I forgot to type 'a' before "Maven Enterprise Application". This is indeed created by Netbeans since 6.7 and I really enjoy it!
Well I just wonder myself how you could deploy a "Maven Enterprise Application" into GlassFish v3 and if it was possible directly from Netbeans.

Posted by Bakann on September 02, 2009 at 01:46 PM CEST #

Hello Adam,
I have the same problem as Bakann. After creating an empty Maven Enterprise Application from New Project Wizard (NetBeans 6.8m1) I can deploy and run the web module, but when I click 'Run' on the ear module, I get this error:

"java.lang.IllegalArgumentException: Expected to find an expanded directory for submodule ....."

I suppose that the netbeans deployment module extracts my .ear file and expects class files and directory structure, but it finds another archive (my-ejb.jar) and stops. Do you know how to fix this or report as an IDE defect?

Posted by ChrisC on September 13, 2009 at 02:07 PM CEST #

Hello there again,
I found a solution for the problem described above.

It seems that glassfish deployment module cannot deal with archives packed into archives (e.g. .jars in .ears), so one has to explicitly define that all the submodule class files should be unpacked.

Open the pom.xml file in your ear project and add <unpack> tag to each submodule:
---------------------------------
<webModule> <groupId>group</groupId> <artifactId>artifact</artifactId> <contextRoot>/context</contextRoot>
...
<unpack>true</unpack>
...
</webModule>

<ejbModule>
...
<unpack>true</unpack>
...
</ejbModule>
---------------------------------

Clean and rebuild your projects and your enterprise application will deploy and run smoothly.

Cheers,
Chris

Posted by ChrisC on September 20, 2009 at 03:18 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
License