Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Friday, July 25, 2014

WSO2 DSS in Windows - accessing Oracle 11g requires the orai18n.jar

Okay, I should preface this post with the fact that I've seen as many connection strings and ways of connecting to Oracle as there are DB clients.  I don't think there is anything unusual about having trouble connecting to Oracle on a new application, and I expect connection methods may change with future oracle versions.

The Symptoms

You are attemting to connect to Oracle 11g R2 using the WSO2 DSS server running on Windows.  When attempting to add a datasource, you see an unusual error:

TID: [0] [DSS] [2014-07-24 17:47:05,125] ERROR {org.apache.axis2.rpc.receivers.RPCMessageReceiver} -  oracle.i18n.text.converter.CharacterConverterOGS.getInstance(I)Loracle/i18n/text/converter/CharacterConverter; {org.apache.axis2.rpc.receivers.RPCMessageReceiver}
java.lang.reflect.InvocationTargetException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
...
Caused by: java.lang.NoSuchMethodError: oracle.i18n.text.converter.CharacterConverterOGS.getInstance(I)Loracle/i18n/text/converter/CharacterConverter;
 

The Solution

Just like the stack dump indicates, there may be a missing method.  This appears to have something to do with Oracle 11g jdbc in Windows environments.  Oracle offers an additional jar for this scenario, namely orai18n.jar.  This file is needed in addition to the jdbc6 driver.  I found it offered on the same Oracle 11g site that offered the jdbc6 driver for that version.  Adding the orail18n.jar along with the driver should take care of the missing method, and allow you to connect to Oracle 11g.

Or, you could try running WSO2 DSS from *nix instead... Works like a charm there.

Cheers, Y'all!

WSO2 API Manager proxing without chunking

I recently was working with a client who had a backend server which could not accept chunked content. For example, this may occur with an early version Windows .NET framework backend.  If you have any backend server that can't chew a chunked http body, perhaps this post will help you.

The Symptoms: 

The backend server is not able to return a response to post or put HTTP calls.  If you disable chunking globally, the backend server may be unable to parse get requests.


The Solution:

Disable chunking, but only for post and put requests.  This can be done through customizing the velocity template by adding some custom logic.  The velocity_template.xml file is located in <InstallDir>/repository/resources/api_templates/ . Changing this file will affect future APIs created in API manager.

Changes to the Velocity template:

The sections of the API template that handle responses can filter them by HTTP method.  I've added a simple choice based on HTTP method, and added a new block for Posts and Puts that has this property:
   <property name="DISABLE_CHUNKING" value="true" scope="axis2"/>

The exact code was a bit big for a blog, so I put it in a Google Doc.  Please note that this will be out-dated pretty quickly.  It is written for WSO2 APIM 1.7.0.

https://drive.google.com/file/d/0B0dBKhEyYLmVQXlUbm84QWFNNzQ/edit?usp=sharing


Cheers, Y'all!