Using FSDMsg in an Application server

45 views
Skip to first unread message

Paul Irving

unread,
Apr 26, 2017, 8:20:22 AM4/26/17
to jPOS Users
Hi,

This is a high level question about using FSDMsg when deploying to an application server.

For my ISO projects using ISOMsg the packagers are read using this:

public static ISOPackager getPackager(final String filename) throws ISOException {  
        InputStream is = XmlPackagerFactory.class.getResourceAsStream("/com/mypackage/jpos/packgers/xml/" + filename);  
        return new GenericPackager(is);  
}

For the FSDMsg I want to include the xml files as part of the jar, so I retrieve them using:

public static final URL BASE = XmlFSDSchemaFactory.class.getResource("/com/mypackage/jpos/packgers/xml/FSDMsg/")
public static final String PROTOCOL = "file:";

Now this works happily for a stand alone java application, but when the jar is deployed into an application server, the path retrieved is incorrectly. However, if I use the following in the app server:

InputStream is = XmlFSDSchemaFactory.class.getResourceAsStream("/com/mypackage/jpos/packgers/xml/" + filename);

then the path to the file is always correct and the I can read the XML schema as an inputStream. So it seems getResourceAsStream is more portable than getResourceAsStream for some reason.

As my application needs to run standalone or deployed in an App server could anyone recommend a 'portable' way of getting the XML schema file paths?? Or a way of using an input stream instead of file paths??

Thanks in advance

Paul


Alejandro Revilla

unread,
Apr 26, 2017, 6:06:25 PM4/26/17
to jPOS Users

Take a look at FSDMsg implementation, in particular the loadSchema message around line 605:

https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/util/FSDMsg.java#L605

If the schema prefix is jar: it picks it from the classpath.

Let us know if that works for you.




Paul Irving

unread,
Jun 16, 2017, 8:19:59 AM6/16/17
to jpos-...@googlegroups.com
Hi Alejandro,

Apologies in the delay, but this works perfectly, thank you.

I still have other issues, but that's for another question :-)  

Paul

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/GQUrRQTUhCU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jpos-users+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dm7O%2B3Zr43B2aY-P%3D3UUt6tHiNLjx2%2BYx9T79SmjjZ-vg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Alejandro Revilla

unread,
Jun 16, 2017, 8:58:45 AM6/16/17
to jPOS Users
Awesome. Thanks for the heads-up.



You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages