IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New I'm struggling with this Java lark...
Maybe the IGM can give me some pointers because there are too many places where the error message (if there is one) is little more than "it doesn't work" without giving enough clue as to what to fix.

This is a new project; the only legacy "code" is understanding some database designs, but I already know them sideways, so that's not a hurdle. The project is using Spring MVC and Maven and all stored in SubVersion. Spring makes sense and a number of class/interface designs are very elegant. The ORM layer is Hibernate onto a MySQL database. Presentation is JSP files with JSTL tags. It's all running on Tomcat. The IDE of "choice" is IntelliJ v9.

<rant>
IntelliJ does a lot of flashy, clever things well, like auto-completion for many many things, and a type of pre-compiling which catches a lot of compile-time errors. Unfortunately, it seems to be designed, in large part, by people who haven't used anything else in a very long time. There is so much cruft around the edges that likes switching itself on that you feel like you need a screen 3000 pixels wide just for some decent elbow room. This wouldn't be quite so much of a problem if it handled horizontal scrolling properly, but no: it will often ignore the "End" key because that would put the cursor farther right than it thinks you should be coding. :-( And then there is the absolute reliance on the mouse for many many tasks. And the way the X Cut buffer is only filled if you swipe-mark the text. Double-click to mark a word and it doesn't copy it in (WTF?). Lots of idiocies like that.
</rant>

I've got a local Tomcat running, courtesy of apt-get. I figured out how to configure it to load the .war file from Maven's build. It seems to auto-deploy after Maven builds it. Usually. It lets IntelliJ connect for debugging and supports hot-swapping of classes. Well, most of the time. From time-to-time, it just won't do a hot-swap, which usually means I'm left guessing as to whether it's picked up the new .war file via Maven or is ignoring everything. I can't tell which it's done until I try out my change from a web browser.

And then if the .war file goes away, Tomcat deletes the context.xml file for it! :-O

JSTL, I've found, easily turns JSPs into tag-soup. The expression language likes ignoring new fields in classes, for instance, claiming it can't find them (exception in the log). I had to move a key piece of a display algorithm back into the controller because the servlet just would not see a field.

Restarting Tomcat will often solve that. Often - but not always. The latest is returning a blank value from a getter. Yet I know there's a value there because I can see it in the debugger before the servlet engine gets the data! What's worse is exactly the same construction on a different class works.

These things are slowing down development considerably. Help?

Wade.

Q:Is it proper to eat cheeseburgers with your fingers?
A:No, the fingers should be eaten separately.
New welcome to java :-)
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 55 years. meep
New Re: I'm struggling with this Java lark...
1) I'm personally a big fan of Use What Works. In the IDE realm, for me, this is NetBeans. I haven't tried IntelliJ in probably 8-10 years, so I have nothing to say there. I can say, however, that the Uber-IDE-of-Everyone, Eclipse, simply doesn't work for me. I could go into detail, but let's just leave it as "it's not for me."

2) If you hot-swap your .war file often enough, Tomcat will run out of memory (OutOfMemoryException in the logs), and you'll need to restart.

3) Sometimes if you hot-swap, it won't always pick up the changes (as you've seen.) To get around this, in the past, I've simply stopped and restarted Tomcat in between each build (of, say, JIWT.) You might also want to consider completely removing the temp/ and work/ directories. There's no harm in doing so, and it will force a recompilation of all JSP pages, and get a new working copy of your Java classes.

4) Yep, Tomcat will sometimes lose the context.xml file. Make a backup, and a quickie /home/static/bin/moveback type of command to copy it from its backup spot to where it goes.

5) Consider not doing a full .war-file deployment each time. If it's possible, you might be able to just run a "compile" step, and with the deployment of a warname.xml file (see below) inside your $TOMCAT_HOME/conf/Catalina/localhost directory, you can get your process down to "edit files, mvn compile, reload in browser" (uber-thanks to AdminiScott for reminding me how to do this in Tomcat.) Your warname.xml file should look something like:

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="/Users/mike/Work/jiwt/trunk/build" path="/forums" reloadable="true">
</Context>


Thus, I can go to http://localhost/forums and pull up JIWT locally.
-Mike

"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
- Benjamin Franklin, 1759 Historical Review of Pennsylvania
New Well at least I'm heading in the same direction...
And I was about 1-1/2 steps away from that trick on #5. I was just starting to get frustrated at doing the whole war file generation and was wondering if I could get Tomcat to look at before Maven bundles it all up... Or even after IntelliJ does it's own build.

I'm only using IntelliJ because that's what everyone else uses for Java. And we've got licenses. I'm tempted to go back to vi (which I use for the older PHP app) but I still need the raw Java help (I like the auto-import, for instance). I coudn't make Eclipse see an existing SVN checkout, but that was before I started learning Java. I hadn't heard of NetBeans.

You'd think Tomcat's predilection to throw away a configuration file that it didn't even create would be a reported bug. (Now that might be entertaining.) Glad I'm not the only one struck by that one!

Wade.

Q:Is it proper to eat cheeseburgers with your fingers?
A:No, the fingers should be eaten separately.
New Netbeans... (not exactly answering any questions here)
I started out with Netbeans for Java IDE (~2000). One session on the uber-IDE and I never went back. It may have changed a lot since then, but at the time, Netbeans took longer to start up than it took Eclipse to launch, compile and execute a program... (and it had that funky Metal Swing UI where Eclipse used SWT. Ick...)
     I'm struggling with this Java lark... - (static) - (4)
         welcome to java :-) -NT - (boxley)
         Re: I'm struggling with this Java lark... - (mvitale) - (2)
             Well at least I'm heading in the same direction... - (static) - (1)
                 Netbeans... (not exactly answering any questions here) - (scoenye)

It me, your father.
73 ms