Unable to start JPOS in my Eclipse by manually initiating Q2

210 views
Skip to first unread message

Adnan Sohail

unread,
Sep 27, 2019, 7:22:42 AM9/27/19
to jPOS Users
Hi,

I am unable to start Q2 in my application. In the main class, I am first initializing other miscellaneous stuff and then initializing Q2 using below code. The Q2 starts but renames all *.xml files in deploy directory to *.xml.BAD. Q2 logs no error, hence the reason is unknown. Can anybody tell and guide, what's going on?

How can I start Q2 in my Java application manually after initializing other dependent services?


private static void initJPos() throws InitializationException {

LGR.info(() -> "Initializing JPOS...");


try {

Q2 q2 = new Q2(ConfigProperties.JPOS_HOME_DIR);

q2.start();

LGR.info(() -> "JPOS has been initialized successfully...");

}

catch (Throwable e) {

LGR.error("Unable to initialize JPOS due to", e);

throw new InitializationException(e);

}

}


Regards,
Adnan Sohail

chhil

unread,
Sep 27, 2019, 8:52:41 AM9/27/19
to jpos-...@googlegroups.com
The way I do it is have the jpos jar on the classpath and use Q2 class from the jar as the main class to run in the eclipse  configuration to start Q2. 

The deploy folder etc must be relatively present, or you can pass it using command line options inside your ide with deploy dir location.

-chhil

--
--
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 the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/cb646400-b326-4a69-9ab3-fcd9521c1c82%40googlegroups.com.

Adnan Sohail

unread,
Sep 27, 2019, 9:02:07 AM9/27/19
to jPOS Users
Dependent jars are already included in the class-path. However, on debugging further by attaching JPOS source, I got the know that it is failing while reading *.xml files and throwing below error.

org.jdom2.JDOMException: http://apache.org/xml/features/xinclude feature not recognized for SAX driver org.apache.xerces.parsers.SAXParser

I am still looking on a solution to fix it.

Regards,
Adnan Sohail
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-...@googlegroups.com.

Alejandro Revilla

unread,
Sep 27, 2019, 10:27:32 AM9/27/19
to jPOS Users
Can you share with us your stacktrace ?

Adnan Sohail

unread,
Sep 27, 2019, 11:33:30 AM9/27/19
to jPOS Users
JPOS is not giving any exception however upon debugging by attaching source, I found that the below method of org.jdom2.input.SAXBuilder is giving below exception. The below method is being invoked from from inside when org.jdom2.input.SAXBuilder.build(File) method will be invoked from Q2.deploy(File) method.

org.jdom2.JDOMException: http://apache.org/xml/features/xinclude feature not recognized for SAX driver org.apache.xerces.parsers.SAXParser


private void internalSetFeature(final XMLReader parser, final String feature,

final boolean value, final String displayName) throws JDOMException {

try {

parser.setFeature(feature, value);

} catch (final SAXNotSupportedException e) {

throw new JDOMException(

displayName + " feature not supported for SAX driver " + parser.getClass().getName());

} catch (final SAXNotRecognizedException e) {

throw new JDOMException(

displayName + " feature not recognized for SAX driver " + parser.getClass().getName());

}

}



When I start Q2 directly i.e. not from Eclipse, this exception does not occur. Can you help me resolve the issue?

Regards,
Adnan Sohail

Alejandro Revilla

unread,
Sep 27, 2019, 3:35:31 PM9/27/19
to jPOS Users
Problem seems to be with your dependencies that are probably overriding those defined by jPOS. Perhaps an old xerces lying around.




--
--
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 the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/8f31fe2a-9da3-4f01-b7d8-54f7722c5f85%40googlegroups.com.

Adnan Sohail

unread,
Sep 30, 2019, 10:56:23 AM9/30/19
to jPOS Users
Yes this might be the reason. My eclipse is creating some issues. I am still unable to find a resolution.

Regards,
Adnan Sohail
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-...@googlegroups.com.

Alejandro Revilla

unread,
Sep 30, 2019, 1:24:14 PM9/30/19
to jPOS Users
I use IntelliJ as my IDE, but I don't run jPOS from it, I run it outside the IDE. You can do that with Eclipse, or VSCode (which BTW, I hear works very well).


Adnan Sohail

unread,
Oct 1, 2019, 4:04:00 AM10/1/19
to jPOS Users
Outside of IDE, it is working fine in my case too. But I want to debug my JPOS application, which is why I'm trying using Eclipse.

I think Eclipse is not correctly loading the maven dependencies or conflicting with older version of xerces. I have invested a lot of time on resolving this issue, tried a couple of things but didn't work.

Including dependencies manually and not through maven might be the only thing left.

regards,
Adnan Sohail

Alejandro Revilla

unread,
Oct 1, 2019, 5:22:55 PM10/1/19
to jPOS Users
I think a good tradeoff would be to catch these exceptions from the jPOS side if the feature is not available.

If you can file an issue and provide (again - I know you have provided it already, sorry) the stacktrace, I can work on it.




--
--
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 the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/8780e841-f8ff-42c2-a346-33513b958f8f%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages