Matt RaibleMatt Raible is a Java Champion and Developer Advocate at Okta. developer.okta.com

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

RE: Five things I hate about AppFuse

Karsten Voges has written a nice critique of AppFuse titled Five things I hate about AppFuse. I started a new JSF+Hibernate project with AppFuse yesterday, so I definitely feel some of his pain. Let's examine his points one-by-one:

1. It's nice to choose between the usage of JSP 2.0 or before, but making the changes (to all jsps and the web.xml) every time I build my app sucks.

I absolutely agree. I spent a good hour modifying build.xml, web.xml, etc. to switch my app from JSP 1.2 to JSP 2.0 yesterday. You can modify your build.xml to permanently switch to JSP 2.0, but it doesn't get everything. I'll create a separate script for 1.9.3 and the upcoming 1.9.4 to make this cleaner.

2. Seperating the classes in web, services and dao is good, but I hate the building of jar-Files for the different layers. Just take the classes under dao and service and copy them into the war or move them over to the webapps folder as it is done with the web classes!

Yeah, I've proposed doing this a couple of times on the user mailing list. It always gets shot down by existing users. I'm sure it'd be possible to write a script to do this, but it'd be no fun to write.

3. Eclipse crashed with OutOfMemory errors. Always when trying to open the build file. The build file is really, really long, with lots of stuff in there. IMO 50% of it could be deleted.

Hmmm, I rarely have OOM errors with Eclipse, but I also used Bruce's tip for increasing Eclipse's available memory. If you're using Windows, here's how to bump up Eclipse's memory.

4. Generation of Hibernate-Mapping files. I really hate it to look within a jarfile how the Hibernate mapping file looks like. It is nice to get it generated, but I prefer to be able make adjustments to it by hand to try out things quickly. And it is quite hard to enter special SQL statements in an Hibernate file, if it gets overwritten all the time.

You can create/modify the Hibernate mapping files by hand if you prefer. From the FAQ:

