How do we handle Nested Fields(127) with GenericPackagers

338 views
Skip to first unread message

mwyc...@gmail.com

unread,
Sep 1, 2009, 5:05:22 AM9/1/09
to jPOS Users
Hi all,

hoping you are fine.

I would to get some clarification on the following definitions;

Case 1:

<channel name="post.channel"
class="org.jpos.iso.channel.PostChannel"
packager="org.jpos.iso.packager.PostPackager" logger="Q2">
<property name="packager-config" value="cfg/postpack.xml" /
>
</channel>

Case 2:

<channel name="JM.channel"
class="JMChannel"
packager="org.jpos.iso.packager.GenericPackager" logger="Q2">
<property name="packager-config" value="cfg/iso87ascii-binary-
bitmap.xml" />
</channel>

Would I be right to say that the above two channels are both based on
GenericPackager definitions??

If yes, why is it that if I alter Case 2, and use (postpack.xml
instead of iso87ascii-binary-bitmap.xml), I get some errors which I
failed to interprete. Are the errors due to the fact that postpack.xml
has some nested definition for field 127?

New Case 2:
<channel name="JM.channel"
class="JMChannel"
packager="org.jpos.iso.packager.GenericPackager" logger="Q2">
<property name="packager-config" value="cfg/postpack.xml" />
</channel>

See errors below;
org.jpos.util.NameRegistrar$NotFoundException: server.postilion
at org.jpos.util.NameRegistrar.get(NameRegistrar.java:109)
at org.jpos.ui.factory.ISOMeterFactory.create
(ISOMeterFactory.java:81)
at org.jpos.ui.UI.createComponent(UI.java:438)
at org.jpos.ui.UI.create(UI.java:487)
at org.jpos.ui.factory.GridLayoutFactory.create
(GridLayoutFactory.java:85)
at org.jpos.ui.UI.createComponent(UI.java:438)
at org.jpos.ui.UI.create(UI.java:487)
at org.jpos.ui.factory.VSplitFactory.create(VSplitFactory.java:
73)
at org.jpos.ui.UI.createComponent(UI.java:438)
at org.jpos.ui.UI.create(UI.java:487)
at org.jpos.ui.factory.BorderLayoutFactory.add
(BorderLayoutFactory.java:93)
at org.jpos.ui.factory.BorderLayoutFactory.create
(BorderLayoutFactory.java:86)
at org.jpos.ui.UI.createComponent(UI.java:438)
at org.jpos.ui.UI.create(UI.java:487)
at org.jpos.ui.UI.create(UI.java:161)
at org.jpos.ui.UI.createComponent(UI.java:438)
at org.jpos.ui.UI.configure(UI.java:248)
at org.jpos.ui.UI.configure(UI.java:180)
at org.jpos.q2.ui.UI.startService(UI.java:76)
at org.jpos.q2.QBeanSupport.start(QBeanSupport.java:96)
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 com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2
(StandardMBeanIntrospector.java:93)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2
(StandardMBeanIntrospector.java:27)
.............................
.............................

How then should I define my channel and ISOServer to use
GenericPackager together with postpack.xml?

thanks&regards,

Mark Salter

unread,
Sep 1, 2009, 5:47:02 AM9/1/09
to jpos-...@googlegroups.com
mwyc...@gmail.com wrote:

> I would to get some clarification on the following definitions;
>
> Case 1:
>
> <channel name="post.channel"
> class="org.jpos.iso.channel.PostChannel"
> packager="org.jpos.iso.packager.PostPackager" logger="Q2">
> <property name="packager-config" value="cfg/postpack.xml" /
> </channel>
>
> Case 2:
>
> <channel name="JM.channel"
> class="JMChannel"
> packager="org.jpos.iso.packager.GenericPackager" logger="Q2">
> <property name="packager-config" value="cfg/iso87ascii-binary-
> bitmap.xml" />
> </channel>
>
> Would I be right to say that the above two channels are both based on
> GenericPackager definitions??

No, not at all.

The case 1 is using :-

packager="org.jpos.iso.packager.PostPackager"

leaving the property :-

<property name="packager-config" value="cfg/postpack.xml" />

ignored.

Case 2 is actually using :-

packager="org.jpos.iso.packager.GenericPackager"

so take the property "packager-config" into account.

>
> I get some errors which I
> failed to interprete. Are the errors due to the fact that postpack.xml
> has some nested definition for field 127?

The exception output below really has nothing to do with the
definitions above.


>
> New Case 2:
> <channel name="JM.channel"
> class="JMChannel"
> packager="org.jpos.iso.packager.GenericPackager" logger="Q2">
> <property name="packager-config" value="cfg/postpack.xml" />
> </channel>

Now you have a *new* case 2 - which *is* using a GenericPackager with
postpack.xml!?

