Wednesday, March 5, 2014

I am a happy boy...

Finally!!!!

I got all of the pieces worked out on my app running on Apache TomEE.

Before you invest too much time reading - this is really dry reading. But, if you are planning on connecting to a MySQL database from an app running on TomEE it might help you get it working.

You're still here! Well...

It took a bit longer than I had expected it to (of course I didn't get to work on it full time). But it works!

I've got my JSP sending data to my servlet using AJAX. The servlet is properly parsing the XML and uses JPA to access my MySQL database.

Perhaps strangely enough, the biggest headache that I ran into was getting the data source properly configured.

Here is what it took...

In the WEB-INF directory is my resources.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
<Resource id="pInit" type="DataSource">
ignoreDefaultValues true
JdbcDriver com.mysql.jdbc.Driver
JdbcUrl jdbc:mysql://ksdb:3306/projectInit
UserName username
Password password
defaultAutoCommit true
jtaManaged true
</Resource>
</resources>


In the META-INF directory is the persistence.xml file:

<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit transaction-type="JTA" name="pilCommon"> <jta-data-source>pInit</jta-data-source> <class>com.pubint.projInit.entity.Project</class> <properties> <property name="openjpa.jdbc.DBDictionary" value="mysql" /> <property name="openjpa.AutoDetach" value="close" /> <property name="openjpa.DetachState" value="fetch-groups(AccessUnloaded=true)" /> <property name="openjpa.Multithreaded" value="true" /> <property name="openjpa.TransactionMode" value="managed" /> <property name="openjpa.NontransactionalRead" value="true" /> <property name="openjpa.RestoreState" value="all" /> <property name="openjpa.jdbc.SynchronizeMappings" value="false" /> <property name="openjpa.InverseManager" value="true" /> </properties> </persistence-unit> </persistence>

I might have gone overboard on the properties that I set in the persistence file but the minimal version that I modeled after from the TomEE site did not work. TomEE kept trying to use HSQL to connect to the database rather than MySQL (which is what it really should have been).

But that is okay - it works and I can finally move on to building the real pages and implementing the needed functionality.

Whew...

Monday, February 24, 2014

Did someone get the number of that bus...

So, headache it is.

If you caught my post from Friday then you know that I planned to push through getting the beginning of an app that would be deployed to Apache TomEE over the weekend or get a headache trying.

Well...My Saturday got swallowed up by household maintenance issues so Sunday got the brunt of the coding effort.  And (did I mention that I have the attention of a squirrel in the face of new tech?) a decent chunk of my time got eaten up by trying to wrangle heroku into submission as a TomEE hosting service. There were a couple of existing 'buildpacks' (heroku's means of customizing the deployment environment) for Tomcat and TomEE - but they did not work for me. So, I set out on the path of trying to build one that would work.

After many hours of trial and error - no success. But, I do have some clues and a new resolution to search for more experienced eyes (just have to figure out where they would be...).

And, most importantly - I have a renewed resolution to get back to the main effort and to quit yak shearing (I love that term!).

Putting away the clippers now.

Back to coding...

Friday, February 21, 2014

TomEE can you hear me...

When I was listing out my priorities of languages/technologies that I am going to be focusing on in the next year, I forgot to mention (Apache) TomEE.

TomEE is a full Java EE server based on Apache Tomcat (http://tomee.apache.org) and should make it easier to set up, configure, and maintain application servers. But, I have gotten stuck in my ways and lazy. For the past six (or so) years I have been using Apache Geronimo for my app servers. When Geronimo went from version 2.2.x to version 3.x I got left behind. Time constraints kept me from putting in the time to clean up my app and get it into a state that can be deployed on the new OSGi environment.

I still need to put in that time and get my app converted to be compatible. But, recently there are a procession of smaller more self-contained apps that need writing and since we have one externally written app that is running on Tomcat - it makes sense for us to move that app to TomEE and write these new apps for TomEE as well.

So, I am now in the process of trying to develop my first app for TomEE...Using a responsive web framework (Foundation). And, it needs to be ready for beta testing in two weeks.



By Monday I should either have the first functioning bits of this new project running on a TomEE instance or a massive headache. Or...maybe both.

Wish me luck!

And I'll see you in a couple of days...

Wednesday, February 12, 2014

Where did that piece of paper go (part two)...

I have generally had fairly bad luck at predicting the future of where technology was headed.

Back in 1995 I thought that Java was a toy and that it was not going to ever make any real impact on programming. When I first started doing web development I thought that JavaScript was pointless and that there was no good reason that anyone would ever use it for anything serious.

Well, I was at least right that for the most part, applets have faded into the mists of time. But, I use Java pretty much every day. I love the performance that I am able to get on the back-end server. And, over the past six years I have been able to figure out that JavaScript is worth my time too. If I had just figured out that everyone was just misusing it when they made all of those scrolling marquees and flashing text sooner! AJAX has made web browsers into my preferred front end clients.

Since I keep having it pushed into my face that I have been a bad prognosticator I have been trying to be more open minded about technology. Which, has the unfortunate side effect of eating all of my free time. The parade of technology that has been demanding my attention has done nothing but speed up over the past few years. In its wake are hours of my time that were spent starting to learn about a tool, language, or technique only to have something else come along and steal my attention.

I am really tired of swimming so hard against the stream and getting nowhere, so...

I have made a list of the new things that I am going to focus on in the next year or so. And here it is:
What would be really nice if each of those were nicely contained - but they aren't. So, each of them is really the label on a fairly big bag of learning.

On the plus side, I have some actual progress on the beginning of my list. My origami website (that goes along with the Android app that I wrote) Origami Central was written taking advantage of the Foundation framework and should be reasonably workable both on the desk top and on mobile devices. There is still a fairly long way to go with it so it will be getting better over time. And, I have also been able to jam the framework into the work I am doing at my day job as well (sorry that is private so no peeking).

And of course there is a whole handful of other things clambering for my attention. Hopefully, this is the best list for me to focus on and I'll be able to hold off on expanding it until I have a decent understanding of these...

Where did that piece of paper go...

I am sure that you have been waiting with bated breath to find out if I would actually finish an app for Android.

Well, I did! Actually, I finished the first version of it months ago. And, it is even available in the Play store (https://play.google.com/store/apps/details?id=net.jnwd.origamiFinder).

I had hoped to make it completely amazing before I officially told anyone about it so that I would not attract too much attention before it was 'ready'.

Well, work and a thousand other things got in the way of making the improvements that I had hoped to do - so...Here is the official announcement. If you are interested in finding what publications contain the directions to fold a particular origami model without being attached to the internet - then this is the app for you.  I didn't even have a chance to set up advertising in it. So, it is free and free of advertising too!

If you take a look, please leave some sort of review. I really would like to make it better in a lot of ways. But, if I am out in left field about people wanting it - then it will probably languish while I direct my attention toward other things.