views:

9

answers:

1

I am trying to write some custom Serializers for an Oracle XSQL Servlet. I'm trying to keep my two serializers within the local .ear because they are still being developed and tested and I don't want to hurt production code. However, I am getting the following error

XML-25021: Serializer XLSv2 is not defined in XSQL configuration file

Directory Listing of .war/WEB-INF looks like

classes/
        scott/
              XLSv2Serializer.class
              XLSXSerializer.class
lib/
    <empty>
web.xml
MyConfig.xml

My WEB-INF/web.xml looks like:

<web-app>
  <display-name>demoSerializer</display-name>
  <distributable />
    <init-param>
        <param-name>xsql.config</param-name>
        <param-value>MyConfig.xml</param-value>
        <description>use my dev config file</description>
    </init-param>
</web-app>

MyConfig.XML looks like:

<XSQLConfig>
  <serializerdefs>
    <serializer>
      <name>XLSv2</name>
      <class>scott.XLSv2Serializer</class>
    </serializer>
    <serializer>
      <name>XLSX</name>
      <class>scott.XLSXSerializer</class>
    </serializer>
  </serializerdefs>
</XSQLConfig>

What am I missing something?

A: 

Figured it out. First, I switched

<?xml-stylesheet serializer="{@serializer}"?>

to

<?xml-stylesheet serializer="java:scott.XLSXSerializer"?>

which forced it to look within WEB-INF/classes. Since I don't have access edit the XSQLConfig and my serializers are local to the .war, I am throwing it up to a small annoyance that I have to manualy change the serializer when testing.

After this I was getting a "Serializer could not be loaded Error".

Apache POI ooxml requires xmlbeans. The second problem was that xmlBeans was not being found on the server and thus the Serializer would quietly die and never be loaded. For some reason the Exception that was being thrown was not getting into the log. After moving code around, mainly where the workbook was being created, I finally saw the exception. The fix was putting xmlbeans in the lib directory within the WEB-INF/

Finally a side note: how I override the xsql.config was never working, even though the documentation says it should. I found this out by knowingly writing malformed XML in MyConfig.XML. The app still deployed and ran fine when it should have failed.

If anyone knows of a way to override the XSQLConfig.xml for a single .ear, I would love to hear it.

Scott