Matt RaibleMatt Raible is a writer with a passion for software. 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.
You searched this site for "ant". 338 entries found.

You can also try this same search on Google.

[Ant] Trying to override old definition of task $taskname

I've seen the following message printed out as part of our build process for quite a few months now - and decided to try and fix it today.

compile-common:
Trying to override old definition of task runservertests
Trying to override old definition of task canoo
Trying to override old definition of task dbunit

I found that moving my <taskdef>'s from the root level (right under <project>) to inside my "init" target fixed the problem. Easy fix, no more messages.

Posted in Java at Jun 06 2003, 08:32:29 AM MDT 3 Comments

The Pragmatic Programmer

Tip o' the Day: Critically Analyze What You Read and Hear
Don't be swayed by vendors, media hype, or dogma. Analyze information in terms of you and your project. I began reading The Pragmatic Programmer this morning. I bought the book after hearing that it was Erik Hatcher's favorite technical book. Since Erik's Java Development with Ant was my favorite technical book - I figured this was a good recommendation. I've read one chapter and I'm loving it. This book will inspire me to be a better programmer - I can already tell.

I don't do nearly enough reading - too much blogging and OS development. So I'm going to try to read more - as David and Andrew recommend - at least one book a month. Actually, I'm going to shoot for two books per month - one technical and one non-technical. I'd compare this book to Rich Dad, Poor Dad, which I think is a great book for motivating good financial health. I read that bad boy last week in 2 hours!

Posted in Java at Jun 05 2003, 06:37:51 AM MDT 1 Comment

Tomcat/Oracle Connectivity Problems

I had a problem that I thought I fixed a while back. The problem was that our firewall between Tomcat and Oracle would close our database connection after 90 minutes of inactivity. We first solved this problem by using a Servlet/Ant Task/cron job combination to ping and use the DBCP connection pool we'd configured in Tomcat. This worked, for a little while. Then we realized we had to also ping the JDBCRealm, so we used a login test (via WebTest) and added this to our Ant Task/cron job. Again, this worked for a couple of months, until a QA Expert came on board and starting using WAPT to load test our app. Then we began having issues with many connections being opened (20+), then they were closed by the firewall, and when the app would try to re-use these connections, they wouldn't respond, and the app would enter into the "dithering idiot" mode. We finally figured out a solution, rather than workarounds, and here it is:

// In the file:
$ORACLE_HOME/network/Admin/SQLNET.ORA

// Add the following line to check every 10 minutes
SQLNET.EXPIRE_TIME=10

Posted in Java at Jun 02 2003, 09:25:58 AM MDT Add a Comment

Mavenizing Moblogger

I did some work to Mavenize Moblogger this evening. The biggest plus thus far? The Moblogger.zip file when from 1.9 MB to 45 KB - that rocks!! I got jar and site:generate working just fine, but there's no unit tests, so probably a fair amount of work needs to be done there. Regardless, I'll try to check it in tonight so others can start pitching in. The hardest part? Learning to type maven instead of ant.

Update: Deploying the moblogger site was a piece of cake (maven site:deploy). Thanks to the Flock developers for providing a nice template for Mavenizing an app.

Posted in Java at May 29 2003, 06:58:23 PM MDT Add a Comment

Hibernate Upgrade (1.2.4 to 2.0 rc1) Redux

My last upgrade from Hibernate 1.2.x to 2.0.x was a little rocky, so I'm going to document it again today - this time with a Hibernate 2.0-enabled version of XDoclet, and code samples from last time. Today I'm upgrading from 1.2.4 to 2.0 rc1.

1. First, I downloaded Hibernate 2.0 rc1. BTW, I also updated to the latest version of XDoclet from CVS.

2. Next, I copied it to my project's lib directory, deleted bin, doc, and src directories. The only files I need are hibernate2.jar and (in the lib folder) c3p0.jar, cglib.jar, dom4j.jar, jcs.jar, jdom.jar and odmg.jar. One thing to note is with Hibernate 1.2.x, I didn't need dom4j.jar, jdom.jar or cglib.jar in my deployed WEB-INF/lib folder. However, with the new version, I did need to include them.

