Tomcat 5.5 Axis2 application scope problem - Unable to create single instance

白昼怎懂夜的黑 提交于 2019-12-13 18:45:49

问题


I have deployed an axis2 web service on Tomcat 5.5. The web service functions as expected. But I noticed I was getting duplicated log entries. After researching it became clear that multiple instances of the class were being created - ie the first time it ran, one log entry; second time, two entries and so on.

I added the scope="application" parameter, but that has not solved the problem. I added it both in the service tag and as a separate parameter tag to no avail.

This class has many key global variables, logging being one of them. Frustrated as I am, I still haven't gotten to the point of deconstructing the globals (major overhaul, breaks code conventions in my department). Are global variables the culprit? Or is there some other Tomcat/Axis2 config I am missing?

Will post services.xml or other code upon request.

Thanks in advance - Bill


回答1:


I have solved the problem...don't necessarily understand why but I now have the correct behavior...

The services.xml file I created as part of the web service (WEB-INF/services/myService/META-INF) was being overridden by config in tomcat/conf/server.xml, where I had previously only referred to myService with a context block. In order for myService to have unique service-level parameters, it has to have it's own config in tomcat/conf/server.xml...not just a context reference.

It seems to me that this is not the best config...services and contexts in server.xml. It's not dynamic that way. Unfortunately I am following a standard set here many moons ago, so nothing I can do.



来源:https://stackoverflow.com/questions/3777783/tomcat-5-5-axis2-application-scope-problem-unable-to-create-single-instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!