>
> See errors below;
The following trace shows a deployed ui component trying to ask the
NameRegistrar for a component named 'postilion' - giving a name of
'server.postillion'.

You have not shown us a server deployment - do you have one? What is
it's name attribute?

> org.jpos.util.NameRegistrar$NotFoundException: server.postilion
Above, the name that could not be found.

[Exception stack snip]

> at org.jpos.q2.ui.UI.startService(UI.java:76)
> at org.jpos.q2.QBeanSupport.start(QBeanSupport.java:96)

Above, a q2 ui component being started.

>
> How then should I define my channel and ISOServer to use
> GenericPackager together with postpack.xml?

Your server deployment needs to exist (and be deployed) at the time the
ui component is deployed and asks the NameRegistrar for a server called
postilion

Please practise reading Exception stack traces...

... here it holds enough information for you to see that the server is
the missing component - not any Channel - perhaps it failed to deploy,
or has not been deployed at the time the ui looks for it?

--
Mark

mwyc...@gmail.com

unread,
Sep 2, 2009, 12:56:14 PM9/2/09
to jPOS Users
Hi Mark,

Thanks for the clarifications,
actually I removed the property <property name="packager-config"
value="cfg/postpack.xml" /> from Case 1 and it still worked fine.

However, I still don't understand why my server fails to start, if I
define it with a GenericPackager and postpack.xml
as the config file. meanwhile if the config file is iso87ascii-binary-
bitmap.xml, then it works.
The only difference is see between these two cofig files is that
iso87ascii-binary-bitmap.xml doesn't define field 127 as a nested
field while postpack.xml does.

Also in postpack.xml I see there is this packager definition
packager="org.jpos.iso.packager.GenericSubFieldPackager"> which I
think is meant for nested fields like 127.

Below is my server definition,

<server name="postilion" class="org.jpos.q2.iso.QServer" logger="Q2">
<attr name="port" type="java.lang.Integer">5052</attr>
<channel name="post.channel"
class="PostChannel"
packager="org.jpos.iso.packager.GenericPackager" logger="Q2">
<!--<property name="packager-config" value="cfg/iso87ascii-binary-
bitmap.xml" /> -->
<property name="packager-config" value="cfg/postpack.xml" />
</channel>
<request-listener class="Postilion" logger="Q2">
<property name="jdbc.url" value="jdbc:sybase:Tds:192.168.1.105:7000/
test_db" />
<property name="jdbc.driver"
value="com.sybase.jdbc2.jdbc.SybDriver" />
<property name="db.user" value="test" />
<property name="db.user.password" value="abcd" />
<property name="jdbc.charset" value="cp850" />
<property name="org.bin" value="12345" />
<property name="db.name" value="test" />
<property name="download.path" value="files" />
</request-listener>
</server>

regards,

On Sep 1, 12:47 pm, Mark Salter <marksal...@talktalk.net> wrote:
> Mark- Hide quoted text -
>
> - Show quoted text -

Mark Salter

unread,
Sep 2, 2009, 2:19:46 PM9/2/09
to jpos-...@googlegroups.com
mwyc...@gmail.com wrote:
>
> Thanks for the clarifications, actually I removed the property
> <property name="packager-config" value="cfg/postpack.xml" /> from
> Case 1 and it still worked fine.
That is because it was not being used, removing the property has no effect.

>
> However, I still don't understand why my server fails to start, if I
> define it with a GenericPackager and postpack.xml as the config file.
> meanwhile if the config file is iso87ascii-binary- bitmap.xml, then
> it works.

If the server fails to start, then that explains the :-

"
org.jpos.util.NameRegistrar$NotFoundException: server.postilion
at org.jpos.util.NameRegistrar.get(NameRegistrar.java:109)
at org.jpos.ui.factory.ISOMeterFactory.create
"

exception that you reported and I attempted to explain, the server is
not running so will not be registered with the NameRegistrar

For us to understand why the server is failing to start, we need to see
the log entries issued from server as it fails to start.

> The only difference is see between these two cofig files is that
> iso87ascii-binary-bitmap.xml doesn't define field 127 as a nested
> field while postpack.xml does.

I can only go on the detail posted...

