Sunday 15 April 2012

Unexpected end of file while parsing Name has occurred. Line 1, position 2048.

This SQL 2008 error occured when I tried to read XML using the executeXmlReader() method.

Turned out that it reads in chunks of 2KB or 2048 bytes. So if you close the database connection before using the resulting reader then you will only get those first 2KB.

Resolution:
Leave your SQL database connection open while using the reader and only close it after this.

Wednesday 7 March 2012

Business Objects - Utility for removing unwanted crystal reports instances

Once I had about 3 million instances created by a rogue BOBJ server.
I needed to remove these instances but could not swallow the idea of clicking "delete" on each one.

I created this program in under two hours to do the work for me. Its not perfect by a long shot, its a quick and dirty utility like many others that i make. As long as it does the job, i'm ok with the ugly design.

You will need Microsoft Visual Studio 2010 and have the BOBJ .NET SDK library installed.

Download from BOBJ instance delete utility

Sunday 7 August 2011

Eclipse 3.7 JBoss AS 7 server runtime error - "directory does not exist or is missing run.jar"

It turns out that I had a problematic JBoss Tools version in Eclipse 3.7.
What I did was:
Update my JBoss Tools:
Go to Help>Install New Software..->Add
In the "Location", add this url: http://download.jboss.org/jbosstools/updates/nightly/trunk/
Select all checkboxes and complete the install (this should update or install your tools)
After the tools update:
Next, I had to delete all 7.0 servers and  "JBoss 7.0 Runtime" settings in Eclipse
Window->Preferences->Server->Runtime environments


Then I created a new server runtime environment:
Window->Preferences->Server->Runtime environments
Supply your JBoss AS root directory (mine was C:\jboss\jboss-as-web-7.0.0.Final)
Make sure to select the "Create a new local server" checkbox
Create a server:
File->New->Other->Server->Server->JBoss Community->JBoss AS 7.x
Select your newly created runtime configuration, click next and finish.

Server should run with no problems!

Thursday 4 August 2011

Installing JBoss Developer Studio (Eclipse)

In the last post we looked at how to prepare our environment to run JBoss Enterprise Service Bus on JBoss Application Server and trying out the HelloWorld sample project.
This time we will perform the last step in getting our computer ready for some real development by installing and configuring the JBoss Developer Studio.

DOWNLOADING AND INSTALLING
Got http://devstudio.jboss.com/download/ and download the free edition. You may need to register with RedHat before you can download it.
I got the JBoss Developer Studio 4.0.0 Stand Alone Windows Binary and then installed it. Just take all the defaults.
Fast Forward>> Once this is complete, start the studio, go to Window->View->Other->Servers->OK
Go to the Servers view and right-click, select "New->Server". Navigate to JBoss Community->JBoss AS 4.2
In the Home Directory, I put in my path to the application server's root which is C:\jboss\jboss-4.2.3.GA\jboss-4.2.3.GA and then selected the JRE to "jdk1.6..." Yours may be slightly different. In Configuration select "default" and accept the rest of the defaults to completion.
Select the new server and click "Start" (but make sure you dont have the AS server running in a command window elsewhere first), it should create a server at http://localhost:8080. Check the address out and make sure there is a website there.

If you didnt see the JBoss references in your JBoss Developer studio, then you may need to install the plug-ins.
 In this case you need to go to Help->Install New Software...->Add->Location".
Paste this - http://download.jboss.org/jbosstools/updates/nightly/trunk/ and click ok then add the JBossAS tools.

In the next post we will start working with our own HelloWorld application to understand the concepts of the enterprise service bus.

JBoss Enterprise Service Bus - Getting started (For the rest of us)

My experience of integrating enterprise software systems have driven me to write this blog.
I have used iBOLT Special Edition for SAP Business One for about 6 years, and I have respect for this platform. But, I have been at the wrong end of the customer's pointing finger enough times to decide that I will venture out and look for a more stable system. iBOLT is a great product for rapid development and stitching systems together. Having said that

The main pain points in using iBOLT in my experience have been:
  • When a iBOLT project interacts with an SAP B1 component, certain errors (depending on the versions) can cause the iBOLT server to literally terminate itself with no hope of recovering until you restart it.
  • You cannot reuse your developments in many projects (in a practical way) without plenty of work.
  • A big transaction (say 500 plus item rows in a Sales Order) can bring your entire SAP Business One database to a standstill blocking all other users while it does its thing
  • Monitoring a workflow is alot of extra work - its cheaper to simply send notifications about failures and keep retrying failed transactions.
So what are the goals, you ask? I want an integration platform to be all of the following:
  • Reliable - I must not be a gatekeeper and have to keep checking if the service is down and need to manually restart it
  • Force best practice - every different system to be integrated must expose its integration points as services, serious loose coupling
  • Reusable - all my development work must be reusable elsewhere easily
  • Agnostic design - I must not have to redevelop much if the business requirement suddenly requires transfering the source file via FTP rather than HTTP, so a component processing the file's contents must not care whether the data is coming via a different channel
  • Never lose a transaction - I dont care how long it runs or what errors it encounters, the system's workflow must never mysteriously drop a transaction
  • Traceability - I must be know (without a great deal of effort) what stage a long-running transaction is in, wherever that is in the organization's bounds
If JBoss ESB is any good, I am pretty sure that I will discover some "goals" as Iadvance in my quest.

