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.
You searched this site for "java". 1,588 entries found.

You can also try this same search on Google.

[ANNOUNCE] Hibernate 2.1 Final Released!

One of the benefits of being up at 3:30 in the morning is you get to get the announcements first! Hibernate 2.1 Final has been released. I'll upgrade my apps to it, though I'm not using any new features. I've basically had the same code since 2.0 - you gotta like that backward compatibility remains a priority.

Posted in Java at Dec 11 2003, 03:24:49 AM MST 2 Comments

Denver JUG: XSLT and New EJB 2.0 Certification

Tonight I attented the Denver Java User Group meeting. Tom McQueeney did a nice basic concepts meeting on XSLT. Tom's presentation was a nice refresher on XSL and I learned a few things I hope I can remember the next time I use it. I've used XSL a couple of times in the last few years, and for those applications that I still maintain - I'm very glad I did. The e-learning app I developed last year uses JSTL's XML Transformation tags to render assets with different HTML (i.e. Flash, QuickTime, Image). It's worked great, and has always been very easy to add a new asset type to the XSL stylesheet.

The main speaker tonight was Kathy Sierra, the founder of JavaRanch. Her presentation was supposed to be on the new EJB 2.0 Certification, but it turned out to be a explanation of how EJBs work. Only about 1/3 of the room (approx. 40 attendees) had used EJBs, so I guess that's why she went that route. She didn't ask if we weren't using them by choice. ;-).

She started off her presentation talking about how the brain works and how it fights all day long to forget stuff. Your brain has a built-in crap filter. It only remembers those things that it needs to survive. It will only automatically remember those events that spark high emotions - fear, humor, arousal - because the chemicals caused by the emotions help you remember better. So when you're studying for your Java Certification (or any certification), the brain is going "screw this shit, I can survive without it." Repetition is a way to convince your brain that it is important. Another way is to get involved with your learning - be the EJB. Kathy did a captivating one-hour presentation with a number of audience members who acted out how EJBs work.

It was a very humorous presentation and great fun. An EJB presentation that was fun - WTF?! At one point, I looked around the room and almost everyone was learning forward and smiling. This lady is a captivating speaker, one of the best I've ever seen. I was very impressed with her teaching/learning techniques and I might just have to buy her book, Head First Java. Another highlight of the evening was that I actually won a free book.

Later: I forgot to mention what Kathy said about upcoming Sun Certifications. A couple new ones are coming: Mobile Application Developer, Web Services and an update to the Web Component Developer exam. She mentioned that the EJB 2.0 exam would probably remain at 2.0 for at least another year - until all the vendors caught up and support EJB 2.1. She said the Web Services one is going to be hard as will the next Web Component Developer Exam. The Web Component Developer exam will cover JSP 2.0 and Servlet 2.4. She also mentioned that she was reading Pro JSP to help create the WCD exam. How's that for an endorsement?!

Posted in Java at Dec 11 2003, 12:17:08 AM MST 5 Comments

Upgrading Hibernate, Struts and Display Tag

Last night, I upgraded a number of AppFuse dependencies: Hibernate → 2.1-rc, Struts Nightly from 2 weeks ago → Dec. 2nd and the Display Tag → 1.0 B2. The upgrades weren't as smooth as I'm used to, so I thought I'd share my experience to help y'all when you upgrade.

First of all, I found that Hibernate has ditched the Java Caching System (JCS) for their own, appropriately called Easy Hibernate Cache. This means you can forget about including jcs.jar in your webapp, ehcache.jar is now required. I upgraded from Hibernate 2.0.3.

Struts has done some trimming of their own - getting rid of their dependency on commons-lang. I use commons-lang.jar in AppFuse, so I had to dig into the contrib directory and grab it from there.

I had several issues with the displaytag when upgrading (from 0.8.5), but managed to figure them all out. First of all, the displaytag.tld in the jar's META-INF directory had the following in it's <taglib> declaration:

<taglib xmlns:html="http://www.w3.org/1999/xhtml">

