Tuesday, April 8, 2008

Google AppEngine

New Google AppEngine!

Sweet, couldn't wait to use it. I started the tutorial during lunch. I downloaded and installed Python and the AppEngine. Then I created a work directory, "C:\google_workspace" and a helloworld folder, "C:\google_workspace\helloworld" just like the tutorial said to do, created the files "helloworld.py" and "app.yaml" just like in the tutorial, and fired up the dev_appserver with, "C:\google_workspace\helloworld>dev_appserver.py helloworld\". Instead of "Hello, world!" I got :

C:\google_workspace\helloworld>dev_appserver.py helloworld/
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\dev_appserver.py", line 50, in
<module>
execfile(script_path, globals())
File "C:\Program Files\Google\google_appengine\google/appengine/tools/dev_apps
erver_main.py", line 338, in <module>
sys.exit(main(sys.argv))
File "C:\Program Files\Google\google_appengine\google/appengine/tools/dev_apps
erver_main.py", line 287, in main
config, matcher = dev_appserver.LoadAppConfig(root_path, {})
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_apps
erver.py", line 2415, in LoadAppConfig
raise AppConfigNotFoundError
google.appengine.tools.dev_appserver.AppConfigNotFoundError

Hmm. I ran through a mental checklist before diving into the code (I knew I was being lazy. I was also really looking forward to diving into the code, but I wanted to at least get the thing running first.)
  • Perhaps I should've installed somewhere other than "C:\Program Files" I don't usually put anything in there.
  • Apparently I had Tomcat running which would be blocking 80 (I usually set Tomcat to 80 and JBoss to 8080).
Neither of those made a difference. "I, d, ten, t" error - I was running the wrong file.

Running, "C:\google_workspace\helloworld>dev_appserver.py ./" started the server.

The first line was a prompt, "Allow dev_appserver to check for updates on startup? (Y/n):"
Naturally I said "Y", and I liked name of the config file which was conveniently printed out on the next line, "dev_appserver will check for updates on startup. To change this setting, edit C
:\Documents and Settings\jdavis/.appcfg_nag"

I saw "Hello, world!"

I can't wait to start using this. Now I can finally build a completely scalable side project to make myself rich without spending any money out of pocket! Actually, I can finally stop putting off learning Python.
Blogged with the Flock Browser

Thursday, February 28, 2008

Hibernate reverse engineering and "yes_no" columns

Since attending JBossWorld Orlando, I've been playing with the JBoss Developer Studio. I've had some problems with reverse generation of my entities, and so I thought I'd post some of the solutions.

My database uses logical deletes ("Y" and "N".) The generated entities, which were typed as Boolean's choked on insert.

I haven't had much luck yet customizing the generation from the JBoss Developer Studio menu , and so I've been using the Hibernate Tools for Eclipse to generate my entities into a separate project, ModelProject, and then copying them into a seam project.

My plan was to use Seam tools to generate the crud ui from the project. However, right clicking the project and choosing "New -> Seam Generate Entities" and then selecting "Use existing entities" didn't do anything.

I started over and did the following :
ran seam-gen from the command line and created a new project, SeamProject
imported the resulting project into Eclipse
copied the reverse-engineered entities from ModelProject into SeamProject
ran "seam generate-ui" from the command line

This worked beautifully. The only hitch was I kept getting a vague error from DB2/400 when I tried to create a new entity, "[SQL0545] INSERT or UPDATE not allowed by CHECK constraint."

I checked all the constraints and after a few failed attempts determined that I wasn't violating any foreign keys. There were only a couple of not null fields one of which was the logical delete column. I had entered the translation I wanted into the hibernate.reveng.xml file (or at least I thought I had), but there was no annotation for "yes_no." I simply added @Type(type="yes_no") to the field, and everything worked.

Blogged with Flock

Friday, February 15, 2008

JBoss World Orlando - Friday

EJB3, Seam, JSF, and RichFaces on JBoss 4.2.0 was the first session I attended. It was a case study of easycredit a German loan system. I've found the case studies useful.

The second session I attended was a 90 minute JBoss Developer Studio workshop. I had already installed the JBoss Tools project into Eclipse so I was glancingly familiar with it; however, I've used seam-gen for the projects I've been working on and hadn't made use of the Developer Studio tooling. Reverse engineering a domain model is stupidly simple.

Agile Development Using JBoss Seam was the third session I attended. Daniel Hinojosa was the speaker, and he had some cool tips on using Groovy for unit testing that I want to check out. He also showed off some stuff that I didn't know Hudson could do.

Testing JSF Applications which was an intro to JSFUnit by Stan Silvert was another session that I really liked, meaning I will start using JSFUnit next week. The executive summary is that resulting from his hatred of Mock objects, Stan created a JSF testing framework that works inside the the container without all the overhead of Cactus.

Some Other JBossWorld Bloggers

