Thanks for all you help. I finally got it working!
In the end though I realized it was going to be a deployment nightmare
copy all the files around.
So I went back and put everything in an .aar archive including Spring.
To solve my original problem of needing to process the servlet context I
just modified
the SpringInit class from the examples to:
public void startUp(ConfigurationContext ctx, AxisService service) {
ClassLoader classLoader = service.getClassLoader();
ServletContext sc = (ServletContext)
ctx.getProperty("transport.http.servletContext");
String contextConfigLocationParm = (String)
service.getParameterValue("contextConfigLocation");
String contextConfigLocation = DEFAULT_CONFIG_LOCATION;
if (contextConfigLocationParm != null) {
logger.info("Loading Spring from file
"+contextConfigLocationParm+" (user-specified in services.xml)");
contextConfigLocation = "classpath:" +
contextConfigLocationParm;
} else {
logger.info("Loading Spring from default location
"+contextConfigLocationParm);
}
XmlWebApplicationContext appCtx = new XmlWebApplicationContext();
appCtx.setClassLoader(classLoader);
appCtx.setConfigLocation(contextConfigLocation);
appCtx.setServletContext(sc);
appCtx.refresh();
if (logger.isDebugEnabled()) {
logger.debug("\n\nstartUp() set spring classloader via
axisService.getClassLoader() ... ");
}
}
where:
private static final String DEFAULT_CONFIG_LOCATION =
"classpath:applicationContext.xml";
Now everything seems to work just fine.
My suggestion for the Axis2 team would be to place a couple of useful
SpringInit beans in a jar
so users could just refer to them in their services.xml file.
Barry
On 9/12/2011 3:13 PM, robert lazarski wrote:
On Mon, Sep 12, 2011 at 4:06 PM, Barry Hathaway<bhath...@nycap.rr.com> wrote:
I'm still confused.
My POJO-based service resides in:
$CATALALINA_HOME/webapps/axis2/WEB-INF/services
I updated $CATALALINA_HOME/webapps/axis2/WEB-INF/web.xml
to add the listener and contextParm. Spring now complains that it
cannot find the bean for my service (com.x.x.x.x)
since it now lives under the services subdirectory.
Barry
The docs for spring via a servlet container list the service classes (
in your case, com.x.x.x.x) under WEB-INF/classes. There are reasons to
put your classes in in the AAR, but imho its more dificult and not
often not needed.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org