Author Message
ademcayir
Joined: Mar 2, 2017
Messages: 11
Offline
I am trying to use 7.0 SDK with 6.3 server. It works fine if I use it in a regular java project. But, when I try to use it in a web application, it freezes when I call ServiceProvider.getServiceProvider. As my investigation, DMCC SDK depends on mapping XMLs heavily. I can reproduce same behavior when I remove mapping XMLs from the java project. So, I guess, because of DMCC base classes could not load mapping XMLs in web application, it freezes.

So, how should I use mapping XMLs in web application?
MartinFlynn
Joined: Nov 30, 2009
Messages: 1921
Online
The DMCC client uses the various mappings.xml files in order to be able to use older versions of the DMCC protocol. In order to do this, it must be able to find and load these files. Normally, placing them in the classpath is enough and the DMCC client can load them using:
URL file = this.getClass().getClassLoader().getSystemResource(mappingFile);.

However, I do know that a JBoss environment means that the files will not be found using this method. This means that it using the DMCC client in a JBoss environment can be problematic. It may be that there is a similar limitation with Tomcat.

Martin
SteVio
Joined: Dec 4, 2013
Messages: 22
Offline
I had a similar problem with a Spring-Boot application. I was only able to fix the problem using an older maven plugin from Spring Boot (1.3.8.RELEASE). From Intellji I could always start the application without any problems. Only the jar created by Spring could no longer be executed or the DMCC connection did not work.

With Spring-Boot it works with Tomcat as long I package it with the old maven plugin. The xml files are located in the resources folder.

Stefan
ademcayir
Joined: Mar 2, 2017
Messages: 11
Offline
the biggest problem is, SDK tries to load xml resources by this function

URL file = this.getClass().getClassLoader().getSystemResource(mappingFile);.

and, this makes impossible to load any resources on a web application. I am not sure how Spring-Boot works. It may run your application as a standalone (classic console app) app, and because of that, it may be able to load the XMLs.

I was also able to fix this issue, but I had to use some reflection and change this.getClass().getClassLoader().getSystemResource(mappingFile); to Thread.currentThread().getContextClassLoader().getResource(mappingFile)

SteVio
Joined: Dec 4, 2013
Messages: 22
Offline
Could you tell me how you solved this?

I did not use reflection so much.
Go to:   
Mobile view