Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

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.

[ANN] AppFuse Light 1.0 - a.k.a. Equinox

For those of you looking for an AppFuse Light, I have good news for you. I've actually been sitting on it for several months now, but now I'm prepared to release it. It's name is Equinox and it's much, much simpler than AppFuse. Equinox has only one build-time dependency (CATALINA_HOME being set for the servlet-api.jar). There's no code generation and no features - not even security. However, it supports building, testing and deploying from Ant, and even has support for managing Tomcat out-of-the-box.

To get started with Equinox, you can download the QuickStart Chapter from Spring Live. This chapter shows you how to develop a simple webapp using Struts, Spring and Hibernate - which talks to an HSQL database. Struts and Spring are integrated using the ContextLoaderPlugin and all tests are designed to be run out-of-container using JUnit and StrutsTestCase. Equinox ships with project files for both Eclipse and IDEA so you can develop and run the tests in either of these top-notch IDEs. There's also a demo available. Thanks to Boér Attila for the kick-ass CSS.

If you like what you see in the QuickStart Chapter, there's much more in the other ERP chapters of Spring Live - now available for download. Too see what's in the other chapters, checkout the Chapter Summaries.

This is a nice milestone - feels good to have made it this far. Have a good weekend!

Posted in Java at Jul 09 2004, 04:38:01 PM MDT 34 Comments
Comments:

cool, when will it be available?

Posted by Tieying on July 10, 2004 at 12:31 AM MDT #

It already is! Download and Tutorial (PDF)

Posted by Matt Raible on July 10, 2004 at 01:19 AM MDT #

Well, the CSS is not so kick-ass with Firefox ...

Posted by Lars Fischer on July 10, 2004 at 11:24 AM MDT #

Are there any plans to integrate WebWork with AppFuse ? Does it make sense to use AppFuse when you don't want to use Struts ?

Posted by Lars Fischer on July 10, 2004 at 11:31 AM MDT #

Lars - I use Firefox as my primary browser on Windows XP and Safari on OS X. The only issues I've ever seen is the instability of Firefox (sometimes doesn't render the CSS <em>at all</em>) - but this happens on a fair amount of sites. What OS/version of Firefox are you running?

As far as WebWork and AppFuse - you bet - that's planned for the next release.

Posted by Matt Raible on July 10, 2004 at 12:19 PM MDT #

I use Firefox 0.9.1 (German version) with SuSE Linux 9.1. It's only a small problem on the left side of the page. Good to hear about the WebWork support ! Just played around with AppFuse and it looks great so far. To stop misuse of your blog comments, I will sign up to the mailing list on java.net :-) Thanks for the great work ! Congratulations for not choosing another PetStore as sample app for your book, I'll subscribe Spring Live over the weekend.

Posted by Lars Fischer on July 10, 2004 at 05:41 PM MDT #

Matt, Excellent tutorial, I can wait to read the rest of the book. Hopefully I will be purchasing a subscription this week. Keep up the great work. Oh yeah, I especially appreciate the level of detail that you go to when describing the how and why you did what you did and the possible alternatives. And lastly, you have provided some great ideas of how to quickly build a poc.

Posted by Harold Neiper on July 10, 2004 at 08:21 PM MDT #

Matt -- Great news on Equinox! When does the new Logo show up on your wiki? Saw it on java.net already. Anyway, side issue but you mentioned proejct file. I'm hoping you'll keep up with the NetBeans crowd now and then as well as Eclipse & Idea. We're not as vocal a crowd, but there's a *lot* of developers using NB (and Sun One Studio), and the JavaOne session (a full house, BTW) on it showed we have some good reasons to stick with it. One great thing will be that NB 4.0 will use Ant files as it's project files. It can either read in existing ones or create them with a new project. Fully readable and modifiable. 4.0 is due later this year if I remember correctly. I plan to use Eclipese on and off, too, and keep up with what's new.

Posted by gerryg on July 12, 2004 at 06:24 PM MDT #