This is obviously invalid, and I had to unjar, fix, and re-jar to get around this. I believe that this has been fixed on SF. I also found that this new version requires commons-collections 2.1. Struts must ship with an older version, so I simply replaces Struts' commons-collections with the one from the displaytag download.

The newer commons-collections is around 500 KB smaller - wierd, eh?

Lastly, I had to configure the ResponseOverrideFilter in my web.xml in order to get export functionality with Tiles. I had to tweek a LOT of CSS for this upgrade, but at least it's done now and hopefully I won't have to do it again for quite some time.

I also attempted to run AppFuse (with all these upgrades) in Tomcat 5.0.16 with no luck. With Hibernate 2.0.3, it was giving me an IllegalStateException when registering a new user. This process sets "Remember Me" cookies and redirects to the LoginServlet, which does a post to j_security_check and redirects to the originally requested page. Works fine in Tomcat 4.1.x, but not in 5.0.16. With Hibernate 2.1-rc1, I had to include jta.jar in $CATALINA_HOME/common/lib and now it still fails, but I get no errors whatsoever (those are always fun, aren't they). Also, still no luck with using J2EE 1.4.

Posted in Java at Dec 10 2003, 03:31:50 PM MST 1 Comment

DB2 with Hibernate and Tomcat

At my current project, we're using AppFuse for our baseline and (currently) Tomcat and MySQL for our databases. Soon we'll be migrating to DB2 for our database. I'm assuming everything will work smoothly with Hibernate, but there's probably some Ant things I will need to modify. For instance, with MySQL, I currently create a new database with the following script:

create database if not exists appfuse;
grant all privileges on appfuse.* to test@"%" identified by "test";
grant all privileges on appfuse.* to test@localhost identified by "test";

Is this possible with DB2? It's no biggie if it isn't - at my Comcast gig earlier in the year, we tied AppFuse/Hibernate into Oracle and simply didn't use the db-create nor db-init (creates tables) tasks. I use Hibernate's <schemaexport> task to create the tables - hopefully this will work in DB2. As for Tomcat, has anyone successfully configured DB2 with Tomcat's DBCP? We'll eventually be migrating to Websphere 5, hopefully it's not a big leap from Tomcat 4.1.27.

I haven't done any research on this yet, just wanted to put out some feelers and get any helpful advice before I start banging my head against the wall (hopefully I won't have to).

Posted in Java at Dec 08 2003, 10:01:55 AM MST 6 Comments

[JSPWiki] Sweet Java/HTML/XML syntax coloring

I found a very nice plugin for JSPWiki this morning: the Java to HTML converter.

This tool converts Java source code (files and snipplets) to HTML, RTF, TeX and XHTML with syntax highlighting. It is Open source under the GPL.

I've found that it works for Java, XML and HTML. Here's a couple of examples (I've hooked it into Roller's JSPWiki support):

Java


/**
@return Returns the id.
* @hibernate.id column="id"
*  generator-class="native" unsaved-value="null"
*/

public Long getId() {
    return this.id;
}

HTML


<html>
  <head>
    <title>HTML Test</title>
  </head>
  <body></body>
</html>

XML



<?xml version="1.0"?>

<!DOCENGINE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN" 
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class
        name="org.appfuse.persistence.User"
        table="app_user">

        <id
            name="id"
            column="id"
            type="java.lang.Long"
            unsaved-value="null"
        >
            <generator class="native">
            </generator>
        </id>

    </class>

</hibernate-mapping>

The one thing I don't like is that it centers the code using <center>, adding "center table {width: 100%}" to your stylesheet fixes the issue. I also tried to upgrade Roller's JSPWiki.jar to 2.1.86-alpha (to get XHTML support), but I was getting all kinds of stacktraces from OSCache and it just didn't work. Java2Html also has an Ant Task to convert Java source to HTML. Java2HTML has the same thing, but this new one supports different styles.

NOTE: The above syntax coloring produces invalid XHTML, so this site won't validate for awhile.

Posted in Java at Dec 05 2003, 01:02:08 PM MST 4 Comments

J2EE Patterns Catalog