Daniel Hinojosa is currently speaking (I'm in his seminar now) and blogging about the show on his evolutionnext blog.

Thursday, February 14, 2008

JBoss World Orlando - Thursday

Introduction into JBoss Drools and the Business Rules Management System (BRMS) by Mark Proctor was the first session I attended.

Drools/JBoss rules is really cool. The web based BRMS system looks very nice, and offloading the maintenance to the business users is a must anyway. I'll be using this soon.

I found the keynote by Vefim Natis from Gartner interesting. Although I am way tired of hearing about SOA I still got a lot out of his talk. Some of his points :
  • Gartner's hype cycle currently puts SOA entering mainstream acceptance.
  • SOA is primarily about business modeling : identifying the business components that need to be developed as software.
  • Establishment of an Integration/SOA Competency Center (ICC) is the barometer of success
  • Heterogenous software/environments are not only necessary, but should be regarded as a goal.
The Hibernate Search session was impressive. Emmanuel Bernard, the project's team lead was the presenter. I didn't have a lot of experience using Lucene (one project a few years ago), but it looked like they've done a nice job wrapping Lucene and providing an API that should be familiar to Hibernate users.

Wednesday, February 13, 2008

JBoss World Orlando - Wednesday

I'm at JBossWorld Orlando. We got the usual t-shirt and bag, but the 1G flash drive was definitely the best schwag I've picked up (I didn't take a single pen during the vendor meet and greet!)

I checked out the jBPM session, "A Lightweight Approach to Business Processes With JBoss jBPM", first. I would've liked more practical use information, but the overview of the jBPM platform, which is how Tom Bayens described it, was interesting.

The next session on "Seam, SEAM, AS, EJB3, Hibernate, AJAX4JSF, RichFaces, and Facelets", was given by four guys from Big Lots. It was an excellent talk. I don't know how much presenting they do, but they traded off easily and kept the talk moving really well. It didn't hurt that their case study was very relevant to the project I'm working on.

Thursday, January 31, 2008

Server did not start after 50s

I got this error while starting up JBoss from Eclipse, 3.3 with the latest JBoss Tools installed (I haven't shelled out the $100 for Red Hat Developer Studio.)

"Timeout waiting for JBOSS 4.2 to start. Server did not start after 50s."

At December's AJUG meeting I saw a demonstration of Glassfish starting in under a minute, which was seriously impressive. However, Eclipse can't be pimping Glassfish, and while I am interested in giving Glassfish a look, I need this running now. Besides, I like JBoss.

I deleted a couple of the ear files that I wasn't working on, but I kept getting the timeout error. A quick Google, and I located the following folders in my EclipseDist\plugins directory :
  • org.eclipse.jst.server.generic.jboss_1.5.102.v20070608
  • org.eclipse.jst.server.generic.jboss_1.5105.v200709061325.
I edited the plugin.xml in the org.eclipse.jst.server.generic.jboss_1.5105.v200709061325 folder. The relevant parts were the serverType entries, startTimeout parameters.

<extension point="org.eclipse.wst.server.core.serverTypes">
<serverType
runtime="true"
class="org.eclipse.jst.server.generic.core.internal.GenericServer"
id="org.eclipse.jst.server.generic.jboss323"
initialState="stopped"
supportsRemoteHosts="false"
runtimeTypeId="org.eclipse.jst.server.generic.runtime.jboss323"
description="%jboss323serverTypeDescription"
launchConfigId="org.eclipse.jst.server.generic.core.launchConfigurationType"
behaviourClass="org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour"
name="%jboss323serverTypeName"
startTimeout="50000"
stopTimeout="15000"
hasConfiguration="false"
launchModes="run,debug,profile">
</serverType>
<serverType
runtime="true"
class="org.eclipse.jst.server.generic.core.internal.GenericServer"
id="org.eclipse.jst.server.generic.jboss4"
initialState="stopped"
supportsRemoteHosts="false"
runtimeTypeId="org.eclipse.jst.server.generic.runtime.jboss4"
description="%jboss4serverTypeDescription"
launchConfigId="org.eclipse.jst.server.generic.core.launchConfigurationType"
behaviourClass="org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour"
name="%jboss4serverTypeName"
startTimeout="50000"
stopTimeout="15000"
hasConfiguration="false"
launchModes="run,debug,profile">
</serverType>
<serverType
runtime="true"
class="org.eclipse.jst.server.generic.core.internal.GenericServer"
id="org.eclipse.jst.server.generic.jboss42"
initialState="stopped"
supportsRemoteHosts="false"
runtimeTypeId="org.eclipse.jst.server.generic.runtime.jboss42"
description="%jboss42serverTypeDescription"
launchConfigId="org.eclipse.jst.server.generic.core.launchConfigurationType"
behaviourClass="org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour"
name="%jboss42serverTypeName"
startTimeout="50000"
stopTimeout="15000"
hasConfiguration="false"
launchModes="run,debug,profile">
</serverType>
<serverType
runtime="true"
class="org.eclipse.jst.server.generic.core.internal.GenericServer"
id="org.eclipse.jst.server.generic.jboss5"
initialState="stopped"
supportsRemoteHosts="false"
runtimeTypeId="org.eclipse.jst.server.generic.runtime.jboss5"
description="%jboss5serverTypeDescription"
launchConfigId="org.eclipse.jst.server.generic.core.launchConfigurationType"
behaviourClass="org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour"
name="%jboss5serverTypeName"
startTimeout="50000"
stopTimeout="15000"
hasConfiguration="false"
launchModes="run,debug,profile">
</serverType>
</extension>

I changed the values to 180000 ms and JBoss booted just fine.

Blogged with Flock