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 "java". 1,588 entries found.

You can also try this same search on Google.

Eclipse RC1

Damn, just when I got everything upgraded to M5, a new version of Eclipse is released. Oh well, I started using M5 and JDK 1.4.1 Preview 10 on OS X today and while the JDK works pretty well, Eclipse did crash on me once. I wish I could get the fonts down to WinXP's size - they're so *huge* on the Mac. My biggest pet peeve right now - the font size in the left navigation window. I've reduced the size of the rest of the fonts, but can't seem to fix this one. Is Eclipse a FontBitch?

Posted in Java at Feb 25 2003, 07:22:11 PM MST 1 Comment

My Web Standards Compaign. Target 1 = Jakarta

I'm thinking of starting a campaign to motivate Jakarta's project sites to be standards-compliant. By this, I mean get rid of the font tags and other color/size/positioning elements in the HTML. Use CSS and XHTML. Think it's worth pursuing. In reality, it doesn't really buy much except the prestige of being standards-compliant. Of course, I might be the only one who sees this as important. Wouldn't it be interesting if Java compilers were like browsers. You could do some things in one, and it wouldn't work in another compiler. That's the way the web is - let's fix it.

Posted in Java at Feb 25 2003, 02:45:29 PM MST 1 Comment

Roller as a WebWork Sample App?

From the WebWork Mailing List... ;-)

> Ok, so here's an idea for the Webwork2.0 sample app:
>
> Let's do Roller, only better, using Webwork 2.0, Hibernate, and Joe's
> RSSLibJ.

+1, I love it! Now if you can make it configurable so that all of these can be "configured" to maintain existing views/persistence layers + add the new ones - that would be impressive!

Posted in Java at Feb 25 2003, 10:36:45 AM MST Add a Comment

XDoclet now supports Hibernate 2.0 (almost)

I finished patching XDoclet to allow for Hibernate 2.0 support. I say almost in this post's title because someone still has to commit it. Seems to work pretty good on struts-resume. I can't get one of my unit tests (UserManagerTest) to run, so I won't be releasing tonight (though I was hoping to). Maybe tomorrow. Here's a rough draft of features and plans in the coming 0.6:

Features in 0.6
===============
- Upgraded to Hibernate 2.0 (http://tinyurl.com/6b00) and 
  Struts 1.1RC1 (http://tinyurl.com/6cp9).
- Fixed Validation issues when attempting cancel validation and using
  LookupDispatchAction (document in Struts 1.1RC1 link above).
- Moved opening Hibernate sessions from being at a method level to being passed
  in to each method on the business/persistence tier.  Sessions are now obtained
  via the ActionFilter.getSession() method.
- Added SMTPAppender to log4.properties to e-mail errors that occur in log 
  files.
- Added "Remember Me" feature - for details see http://tinyurl.com/6du0.
- Added "Current User" count as a demonstration of a Tiles Controller.

// TODO for 0.7 
- Add Skills, SkillGroups, Education, Experience to the mix.  Make them 
  all editable when editing a resume using the Struts Nested Tag Library.
- Figure out a way to display resumes to anonymous users.  Do I create XML 
  versions of a resume in "resources/${username}" or use a servlet that maps
  to something like /struts-resume/view/${username}.  I like the servlet 
  idea better, then it's dynamic.  However, how often does a resume really
  change.
- Complete tests for all Action classes using StrutsTestCase.
- When Tomcat 5 become stable, or I figure out how to install an app on Resin 3,
  figure out a way (using Ant) to create JSP 2.0-compliant distribution.
  
// TODO for 0.8
- Add Transformers and XSL for transforming an XHTML document to XML or Text.  
  PDF will be covered in a later release.
- Allow a way for users to register (similar to Roller).
- Create User Administration interface with sortable/pageable list of users.
- Complete tests for all JSPs using Canoo WebTest.

Posted in Java at Feb 24 2003, 10:07:04 PM MST

Introducing xdoclet.org

The XDoclet team was doing some musing yesterday over who purchased xdoclet.org. I guess someone was listening (and wanted to help), because it was pointing a company yesterday and now it's pointing to XDoclet's homepage. Very cool. Is hibernate.org next?

Soon after: According to an e-mail on the list, xdoclet.net and xdoclet.com should be working too.

Posted in Java at Feb 24 2003, 03:38:19 PM MST Add a Comment

Struts Update: 1.1 beta 3 to 1.1 RC1

While upgrading Hibernate last night and this morning, I also upgraded Struts. Now I'm having some issues there, so I'd better document those too. First of all, the following line doesn't seem to be rendering any client-side JavaScript anymore:

<html:javascript formName="resumeForm"
      dynamicJavascript="true" staticJavascript="false"/>

Update 1: Nevermind, it seems my Internet connection went dow while starting Tomcat. Since the Digester couldn't validate the Struts' XML configuration files with their respective DTDs, it stopped them from loading.

Update 2: This turned out to be a legitimate issue. Adding cdata="false" to the above tag enabled the browser to see the JavaScript by removing the "<![CDATA[" after <script type="text/javascript">

Revisiting the Hibernate upgrade, I needed to add dom4j.jar to WEB-INF/lib to solve java.lang.NoClassDefFoundError: org/dom4j/Node.

Now I'm getting:

java.lang.NoClassDefFoundError
	at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:571)

What the @#$*%#? hibernate2.jar is in WEB-INF/lib??

Update 3: I had to add cglib.jar to WEB-INF/lib as well. Now back to an issue I'm having with the Validator where client-side validation is working when I click "cancel" (as in, it's disable), but server-side is kicks in. Argghhhh!