J2EE is simple to learn, simple to develop - especially when Sun recommends you follow a mere handful of patterns. Heh.

Posted in Java at Dec 04 2003, 08:53:25 PM MST 9 Comments

StrutsCX - Updated Demo

I've updated my demo of StrutsCX. I haven't looked at StrutsCX much, but this release does look pretty polished. A quick glance tells me that it's now ready to be simply included in your Struts app with a single .jar file. Very nice! I might have to use it in Struts Resume to generate PDFs of Resumes.

Posted in Java at Dec 04 2003, 04:23:02 PM MST 2 Comments

[ANN] Apache Tomcat 5.0.16 Stable Released

I guess it happened yesterday, beginning upgrade at 3:10 MST... Done at 3:15 - let me know if you see any issues.

Later: There's issues all right. First thing is that the flag to allow symlinks used to be adding the following in your <Context> tag:

<Resources
  className="org.apache.naming.resources.FileDirContext"
  allowLinking="true" caseSensitive="true" />

And with 5.0.16, this doesn't work. Adding allowLinking="true" on your <Context> does allow symlinks, and should have been this way the whole time IMO. I also got a good ol' OutOfMemory error and I have a sneak suspicion it's not Roller (though Roller does though an exception when I do Weblog → Edit:

ERROR 2003-12-04 15:54:07,948 | HibernateStrategy:query | During QUERY
net.sf.hibernate.QueryException: could not resolve property type: weblogEntryId [select p from p in
class org.roller.pojos.RefererData where p.weblogEntryId=? and not title is null and not excerpt is
null order by p.totalHits desc]

Maybe this has something to do with the fact that my referers are not getting cleaned out every night. Anyway, back to my sneaky suspicion of OOM errors. I have two domains hosted on this site - raible.net and raibledesigns.com. The first just redirects to my family blog, but that's not the point. What I'm seeing in Tomcat's logs is that it tries to load all apps for both domains - and it pukes on a few. Time to play around with server.xml and see if I can get raible.net to just load it's own context.

Solution Found: You have to configure 2 different appBase's for each host.

Posted in Java at Dec 04 2003, 03:09:01 PM MST Add a Comment

Display Tag: Static Headers - Revisited

I get a fair amount of hits on this site for my Display Tag: Static Headers post. When I originally wrote it, back in August, it didn't work in IE. So I asked the experts. I got a solution from that - split the tables and wrap the data table with a div that has style="height: 400px; overflow: auto". This works in IE, but since it's not easy to hack the HTML that the displaytag generates, this is an awkward solution.

Since my old demo disappeared when I updated struts-resume, I created a new one. This example shows how to do static headers in both IE and Mozilla - and the IE solution actually works in both. It's admittedly ugly, but it works. The major problem with this approach is getting the width of the top (header) cells to match up with the bottom (data) cells. I got them close using "th, td { width: 25%}" in my stylesheet, but that doesn't line them up exactly. If anyone knows of a better solution, let me know and I'll update the demo.

Posted in Java at Dec 04 2003, 01:51:05 PM MST 4 Comments

Users and Groups on Linux

Now that I've rebuilt my Red Hat 9 box with Fedora, and installed Out-of-the-Box - I really should get my user and group permissions setup properly. If I ever decide to host CVS, shell access or bug tracking for clients, it'd be nice to know my server is secure. Out-of-the-box installs everything as root (save CVS), so I'm constantly doing "chown -R matt $CATALINA_HOME" or "su" to simply deploy files to Tomcat.

How are these open source servers (i.e. SourceForge) setup? If I wanted to setup a SF-clone, I'm assuming I'd need to setup a "developers" or "clientName" group and then create specific cvs repositories for each client. However, I'm not looking to setup a SourceForge-like server right now - I just want to get my permissions right. I'm thinking of creating a "developers" group, and giving it rw rights to Tomcat, Ant, Anthill, etc. Then I'll make myself a user in this group, rather than having to "su" every time I want to do something. What would you do? How would you setup your "dev" box to be more secure with users and groups?

Posted in Java at Dec 03 2003, 05:45:23 AM MST 1 Comment