This is really a nice piece of work. However, one minor issue I found when creating a new project (ant new -D<em>projectname</em>) was that the Eclipse project file still had the original project name (Equinox) defined. Not a big deal, but it makes it impossible to import the new project into Eclipse if you already have Equinox loaded.

Posted by Thomas Lockney on July 13, 2004 at 02:32 PM MDT #

Gerry - new logo is on the wiki - thanks for nudge. I don't use NetBeans, and the last time I tried it I wasn't impressed. I'm sure it wouldn't be too hard to add NB project files. The main goal in having these is to allow for easy unit testing from w/in the IDE. If you want to provide the project files, I'll be happy to add them.

Thanks Tom - should be fixed in CVS.

Posted by Matt Raible on July 13, 2004 at 02:56 PM MDT #

Matt, nice work. I'm actually recommending this as a nice starting point for developing applications where I work. One question:

-Right now, this is incomplete. The programmer is expected to 'finish' the installation by completing the steps in the book. This is cool for new users, but as a project template, like AppFuse, its not so cool. Any interest in maintaining multiple versions or a script you can run to do the changes automatically?

Posted by Paul Kilroy on July 13, 2004 at 03:18 PM MDT #

Paul,

You're exactly right, there probably needs to be more "meat" to make Equinox a worthwhile starter project. What I plan to do is finishing writing 1.0 of the book and from that gain a lot of options. For instance, Hibernate, iBATIS, JDO, JDBC and (possibly) OJB for persistence options. On the web side, I'll create Struts, Spring MVC, WebWork, Tapestry and JSF options.

From there, I'd like to come up with a standard set of features for the baseline Equinox and maybe have a master build file that produces the different options. I don't know - lots of options there. I'd like to keep as simple as possible though - lightweight and easy to use (like Spring ;-).

BTW, Spring Live has links to download the different versions as you progress. These are currently branches in a CVS tree at SourceBeat. There's probably an easier way to manage these - I'm open to suggestions.

Posted by Matt Raible on July 13, 2004 at 11:22 PM MDT #

Great stuff, now i am reading the second time, and following the code building guide though the chapter. lazy i am now i get a solid idea of what a test-driver development should be. Learn alot, thank you matt. here i found some i can follow: page11. (UserDAOTest.java), assertNull(dao.getUser(user.getId())); test fail on this line(ab:59), says "ObjectNotFoundException", as i have read some pages before, a line has mentioned that spring gives exception-free hibernate usage, so i assume "return (User) getHibernateTemplate().load(User.class, id);" should return null if an entity(User) not found. But it is not, and throws exception, and lead to the unit test failure. page 25: 5. . the "class" should be "org.appfuse.sevice.impl.UserManagerImpl", although this will never be used , it is wrong. --- Another interesting setting is the hsqldb url string "jdbc:hsqldb:db/appfuse": both the running under Tomcat and during Unit Test have the same url string. but actually they are relatively placed in two different folder. A single hibernate.properties will make good demo usage of this trick. ^_^ best regards.

Posted by Akar on July 16, 2004 at 07:51 AM MDT #

Akar,

If you use getHibernateTemplate().get() instead of getHibernateTemplate().load() - it will return null if no record is found. On the other hand, getHibernateTemplate().load() will throw an exception if nothing is found. In Chapter 5, I change this to throw a DataAccessException which is a bit cleaner.

Page 25 should be fixed, but I'll make sure. To solve the last problem, start Tomcat from the "myusers" source folder, then the unit tests and Tomcat will create the database in the same location. There was no easy way to do the in-memory database thing w/o putting HSQLDB code specifically in the project. I didn't want to require HSQL and I didn't want to make users install a database - so this seemed like the easiest solution.

Posted by Matt Raible on July 18, 2004 at 03:49 AM MDT #

Stupid i am, thank you for ignore my last comment. I am !WRONG! on the usage of hibernate's session.load and session.get methods, Matt's book again demo me the diffference between and the right use of these two. according to Hibernate's refercence docs, get(*) returns null if ObjectNotFound. load(*), throws unrecoverable Exception on entity not found, that why get(*) is used in dao's getUser(id) and load(*) is used in dao's removeUser(id), I just overlook last time.

