Thursday 10 January 2013

Setting Eclipse JDK

My problem

Recently I was attempting to use an Eclipse plugin that called an Ant build.xml (this ant build subsequently called a Maven task, but that's not too relevant here).  This ant build produced a very simple error (or so I thought), but this simple error saw at least 4 hours go down the drain.


My error in Eclipse, everything fine from the Windows 7 command prompt:
     [java] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.4:compile (default-compile) on project MyTest: Fatal error compiling: tools.jar not found: C:\Program Files\Java\jre7\..\lib\tools.jar -> [Help 1]


Searching for a solution (ask Google approach)

All the forums, Stackoverflow, JavaRanch, etc all suggest I simply set Java -> Installed JREs to a JDK, or put tools.jar in the ant classpath and that will resolve the problem...  Not so lucky, here's a short account of how I resolved this issue.  I hope this saves someone some time.


http://www.coderanch.com/t/105280/vc/set-jdk-version-eclipse
http://stackoverflow.com/questions/8749557/how-do-i-configure-jdk-for-eclipse
http://stackoverflow.com/questions/1288343/how-to-change-java-home-for-eclipse-ant
http://stackoverflow.com/questions/7321691/eclipse-ant-jdk-issue
http://www.dynamicobjects.com/d2r/archives/002591.html



My configuration

C:\ >echo %JAVA_HOME%
C:\Java\jdk1.7.0_07

I only have JDK’s installed in my eclipse (Window -> Preferences -> Java -> Installed JREs):



Debugging the problem

Debugging the problem was not quite as easy as it sounds.  I found the following "echoproperties" task to be the most useful technique.  When initially trying to run this I ran into a separate issue as Eclipse doesn't seem to fully change the Ant version when you set the Eclipse Ant home, but that's surely a separate problem and a separate blog. 

Added this little snippet to our build.xml:
    <taskdef name="echoproperties" classname="org.apache.tools.ant.taskdefs.optional.EchoProperties">
        <classpath>
            <fileset dir="${env.ANT_HOME}/lib">
                <include name="ant.jar" />
            </fileset>
        </classpath>
    </taskdef>
   <echoproperties prefix="java"/>
    <echoproperties prefix="ant"/>


Now for the solution

Seems that Eclipse sets the java.home property relative to the javaw executable.  Then ant attempts to use the java.home variable to find the tools.jar.  Very odd.

C:\>where javaw.exe
C:\Windows\System32\javaw.exe
C:\Java\jdk1.7.0_07\bin\javaw.exe

Run Eclipse
C:\>C:\eclipse\eclipse\eclipse.exe -data c:\eclipse\workspaces\interaction

[echoproperties] java.home=C\:\\Program Files\\Java\\jre7



Put JAVA_HOME right at the beginning of the PATH
C:\>set PATH=%JAVA_HOME%\bin;%PATH%

C:\>where javaw.exe
C:\Java\jdk1.7.0_07\bin\javaw.exe
C:\Windows\System32\javaw.exe

Run Eclipse (again)
C:\>C:\eclipse\eclipse\eclipse.exe -data c:\eclipse\workspaces\interaction

[echoproperties] java.home=C\:\\Java\\jdk1.7.0_07\\jre


Now it will work.

To use my plugin without any odd specification of the ant classpath, %JAVA_HOME%\bin needs to be the first thing in the path.

Thursday 3 January 2013

30 blogs in 30 days

I want to blog, I like the idea of writing, but I don't seem to be getting on with it.  So here's the plan - I'll kick of 2013 with 30 blogs (or videos) in 30 days.  My topics are:


IRIS

1.     SOA for Interaction

Overview of SOAP (RPC), Data Services (Objects), and Interaction (Hypermedia).  (If this blog post counts as one, and my first idea has already been somewhat covered then I'm certainly off to a great start.)

2.     Create mock responder

Starting with an existing EDMX, demonstrate how to create a mock responder

3.     CRUD user agent

Demonstrate the generic html5 user agent for simple CRUD operations.

4.     Data first using EDMX editor

Create a simple one to many, and many to many relationship with Visual Studio EDMX editor; generate the mock responder.

5.     OData mashups

Clone an existing odata service and incorporate an additional data feed from another OData source.

6.     Create a mashup

Create an interaction service that links to an external data service.

7.     Adaptive user agents using link rels

Use a simple google map example to demonstrate how a user agent could respond to a known or well established link relation and perform a user agent mashup.

8.     Adaptive OData/AtomPub user agent

Show how the ‘colleciton’, ‘item’, and ‘edit’ link relations can be used to build a generic user agent

9.     Adaptive non-CRUD user agent for an Enterprise application

New, See, History, Authorise, Reverse, Delete, Input
(SHARDI)

10.Adaptive User Agents and handing status codes during create requests

A look at the 201 (Created) & 202 (Accepted) status codes and how they could be handled by the user agent.

11.Adaptive User Agents and handling flow control / application state status codes

A look at the 303 (See Other) & 205 (Reset Content) status codes and how they can help instruct a user agent.

12.Adaptive User Agents and handling race conditions

A look at the 409 (Conflict) & 412 (Precondition failed) status codes and how they could be handled by the user agent.

13.Adaptive User Agents and missing resources

A look at how a user agent could handle a 404 (Not Found) status code.

14.Adaptive User Agents and unexpected errors

A look at how a user agent could handle 400 (Bad Request), 405 (Method Not Allowed), and 500 (Internal Server Error) status codes.

15.Adaptive User Agents and role based access to resources

Show how resource access can be controlled using roles.

16.Adaptive User Agents and link evaluation based access to resources

Show how resource access can be controlled by evaluating links and using a ‘security management’ resource.

17.Enterprise application techniques for guaranteed once only new / create operations

Show how the POST with token vs. the POST + PUT techniques can be used to guarantee once only creation of resources.

18.Enterprise application techniques for race conditions

Demonstrate the use of ETag to gracefully handle race conditions without resource manager locks.

19.Enterprise application techniques for alerts and warnings

Use a conditional link and a link relation to inform the user agent there are status messages or warnings.

20.Enterprise application techniques for error messages via exceptions

Demonstrate the use of an exception resource to respond to a request with error messages.

21.Enterprise application techniques for Entity validation

Demonstrate the use of forms and validation resources.

22.Demonstrate how to leveraging caching for high speed validation.

Demonstrate how to leveraging caching for high speed validation.

23.Enterprise application techniques for access control

Roles vs. access control resource

24.Forms & uri templates

Demonstrate the use of form media types and uri templates for greater user agent flexibility.

25.Caching

Demonstrate how to define resource caching rules.

26.Idempotent updates

Demonstrate idempotent updates.

27.Representing resources in HTML

Interact with resources using HTML.

28.Representing resources in XHTML

Interact with resources using XHTML.

29.Representing resources in HAL

Interact with resources using Hypertext Application Language (HAL).

30.Representing resources in Atom (OData)

Interact with resources using Atom and OData.

31.Configuring basic authentication

Configure basic authentication.

32.Accessing user principal in commands

Using the user principal in custom commands.



T24

1.     What does SOA mean for Integration?

Overview of SOAP, Message oriented middleware, and REST.

2.     What is the T24 integration studio?

Explain how someone might use TWS, T24 Events, and Data Services.  Publish and refer to example videos of TWS, Event designer and Data Service composer.

3.     T24 enquiry

Create example of T24 data service using Eclipse.

4.     T24 linked enquiry simple join

Example of simple Enquiry joins.

5.     T24 linked enquiry drill down (current variable)

Example of drill down enquiry ACCT.BAL.TODAY to NOSTRO.FWD.BAL

6.     T24 linked enquiry composite screen

Create an interaction service starting from a composite screen.

7.     T24 interaction from enquiry to other external data feed using generic OData commands

Create a mashup where a T24 enquiry is linked to an external feed i.e. Netflix, TAP, etc.

8.     T24 interaction from enquiry to other external data feed using custom commands

Link from T24 enquiry to any external feed i.e. twitter

9.     T24 interaction drop / rename columns from resource

Modify the resource to drop or rename a field.

10.T24 interaction with updatable T24 Versions

Create a data service with updatable entities.



Other

What a web api should do from http://www.programmableweb.com:
·        Support - Support for your teams interface becomes critical
·        Security - Every teams becomes a potential DOS attacker requiring service levels, quotas and throttling
·        Monitoring / QA - Monitoring and QA are interconnected, you will need smart tools for not just telling if something is up and running, but actually delivering the expected results
·        Discovery - Service discovery becomes important.  You will need to know what APIs there are, if they are available and where to find them.
·        Testing - Sandbox and debugging is essential for all APIs