3. Then I updated lib/lib.properties and began changing my code with gool ol' Homesite.

4. Hey, step 4 is the same as last time! Edit build.xml file to pick up the new DTD. I changed <hibernate/> to be <hibernate validatexml="true" version="2.0"/>.

5. Using HomeSite, I did s/cirrus.hibernate/net.sf.hibernate/g for all my .java and .xml files. Don't forget to change your log4.properties and hibernate.properties files.

6. In hibernate.cfg.xml I changed cirrus.hibernate.sql.OracleDialect to net.sf.hibernate.dialect.OracleDialect. I also updated the DTD to 2.0 and moved all properties inside the <session-factory> element. Here's a sample hibernate.cfg.xml file from struts-resume.

7. In my ServiceLocator.java class, I changed the following from (this is so JUnit Tests can run w/o JNDI):

Datastore datastore = Hibernate.createDatastore();
datastore.storeClass(package.MyClass.class); // lots of these
sf = datastore.buildSessionFactory();

To:

sf = new Configuration().addClass(MyClass.class) // lots of these
                        .buildSessionFactory();

8. Time to bring Eclipse to the table. I refreshed the project and added the new hibernate2.jar to the "Java Build Path."

9. In my StartupListener.java (which initializes Hibernate for Tomcat), I changed the following code:

// Configure Hibernate.
try {
    Hibernate.configure();

    if (log.isDebugEnabled()) {
        log.debug("Hibernate configuration completed.");
    }
} catch (HibernateException h) {
    log.fatal("Error configuring Hibernate!", h);
}

To:

try {
    SessionFactory sf =
        new Configuration().configure().buildSessionFactory();

    if (log.isDebugEnabled()) {
        log.debug("Hibernate configuration completed.");
    }
} catch (HibernateException h) {
    log.fatal("Error configuring Hibernate!", h);
}

10. Changed all instances of readonly="true" to inverse="false" inverse="true" for XDoclet tags. Also changed role to name.

11. Removed length attribute from any <key-property ... /> elements in my .hbm.xml files. These were rudely put there by the ReverseGenerator. Not all my mapping files are generated by XDoclet, if I have one with a composite-id, I just create the mapping file manually. I also had the change the DTD manually in these files.

12. In my build.xml, I changed the SchemaExport class from net.sf.hibernate.tools to net.sf.hibernate.tool.hbm2ddl.

13. OK, here goes, my first attempt at compiling (honestly!). Darn - I forgot to save StartupListener.java - trying again (this time with "ant clean" first). Sweeeet - it worked!

14. Hmmm, some log messages I wasn't expecting. I forgot to change my log4j.properties file from cirrus.hibernate to net.sf.hibernate. I'll add this above (step 5) to make this how to more accurate.

15. Running persistence tests - since I keep my Oracle driver (ojdbc14.jar) in ${hibernate.dir}/lib, I had to move it to the new directory. Now this is a strange error:

[junit] 2003-04-29 13:14:50,968 INFO [main] Configuration.addClass(264) | Mapping resource: com/
.../persistence/ChangeRequest.hbm.xml
[junit] 2003-04-29 13:14:51,234 ERROR [main] XMLHelper$ErrorLogger.error(37) | Error parsing XML
: XML InputStream(19)
[junit] org.xml.sax.SAXParseException: Attribute "name" is required and must be specified for el
ement type "param".

My guess is that it's being caused by:

<generator class="sequence">
    <param>cr_master_sq</param>
</generator>

After reading the Hibernate2 Porting Guidelines, looks like I need to add a name attribute. Didn't the exception tell me that! ;0)

I'll update this post when I figure out the answer to my question on Hibernate's forums...

Update: I had to 1) upgrade my XDoclet JARs, and 2) replace the following XDoclet tags:

* @hibernate.id column="cr_id" unsaved-value="null"
*  generator-class="sequence" generator-parameter-1="cr_master_sq"

with:

* @hibernate.id column="cr_id" unsaved-value="null" generator-class="sequence" 
* @hibernate.generator-param name="sequence" value="cr_master_sq" 