Update 4: I found an issue (via the struts-user list) about using the Validator with LookupDispatchAction. It basically doesn't allow you to control validation on a method level, so I've hacked the following workaround.

I changed <html:cancel> to be <html:button> and added onclick="cancel()", where cancel() is the following JavaScript method:

<script type="text/javascript">
function cancel() {
    location.href = '<html:rewrite forward="cancelUser"/>';
}
</script>

The "cancelUser" forward points to "/editUser.do?action=Cancel", which is an action-mapping that doesn't have validation (validation="false") and this hits the "cancel" method on UserAction and routes appropriately.

Phew - I'm beat. I never realized being an upgrade-happy-keyboard-monkey could be so much work!

Posted in Java at Feb 24 2003, 11:10:46 AM MST 4 Comments

Hibernate Upgade: 1.2.3 to 2.0 (My Story)

I'm upgrading struts-resume to Hibernate 2.0 tonight. I thought I'd blog my adventure and what I needed to change.

Step 1: Patch XDoclet to allow specifying the DTD in the generated .hbm.xml files.

Step 2: Download Hibernate 2.0 beta 2. It's at the bottom of the preceding link.

Step 3: Extract to struts-resume/lib and change lib.properties to version 2.0.

Step 4: Edit build.xml file to pick up the new DTD. I changed <hibernate/> to be <hibernate validatexml="true" version="2.0"/>.

Step 5: Using HomeSite, I did s/cirrus.hibernate/net.sf.hibernate/g. 14 matches. The project currently has 3 DAO's and a ServiceLocator to get Hibernate Sessions.

Step 6: ant clean deploy Not too bad, only one compile error.
D:\source\appfuse\src\ejb\org\appfuse\persistence\ServiceLocator.java:12: cannot resolve symbol
symbol : class Datastore
location: package hibernate
import net.sf.hibernate.Datastore;


Step 7: Open up Eclipse, refresh the project and right click on the project name, click Properties >> Java Build Path. Change path for hibernate.jar to struts-resume/lib/hibernate-2.0/hibernate.jar. Remove the previous path.

Step 8: Go searching for what the heck happened to Datastore. Hibernate CVS is first choice. Pause to post (per chance someone reads and sends solution).

Step 9: Step 4 from the Hibernate 2 Porting Guidelines. Replacing attribute names, DTDs and changed throws SQLException to JDBCException in ServiceLocator class.

Step 10: Repeat Step 5 for all Unit tests (they live in "test," rather than "src"). End up repeating for entire project, makes about 1800 replacements - hibernate-1.2.3/src was in search path. Remove lib/hibernate-1.2.3.

Step 11: Revisit Step 8 and try to use new Configuration API. Tried this...
Datastore datastore = Hibernate.createDatastore() - changed to Configuration config = new Configuration();

Not working yet... But Gavin has responded to the mailing list and Chiara is listening. Good to have the support ;-)

Step 12: Found a problem with XDoclet, modifying source. Changing "role" attribute to "name" for the following types (in order replaced by HomeSite): subcollection, collection, set, bag, list, map, array, primitive-array. Rebuilt hibernate module. Changed attribute "readonly" to "inverse" and tried again. Changes to set and bag only.

Step 13: I'm using the Configure.configure() method to initialize from hibernate.cfg.xml (I had to rename the package for my dialect from cirrus.hibernate.sql.MySQLDialect to net.sf.hibernate.dialect.MySQLDialect). I doubt it'll work though since this expects a JNDI DataSource.

Step 14: Nope, that didn't work. I found out I needed to remove the "length" attribute from any <key> elements in <bag>'s. Back to trying to use config.addClass().

Step 15: Internet connection goes down, reboot router. Change dialect package name in database.properties. This file is renamed to hibernate.properties and used for running JUnit tests. Now time to have fun with JUnit and get UserDAOTest to run.

I'm getting a connection to the database now thanks to Gavin's advice:
sf = new Configuration()
     .addClass(Foo.class)
     .addClass(Bar.class)
     .buildSessionFactory();


