I have created 2 .war files which are deployed on Glassfish4. warA is hosted on virtual server A port 7171 and warB is hosted on virtual server B port 8181. I want warB to access warAs hashmap. I tried the solution on this link, but it didnt work:
(http://stackoverflow.com/questions/9446225/getting-two-servlets-to-use-t...)
Here is what I have tried so far:
1. I am able to get warB to access warAs hashmap when both of them are on the same virtual server however, when I move them to seperate ones, I get a NullPointerException error because warB cant access warAs hashmap.
2. I have added contextXmlDefault property with value ${com.sun.aas.instanceRoot}/config on both my virtual servers.
3. I have tried adding a separate context.xml file in the META-INF folder of each application but it gets erased when I clean and build it.
4. I have created a context.xml under domain1/config of my Glassfish folder. Its contents are:
<?xml version="1.0" encoding="UTF-8"?>
<Context crossContext="true">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
Is there anything else I need to do? I'm not sure what I'm missing.