Now I'm experiencing this issue.

Update 2: I discovered (from Gavin) that readonly="true" is the same as inverse="true". I've updated step 10 above, and now my upgrade is complete!

Posted in Java at Apr 29 2003, 02:52:07 PM MDT Add a Comment

A Good Job vs. Good Pay

I did the interview with the University of Miami this morning. I was interviewed by a roundtable of folks and the questions weren't too bad - there were some fun ones and some technical ones (i.e. the classic, "what's the difference b/w an interface and an abstract class"). The people sounded very cool and it'd probably be a great team to work on. The pay, however, is not very good at all. However, they said they'd try to work on that. The itneresting thing I've learned is that the best paying jobs are usually the worst jobs. At least that's how it's been for me. I don't know if people just expect more from you, and portray this in the form of micro-management or what, but it sucks to have a job you don't like.

My current job? I love it. Not only because we're using all the cool technologies I like (Ant, Struts, Hibernate, XDoclet, etc.), but also because the people are very cool. Our 8:30 a.m. meetings are actually fun to attend. We poke fun at each other and there's lots of laughter in the room. Today has been an especially good day - I got club level seats to the Rockies Game (baseball) tonight, and also got invited to a pre-release viewing of Matrix Reloaded. Now those are what I call benefits! And, unfortunately, I'm also making the same rate I made six months after I graduated from college. Back then, I couldn't believe how much I was making, and now it's enough to support Julie, Abbie and I (and I'm the only one who works), so it's not too bad.

The problem is the gig at U of M pays around 1/2 of what I'm making now. It'd be an awesome job though. It sounds like they have great people and I'm sure the perks are good (maybe free tuition for my masters?). Look at me talking like I already got the job - I probably just jinxed myself - especially since I gave them the URL to this site. Oh well, if you guys are reading - it sounds like an awesome position, but I don't know if I can support my family on that salary. In fact, I've had such little luck finding a decent paying job in Florida, Julie has started considering a non-move. That is, we might stay in Denver. Jobs here seem to be picking up, and my current contract doesn't seem to have any end in site. They're even talking about putting us on a project developing mobile apps in Java.

Miami is calling though, especially on this cold April afternoon. Now I'm off to freeze my ass off at the Rockies' game. Good thing they're club level seats so we can just sit inside if it's too cold.

Posted in General at Apr 18 2003, 04:35:00 PM MDT 2 Comments

[ANNOUNCE] Ant 1.5.3 Released!

It looks like I was correct in assuming that Ant 1.5.2 had a bug in it's zipfileset task. How do I know? Because it's on the fixed list for Ant 1.5.3. Via Ammai.com:

The Apache Ant Project has released version 1.5.3 of this popular Java-based build tool. This release is mainly a bug-fix one that fixes the problem with Zip files; it will also be the last one before Ant 1.6. Read more for information.

Here are the bug fixes that have been incoroporated into this release:

* <zipfileset>'s filemode would get ignored and the dirmode was used for the included files as well. As a side effect, WinZIP was unable to extract or display the files, so they seemed to be missing from the archive.

* <ftp> could use the wrong path separator when trying to change the remote working directory.

* <jar update="true"> would loose all original files if you didn't specify any nested <(zip)fileset>s and the manifest had changed.

* If you used a value starting with \ on Windows for the appxml attribute of <ear> or the webxml attribute of <war>, it would be ignored.

* Ant will no longer implicitly add Sun's rt.jar in <javac> when you use jvc and don't specify a bootclasspath.

* The prefix attribute of <zipfileset> would not generate directory entries for the prefix itself.

* starteam checkout can now handle deleted labels.

* The Unix wrapper script failed if you invoked it as a relative symlink and ANT_HOME has not been set.

Click here to go to the download page.

Posted in Java at Apr 13 2003, 04:37:03 AM MDT Add a Comment

Maven makes it easy