... please provide any messages issued from the server as you deploy it
(when it doesn't 'work').

Consider deploying *just* the server to minimise the amount of logging
data you need to look through.


--
Mark

mwyc...@gmail.com

unread,
Sep 3, 2009, 6:48:21 AM9/3/09
to jPOS Users
Below are the log entries, as the server starts;

<log realm="org.jpos.q2.iso.QServer" at="Thu Sep 03 13:44:41 EAT
2009.968">
<warn>
error starting service
<iso-exception>
org.jpos.core.ConfigurationException: org.jpos.iso.ISOException:
org.xml.sax.SAXParseException: Attribute "validator" is required and
must be specified for element type "isofieldpackager".
(org.xml.sax.SAXParseException: Attribute "validator" is required and
must be specified for element type "isofieldpackager".)
(org.jpos.iso.ISOException: org.xml.sax.SAXParseException: Attribute
"validator" is required and must be specified for element type
"isofieldpackager". (org.xml.sax.SAXParseException: Attribute
"validator" is required and must be specified for element type
"isofieldpackager".))
<iso-exception>
org.jpos.iso.ISOException: org.xml.sax.SAXParseException:
Attribute "validator" is required and must be specified for element
type "isofieldpackager". (org.xml.sax.SAXParseException: Attribute
"validator" is required and must be specified for element type
"isofieldpackager".)
<iso-exception>
org.xml.sax.SAXParseException: Attribute "validator" is
required and must be specified for element type "isofieldpackager".
<nested-exception>
org.xml.sax.SAXParseException: Attribute "validator" is
required and must be specified for element type "isofieldpackager".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException
(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate
(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement
(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown
Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement
(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.jpos.iso.packager.GenericPackager.readFile
(GenericPackager.java:207)
at org.jpos.iso.packager.GenericPackager.setConfiguration
(GenericPackager.java:172)
at org.jpos.q2.QFactory.setConfiguration(QFactory.java:397)
at org.jpos.q2.iso.ChannelAdaptor.newChannel(ChannelAdaptor.java:198)
at org.jpos.q2.iso.QServer.newChannel(QServer.java:58)
at org.jpos.q2.iso.QServer.initServer(QServer.java:66)
at org.jpos.q2.iso.QServer.startService(QServer.java:95)
at org.jpos.q2.QBeanSupport.start(QBeanSupport.java:96)
....................................................
....................................................

its long, hope the above portion will suffice.

thanks&regards,

On Sep 2, 9:19 pm, Mark Salter <marksal...@talktalk.net> wrote:

Mark Salter

unread,
Sep 3, 2009, 10:56:27 AM9/3/09
to jpos-...@googlegroups.com
mwyc...@gmail.com wrote:
> Below are the log entries, as the server starts;
>
> <log realm="org.jpos.q2.iso.QServer" at="Thu Sep 03 13:44:41 EAT
> 2009.968">
> <warn>
> error starting service
> <iso-exception>
> org.jpos.core.ConfigurationException: org.jpos.iso.ISOException:
> org.xml.sax.SAXParseException: Attribute "validator" is required and
> must be specified for element type "isofieldpackager".

So the dtd you are using, states that "validator" is a #REQUIRED token
of a isofieldpackager, I suspect therefore you have changed something
(perhaps inadvertently) - this I recall you have done before.

Are you intentionally using any of the 'Validating' components in jPOS
at all? You have made no mention you are in any of the posts to date.

Please show us the DOCTYPE from your postpack.xml file, as well as the
content of the file it mentions...

As an example, the *base* postpack.xml file starts with:-

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE isopackager SYSTEM "genericpackager.dtd">

Here I would like to see the location and contents of the file
genericpackager.dtd.

In your case I think the DOCTYPE or the file, or the content of the dtd
have been changed by you? Let's see.

P.S. the dtd file would normally be in jpos/cfg/packager...

--
Mark

mwyc...@gmail.com

unread,
Sep 4, 2009, 5:14:34 AM9/4/09
to jPOS Users
Thanks so much Mark,

You are actually right, it seems there was something wrong with my dtd
or in the postpack.xml.
What I did was to pick the latest from the subversion and replaced all
that I had in my cfg/ folder( I normally use cfg/ and not cfg/
packager).
I also realised that the file generic-validating-packager.dtd was
missing from my cfg/ folder. I only had genericpackager.dtd

Now it starts well and in the log file I see;

<log realm="z4-server-PostBridge.server" at="Fri Sep 04 12:12:43 EAT
2009.31">
<iso-server>
listening on port 5052
</iso-server>
</log>

thanks so much once again.

regards,

On Sep 3, 5:56 pm, Mark Salter <marksal...@talktalk.net> wrote:
> mwycli...@gmail.com wrote:
> > Below are the log entries, as the server starts;
>
> > <log realm="org.jpos.q2.iso.QServer" at="Thu Sep 03 13:44:41 EAT
> > 2009.968">
> >   <warn>
> >     error starting service
> >     <iso-exception>
> >       org.jpos.core.ConfigurationException: org.jpos.iso.ISOException:
> > org.xml.sax.SAXParseException: Attribute "validator" is required and
> > must be specified for element type "isofieldpackager".
>
> So the dtd you are using, states that "validator" is a #REQUIRED token
> of a isofieldpackager, I suspect therefore you have changed something
> (perhaps inadvertently) - this I recall you have done before.
>
> Are you intentionally using any of the 'Validating' components in jPOS
> at all?  You have made no mention you are in any of the posts to date.
> th
Reply all
Reply to author
Forward
0 new messages