Step 16: Changed xdoclet tags "inverse" attribute to be "false" where previously readonly="true", now inverse="false". Now I'm getting the following error:

[junit] java.sql.BatchUpdateException: Invalid argument value: Duplicate entry '0' for key 1
[junit] at com.mysql.jdbc.jdbc2.PreparedStatement.executeBatch(Unknown Source)


Whenever I try to run the addResume test for a user. The mapping looks fine, I'll try dropping and re-creating the database. Found I needed to change the package names in build.xml. Note to upgraders: don't filter by file extension when replacing the package name.

Discovered that the SchemaExport class had moved from net.sf.hibernate.tools to net.sf.hibernate.tool.hbm2ddl.

Step 17: The UserDAOTest runs successfully. Now for the web...

Couldn't get "ant test-canoo" (Canoo WebTest) to run until I copied xerces.jar back into lib/hibernate-2.0/lib. Changed my log4j.properties to use new package name for logging.

After looking at some 2.0 documentation, I discovered a new DTD for hibernate-configuration. Unfortunately, it's not there. So I put it on this site as a workaround. Got rid of startup errors. One change in the DTDs is that all <property> declarations must be within a <session-factory> element.

Now I can't get Hibernate to connect to JNDI. Back to the doco...

(5 minutes later) Yep, right in the doco. I changed StartupServlet.java to have the following:
SessionFactory sf =
  new Configuration().configure().buildSessionFactory();


Now, when I login I'm getting:

java.lang.UnsupportedOperationException
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:125)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:329)


Since my Unit tests on the business level run, I'm guessing it's something wrong with this line in hibernate.cfg.xml:
  <property name="connection.datasource">java:comp/env/jdbc/resume</property>

Get a good nights sleep; zonked out at 3, up at 8:30 to continue...

Step 18: Find out (from Gavin) that there's probably a hibernate.properties file in my classpath that is causing the problem. I find this fine inside hibernate.jar. Doh! There's an error in packaging. ;-) I remembering seeing this sometime last week on the mailing list. I decide to upgrade to Hibernate 2.0 beta 3, which was released while I was sleeping. The file hibernate.properties is removed from hibernate2.jar in this release. I did have to update lib/lib.properties to handle the change of jar-name. Compiling, testing...

Dropped and re-created the database b/c I was getting duplicate key errors. Ran UserDAOTest - BUILD SUCCESSFUL - run it again - BUILD FAILED.

Further updates to hibernate-properties.xdt to replace paramName="role" to paramName="name", also replaced paramName="readonly" with paramName="inverse". Sent an e-mail to xdoclet-devel inquiring about best way to make hibernate-properties.xdt both 2.0 and 1.1-compatible.

This change in XDoclet makes UserDAOTest pass - so it looks like the upgrade is a success. Now I just have to figure out a way to convince the XDoclet team to add support for Hibernate 2.0. This might take awhile, it has for POJO -> StrutsForms support (still pending).

Posted in Java at Feb 23 2003, 11:03:02 PM MST 6 Comments

Use Maven? Experience says no...

I've been wanting to upgrade struts-resume to use Maven, but after reading Patrick's post, I might just change my mind.

And after 2 years of using Ant, Maven (which uses Jelly and Werkz as the underlying engines) behaves differently enough from Ant to utterly frustrate me. So I'm back heading back to the drawing board for new ideas.

Of course, my hope is to integrate Maven without losing Ant and let them both live beside each other intimately. Someday it will be done...

Posted in Java at Feb 23 2003, 04:30:52 PM MST 1 Comment

Having trouble with Struts' Nested Tags on Tomcat 4.1.18?

If you're having trouble running Struts' Nested Tag Library on Tomcat 4.1.18, then you should probably checkout Arron's (original author) posting to the struts-dev mailing list. There's a patch available on this post.

Posted in Java at Feb 23 2003, 10:19:59 AM MST Add a Comment

[ANNOUNCEMENT] Struts 1.1 Release Candidate 1 Released!

The Struts team is proud to announce the release of Struts 1.1 Release Candidate 1. This release includes some new functionality, as well as fixes for a number of bugs which were reported against earlier versions. The Struts Team believes that this release is ready for prime time, hence its designation as a release candidate.

The binary distribution is available at:

http://www.apache.org/dist/jakarta/struts/binaries/

and the source distribution is available at:

http://www.apache.org/dist/jakarta/struts/source/

In addition, the library distribution, which contains updated binaries without the sample applications, is available at:

http://www.apache.org/dist/jakarta/struts/library/

Details of the changes in this release are available in the Release Notes, which can be found here:

http://jakarta.apache.org/struts/userGuide/release-notes-1.1-rc1.html

Get it while it's hot!

Posted in Java at Feb 23 2003, 10:15:12 AM MST Add a Comment