Configuring Infinispan CacheProvider in Seam 2.3

微笑、不失礼 提交于 2019-12-02 03:29:12

For anyone else having this issue, I've finally gotten all of the necessary pieces in place. Here's what I had to do...

  1. Do NOT declare the Infinispan module in your JBoss deployment structure file. Instead, use the JARs that are part of the Seam 2.3 distribution

  2. The WstxIOException itself is due to the fact that it was unable to locate my infinispan.xml configuration file. Place this in the Java source directory so it becomes a direct part of your classpath, not in your META-INF or WEB-INF directories (unless you declare it as such in your components.xml file)

  3. Make sure you have all of the XML parsing JARs (stax, etc.) from the Seam 2.3 distribution in your EAR

I was having the same issue: com.ctc.wstx.exc.WstxIOException: Stream closed

But I am using Maven 3.2, JBoss WildFly 8.2 (with embedded Infinispan Cache v7.1.1.Final), Axis2 in my project. Since I was using Axis2 and could figure out that the error is coming from WoodStox (wstx-asl.3.2.8.jar to be specific) which is used by Axis2, I initially thought this was because of some dependency issues with Axis2, WildFly and Maven.

But after much researching, I found out from the complete stacktrace that the root cause was java.io.IOException and not actually the "com.ctc.wstx.exc.WstxIOException: Stream closed" error message I was getting (WAR was getting deployed successfully, but Cache was not getting set). Had a look into the source code for wstx-asl.jar and found that it was receiving the BufferedInputReader as null. That hint and the above answer from Shadowman prompted me to check whether Infinispan CacheManager was getting the config file properly when I was initializing the Cache.

There was an issue with it not getting the Infinispan config file within my classpath, so had to place it within /WEB-INF/infinispan.xml and it worked!

So though the error we receive is for WoodStox, please check Infinispan cache config file (or any other file) is properly found by your program (whether as a Resource or physical path).

Hope this helps anybody else having similar issue.

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