Equinox(myusers) doesn't have a Base*Test class for web pacakge, so i create this as practice following BaseDaoTest, some differences is on the Log object that created in this base class can be used on all its subcalsses and as well as ctx to become static .

public class BaseWebTest extends TestCase {
    public static final String[] paths = { "/WEB-INF/applicationContext.xml",
    										"/WEB-INF/action-servlet.xml" };

    protected final Log log = LogFactory.getLog(getClass());
    protected static XmlWebApplicationContext ctx = null;

    public BaseWebTest() {
        try {
            setUp();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    protected void setUp() throws Exception {
        super.setUp();
        if (ctx == null) {
            ctx = new XmlWebApplicationContext();
            ctx.setConfigLocations(paths);
            ctx.setServletContext(new MockServletContext(""));
            ctx.refresh();
        }
    }

    protected void tearDown() throws Exception {
        super.tearDown();
        ctx = null;
    }
}
<p/> best regards

Posted by Akar on July 18, 2004 at 04:04 AM MDT #

matt, like the look of this product. i'm planning to give it try for my next implementation but i have a restriction to use tomcat 4.1.x. any pointers or pitfalls?

Posted by ron on July 28, 2004 at 09:14 PM MDT #

Great. I just make it run under Oracle into 5 minutes. Matt, new with that kind of technology and i have a little problem. When you reload the app, the APP_USER table is emptied. So how can i keep my data? Thanks

Posted by JMi on August 08, 2004 at 10:44 AM MDT #

Oops sorry, just remove <prop key="hibernate.hbm2ddl.auto">create</prop> from applicationContext.xml

Posted by JMi on August 08, 2004 at 09:56 PM MDT #

I sent the following to Matt via email. Can anybody help me? Matt, I've downloaded your sample chapter 2 from spring live along with equinox and I'm having some trouble. I made it to the struts part and now it doesn't seem like the Struts action servlet is reading my struts-config.xml. I keep getting the same error "Invalid path '/user' requested" and I can't figure it out. I've tried running my debugger through the 3rd party libs but I cannot seem to find the matching source for your version of struts. I downloaded version 1.1 from Jakarta but it doesn't line up in the debugger. (I'm using Eclipse for development.) I'm at my wits end and I don't know where else to turn. I spent my last 3 entire work days trying to figure this stuff out to no avail. So far I've updated the StrutsTest jar with version 2.1.2 built directly from the source just so I could follow the debugger through the MockStrutsTestCase class. I've tried intentionally coding an XML error in the struts-config.xml to see if that would cause a different error but it didn't. While running the tests in Eclipse TestRunner plugin I did notice that the web folder was not in my TestRunner classpath however, adding it made no difference. I tried running the Ant test target from the command line outside of Eclipse and I still get the same error. Could you please lend some guidance? I thank you in advance.

Posted by Cliff on August 13, 2004 at 07:47 PM MDT #

Hmm, looks like I missed a few comments.

Ron - you'll have to change a few things to get it working under Tomcat 4.1.x. Equinox uses a Servlet 2.4 web.xml and JSP 2.0 - so you'll need to revert to a different DTD in web.xml and change all ${...} to <c:out value="${...}"/>.

Cliff - if you're still having issues, shoot me an e-mail: mattr [at] sourcebeat.com.

Posted by Matt Raible on August 25, 2004 at 03:37 AM MDT #

Can`t get over page 32 of spring live tutorial - running 'ant test' fails with following error: [junit] org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userDAO' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,transactionManager]; Root of BeanFactory hierarchy. (most important part of long error message).

The problem ocures when ctx.getBean("userDAO"); is called in UserDAOTest.java file. In my applicationContext.xml file is that bean with id="userDAO" defined according to tutorial. Any suggestion why i can`t get those tests running? (ant 1.6.2, tomcat 5.0, jdk 1.4.2).

The whole concept of java webbased development is new for me and so is java (a bit :). I don`t know what i am doing, but i thought this tutorial will help me start (hence i`ll get through this error).

Posted by Roman on August 27, 2004 at 03:46 PM MDT #

Hello, I'm a newbie with Tomcat. I'm working with version 4.1 (no choice...). I did what Matt Raible wrote here: "to revert to a different DTD in web.xml and change all ${...} to <c:out value="${...}"/>". and I had also to remove the <dispatcher> in the sitemesh's <filter-mapping>, in web.xml file. With this, the application run but without the nice look ;-) From what I read about Sitemesh, I haven't found clear explanation about how to replace the above <dispatcher>. Any help will be appreciated. Regards Pierre

Posted by Pierre Raoul on September 01, 2004 at 10:52 AM MDT #

Oops, The tags in the text disappear... So the whole text without chevron is: "to remove "dispatcher" elements in the sitemesh's filter-mapping element, in web.xml file" Pierre

Posted by Pierre Raoul on September 01, 2004 at 10:58 AM MDT #

Oops, The tags in the text disappear... So the whole text without chevron is: "to remove "dispatcher" elements in the sitemesh's filter-mapping element, in web.xml file" Pierre

Posted by Pierre Raoul on September 01, 2004 at 11:09 AM MDT #

Oops, The tags in the text disappear... So the whole text without chevron is: "to remove "dispatcher" elements in the sitemesh's filter-mapping element, in web.xml file" Pierre

Posted by Pierre Raoul on September 01, 2004 at 11:30 AM MDT #

Sorry for the noise. About Equinox with Tomcat 4: in fact the issue is not about sitemesh's filter-mapping in web.xml but the choice of the JSTL core library. Equinox uses the request-time one. I put the common one, and now everything is fine. Pierre

Posted by Pierre Raoul on September 01, 2004 at 05:28 PM MDT #

I am getting the same problem as Cliff "invalid path /user" requested. Any ideas what this is? Many thanks, Hugh

Posted by Hugh Ross on February 14, 2005 at 02:50 PM MST #

Would be cool if there was a light-light version for a pure tapestry+spring+hibernate base application. Just deleted all the folders i didnt like to make it look better.....so deleted ibatis, jsf and all that c*** ..anything except what i really need.. but unfortunately in the end it didnt work anymore :-(

Posted by Sarah on March 25, 2005 at 05:17 PM MST #

Equinox don't create hsqldb database. I follow chapter 2 tutorial anybody can help me?

Posted by Daniel on July 10, 2006 at 02:11 PM MDT #

Hi Matt, I'm doing the Spring Quickstart Tutorial from your book but am having some problems. It says run "ant deploy reload" and watch the tables being created. The ant task runs successfully by returning a BUILD SUCCESSFUL , but when I run "ant browse" to browse the database, the app_user table is not created. I would really appreciated some help because I am very interested in learning Spring+Hibernate Cheers, Mickey

Posted by Mickey on January 03, 2007 at 05:18 AM MST #

Mickey - the first question in Spring Live's FAQ should help you solve this problem.

Posted by Matt Raible on January 03, 2007 at 05:22 AM MST #

Thanks alot Matt. I changed the JDBC to use an absolute path and everything works now. Now I can continue with the book Thanks again, Mickey

Posted by Mickey on January 03, 2007 at 07:49 AM MST #

Hi, when u click on a userId on the userList.jsp page, it takes u to the userForm.jsp page. My question is: is it suppose to display the user's first name and last name in the textboxes? Because currently, my verison is empty. Oh yeah, and the delete button doesnt seem to work. It gives me the following error message when its clicked. An Error has occurred in this application. javax.servlet.ServletException: For input string: "" at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:541) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:451) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:264) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1176) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:472) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) ..... Does anyone know what is wrong?

Posted by bob on January 08, 2007 at 08:35 AM MST #

spring live best book for spring getting started Vikram

Posted by vikram bethu on March 22, 2008 at 08:42 PM MDT #

Post a Comment:
  • HTML Syntax: Allowed