If I ever migrate a project to Maven, I should probably read this article first. It's interesting to note that Maven makes it easy for project management, but not necessarily (??) for building. I know, you'll fire back that it makes it easy to build too - but if you don't have a need to manage your project, maybe you don't have a need for Maven. I find it strange that Maven is a top-level Apache project, and it hasn't even released version 1.0 yet.

Abstract: Even though Ant acts as the de facto standard for building Java programs, in many ways the tool falls short for project management tasks. In contrast, Maven, a high-level project management tool from the Apache Jakarta project, provides everything that Ant offers plus more. Java developer Charles Chan introduces Maven's features and walks you through a complete Maven project setup. [source]

Posted in Java at Apr 08 2003, 03:39:17 PM MDT 1 Comment

[ANNOUNCE] Struts Resume and AppFuse 0.7 Released!

There's nothing like tootin' your own horn. What's even worse is checking all this stuff into CVS and then uploading it on a dial-up connection. Anyway, here it is - the latest and greatest version of struts-resume and (finally) a version of appfuse. AppFuse is basically struts-resume w/o any resume stuff. There's not much new that's visible for struts-resume, the only real things are User Administration (no add, just list/delete/assign roles) and a smart-menu that stays expanded based on your previous selections. Here is a full list of what's new in 0.7 (both apps):

Features in 0.7
===============
- Upgraded to Hibernate 2.0 Beta 4.
- Upgraded to Struts 1.1 nightly build (2003.03.26) to fix Validator issue.
(http://tinyurl.com/87xa)
- Upgraded DBUnit to 1.6-dev to fix batchStatement error in Ant task.
(http://tinyurl.com/8ei2)
- Upgraded Canoo WebTest from build265 to build276.
- Upgraded XDoclet to nightly build (2003.03.28) for Hibernate 2.0
compatibility. Apache module is still customized for POJO -> ActionForms.
- Upgraded Display Tag Library to version 0.8.5.
- Renamed "test-canoo" task to "test-jsp".
- Added "db-load" as a dependency to running unit tests to get a fresh
database each time.
- In LoginServlet.java and BreadCrumbFilter.java, pre-pended contextPath
to authURL (i.e. "j_security_check") to get absolute path.
- Added User Administrator to list/edit/delete users. This feature
includes using indexedProperties on a form - still using XDoclet, but using
a subclass of UserForm, called UserFormEx to hold the getter/setters for
the indexedProperties.
- Wrote more Cactus and Canoo Tests to verify Resume editing and User
Administration functioned properly.
- Added icons to success and error messages template (common/messages.jsp).
- Implemented role-based Permissions on menu by adding
permissions="rolesAdapter" to in menu.jsp.

I've put a line through the renaming of "test-canoo" to "test-jsp" because it's in the README (part of the download) and I don't want to re-upload just because of one stinkin' line.

Tomorrow, I'm actually presenting for the Struts Training class, so I won't be able to give a full review. One of the gents who wrote Stxx will be presenting first at 8:30 MST, and then I'm up for my preso. I'm going to do some short and sweet stuff on Remember Me and XDoclet with Struts. If you're interested, you can do the labs I put together. I'll post the slides when I'm done presenting.

Posted in Java at Apr 04 2003, 11:56:25 PM MST 3 Comments

Bug in Ant 1.5.2?

I found out the hard way that there might be a bug in Ant 1.5.2. I'm running the following task as part of appfuse - and it generates a appfuse.zip file, and it's the correct size, but there's nothing in it. I reverted back to Ant 1.5.1 and everything worked fine.

<zip zipfile="${archive.target}.zip">
    <zipfileset prefix="${webapp.name}" dir="${basedir}">
        <patternset id="srcfiles">
            <include name="**"/>           
            <exclude name="build.properties"/>
            <exclude name="database.properties"/>    
            <exclude name="*.log"/>
            <exclude name="*/**.java.txt"/>
            <exclude name="${dist.dir}/**"/>
            <exclude name="${build.dir}/**"/>
        </patternset>
    </zipfileset>
</zip>

This particular problem happened with Cygwin on Windows 2000 using JDK 1.4.1_01.

Posted in Java at Apr 02 2003, 04:59:15 PM MST Add a Comment