If you have an @hibernate.class tag on a POJO - hibernatedoclet will generate the mapping file into build/dao/gen. If you have a mapping file (*.hbm.xml) file for your POJO in the src/dao/**/model/* directory, it will overwrite the generated version. If you don't want to worry about the two conflicting - just remove the @ sign from @hibernate.class in your POJO and put your hbm.xml file in the model directory.

No build.xml modification are need for this to work. The "package-dao" target will include these mapping files. If you want to get rid of the hibernatedoclet process, you can do that- but make sure and run it first - and then copy all of the generated hbm.xml files into your model directory.

5. I don't like to get my struts.xml merged from many sources. I like to have one struts-config file holding all my struts configuration.

I agree this is kinda painful, but so is developing with Struts. ;-) You should be able to move the generated struts-config.xml into web/WEB-INF and remove the <strutsconfigxml> from build.xml to get the behavior you're looking for.

As far as throwing out the build.xml, I'm actually planning on doing that with my current project. I will keep it in place for the development phase, but I hope to move the application into a large build system once I'm done. Since it's all Java code and XML in the end, this shouldn't be hard to do. I did it when migrating to Maven 2, so I know it's possible. As far as Karsten's opinion of Maven 2, he may be right - but I hope to make a strong effort to make it very useable when using AppFuse. In fact, I hope to make it possible for users to use their IDE their entire time, with no need to run any Maven commands. Of course, that could be a pipe dream - only time will tell.

As far as sounding like the BileBlog, the more you rag on AppFuse, the better. Remember, screaming users are a good thing.

Posted in Java at Oct 06 2006, 08:03:58 AM MDT 10 Comments
Comments:

Wow, this is what I call a fast and great response. I updated already my blogentry with a response to the response ;)

Posted by Karsten Voges on October 06, 2006 at 08:22 AM MDT #

Ok, so I'll scream:

Yeaaargh! Appfuse is STILL complicated for a new user. I've been developping in Java for 4 years (but only local applications).

The tutorial begins nicely with all the DAO/Hibernate and Junit stuff, and then Managers, but I have a hard time finding how to remove the address and other things in user account creation. If i put "not null = false" for the Hibernate tags is it enough? will it break things?

In a page (jsp or action?), how do I know if a user is connected, and who? How do I make proper navigation between pages (ie multi pages account creation) How can I use Eclipse Spring or Hibernate plugins to automatize class writing (4 classes for each object, with the test classes, can it be done automatically?)

(don't answer, it's just user screaming ;) I'll find it by myself but I still don't know when)

Maybe it's basic knowledge, maybe I should find it in spring mvc or struts but this would'nt be "appfuse-the-easy-way" :)

I'll add that for 1 user screaming there may be some users who are too lazy/shy and will say "that's not for me" instead of asking how to do it...

Anyway, thanks for Appfuse, I'll try to go on until i master it...

Posted by Xuelynom on October 06, 2006 at 08:54 AM MDT #

Wow...sure, there are snags, but AppFuse has been a great boon to my development. I think those are minor points...

Posted by Dan on October 06, 2006 at 08:59 AM MDT #

I agree with Dan, Appfuse and Equinox are great boon for lightweight container application developper. Ranti si good, contribution is better :) So far i have no rant for appfuse and look forward next release hot updates ;)

Posted by Sylv20 on October 06, 2006 at 09:11 AM MDT #

Karsten - I tried to leave a comment on your blog re: your OOM, but got an error. Here's what I wrote:

As far as Eclipse, you might try bumping up your memory in JAVA_OPTS or ANT_OPTS. Mine are set as follows:

$echo $ANT_OPTS
-Xms512M -Xmx756M -XX:MaxPermSize=256M

$echo $JAVA_OPTS
-Xms384M -Xmx512M

Posted by Matt Raible on October 06, 2006 at 10:38 PM MDT #

Ok - I'll add one... I've never been able to easily debug AppFuse apps running under tomcat. I'm sure it's a configuration thing, but I would love a clear set of instructions that will let me point my tomcat at my instance in Eclipse so that when I make changes to the controller, it is automatically built on save and I can see the changes running in the webapp. Has anyone had any luck with this? Any advice would be much appreciated... Thanks, Ray

Posted by Ray Grieselhuber on October 19, 2006 at 03:01 PM MDT #

It's pretty easy to debug any application in Tomcat. Here's a quick set of instructions:

1. Start Tomcat in debug mode by running "$CATALINA_HOME/bin/catalina.sh jpda run".

2. In Eclipse, go to Run > Debug. Choose "Remote Java Application" and click the + icon in the top left.

3. Name your configuration, select your project, make sure the Source tab is configured to point to your project, then hit "Debug" and you should be good to go!

These instructions should be very similar for IDEA, NetBeans or any IDE.

Posted by Matt Raible on October 19, 2006 at 03:27 PM MDT #

Good remarks,

I think it would be beneficial if more people submitted Best Practices, Tutorials, flagship websites that run on appfuse.

In this way newbies can have more guidance.

As good as Matt's tutorials are, it would be nice to have more advanced topics, troubleshooting etc.

Given the amount of time Matt already spends supporting appfuse, I think its up to the community to help out here.

Larry

Posted by Larry on October 20, 2006 at 04:25 AM MDT #

Appfuse takes a good concept and poorly implements it. The purpose of programming is to take a complex process and to simplify it. You push a button (simple) and you get functionality (complex). As programmers interfaces to our programs should be clean and simple. I enter a command and It should work. Too many parameters creates a big mess. Maven2 sucks and will always suck. Maven2 = Over-Engineering at it's best!

Posted by testme on December 19, 2007 at 05:04 PM MST #

testme - I like how you provide no foundation for your "Maven2 sucks" argument. Is Ant better? What do you recommend? If you were in charge of AppFuse's implementation - what would you do?

Posted by Matt Raible on December 19, 2007 at 05:12 PM MST #

Post a Comment:
  • HTML Syntax: Allowed