I have an excellent mind for discovering things, and an even better one at forgetting them.
In this series of posts I will try and replicate (in as few steps as humanly possible) the steps to getting SAP Business One to work with JBoss ESB and JBoss AS. Many of the steps below have been borrowed from http://docs.jboss.org/jbossesb/docs/4.8/manuals/html/GettingStarted.html and I am using Windows 7 Pro.


Preparing my environment
JAVA:
Get a Java Development Kit (JDK 6) from http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Test your installation by typing the following command in the Windows command prompt:
>>java -version
It should report a version number to you, something like "java version "1.6...."
If not, you must check your environment variable (PATH). To do this, go to
Control Panel->System->Advanced System Settings->Environment Variables->System Variables.
Look for "Path" and edit that value to include the path to your JDK bin directory. Mine is :
;C:\Program Files\Java\jdk1.6.0_25\bin

ANT:
Get a stable binary distribution of ANT from http://ant.apache.org/and install.
My version is the 1.8.2 binary distribution. Add the ANT_HOME environment variable to Windows:
Mine is -
ANT_HOME=C:\jboss\apache-ant-1.8.2
Then go back to the "PATH" variable and append the Ant bin directory:
;%ANT_HOME%\bin
You might have to log off your session and back on to make sure the changes take effect.
 Now test you Ant installation by typing this command anywhere in the command window:
>>ant
You should get the following error:
Buildfile: build.xml does not exist!
Build failed

Thats a great error!

JBoss ESB
Next download and install(simply extract from archive) JBoss ESB (http://labs.jboss.com/portal/jbossesb/downloads). There are so many options with JBoss so dont just get the first distribution you see, you will lose valuable bandwidth. There are three types of distribution:
jbossesb-server-{version}, jbossesb-{version} and jbossesb-{version}-src
Choose the jbossesb-{version} because we are going to deploy it and not run it as standalone, which is what jbossesb-server-{version} is for.
We will run the JBoss ESB from the JBoss Application Server so go ahead and download this from http://sourceforge.net/projects/jboss/files/JBoss/JBoss-4.2.3.GA/ and extract, mine is in:
C:\jboss\jboss-4.2.3.GA\jbossesb-4.10

Next we will get the ESB to be deployed in the JBoss application server. To do this we need to tell Ant to do all the hard work.
Go to your ESB installation's  "install" directory (mine is C:\jboss\jbossesb-4.10\jbossesb-4.10\install).
There is a configuration file there named deployment.properties-example. Copy that file and rename it to deployment.properties. Open your newly copied file and give it the path to your JBoss AS installation.
Mine reads:  
org.jboss.esb.server.home=C:/jboss/jboss-4.2.3.GA/jboss-4.2.3.GA
and the JBoss AS configuration to use can be left like this:
org.jboss.esb.server.config=default

Save the file and then using your command window, change directory to the install directory
Mine is (CD C:\jboss\jbossesb-4.10\jbossesb-4.10\install)
then type
>>ant
Now Ant will package the ESB and plug it into the AS deploy directory.
I checked mine in C:\jboss\jboss-4.2.3.GA\jboss-4.2.3.GA\server\default\deploy

Moment of truth
Now you can start your JBoss AS server
Change directory to the bin : (Mine is C:\jboss\jboss-4.2.3.GA\jboss-4.2.3.GA\bin)
Then type
>>run
JBoss should then roar to life (it says alot of stuff that means nothing to me). Towards the end of the messages, you should see something like "..INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080"
Now we are cooking with gas, mate!
Go ahead and test your hard work, open your browser and point to http://localhost:8080/
"BOO-YAH!!!" - Ok, maybe not so exciting but it took me two days to get it this easy, lucky for you.
If you go to http://localhost:8080/web-console/ you will see a menu on the left hand side. Expand "J2EE Domains->jboss management local->JBoss"
There, look for references to "jbossesb-registry.sar, jbossesb.sar,jbrules-service.xml and jbpm-service.xml".

JBossESB ships with a number of standard service archives:

    jbossesb.esb - internal services like the DeadLetterService,
    jbrules.esb - needed for rules evaluation using JBossRules, for services like the Content-Based Router, and
    jbpm.esb - needed for default provider of Business Process Management jBPM.

The Hello World QuickStart

This QuickStart allows you get up and running with JBossESB, out of the box. It is located in the ESB distribution under samples/quickstarts/helloworld.
To run this QuickStart:
  1. Start your Server(if not running already) in a way that allows you to view the output console. If you are on Windows, it is preferable not to run JBoss as a Windows Service for the purposes of this guide.
  2. From a command terminal window, change directory into the samples/quickstarts/helloworld directory.
  3. Make sure that install/deployment.properties has the correct configuration and home directory settings for your server -- just a note, you have already done this step
  4. Type “ant deploy” to deploy the helloworld .esb package archive to your application server.
  5. Type “ant runtest”.
  6. Switch back to your application server's console. You should soon see a “Hello World” message appear in your application server's console.
  7. That's it! The QuickStart ran successfully. Your environment is properly configured for JBossESB.


 The HelloWorld logic is depicted in this url (http://docs.jboss.org/jbossesb/docs/4.8/manuals/html/GettingStarted_html_m1db87d1e.gif)
In my next post, we will install the development studio (JBoss Developer Studio) and link to our spanking new JBoss application server.