Glad its working for you. However, the Service interface no longer
works like that in 1.1 RC2. Seems you may be using an older tutorial
and an older nightly, other than the links I passed. Furthermore, the
'composite' param explained in the tutorial could handle the
classloading issues you are resolving yourself. Just a few tips since
you are largely on the right track, as we spent a lot of time getting
those classloading issues working right accross a wide range of use
cases along with the startUp() changes thru several jiras.
Cheers,
Robert
On 11/3/06, John Pfeifer <[EMAIL PROTECTED]> wrote:
I found a solution that works... If you follow the instructions for
Axis2-Spring integration you will have a class called SpringInit. If you
look at the code below, it gets the context classloader, saves a reference
to it, sets the context classloader with the deployment classloader, loads
the spring config files then sets the context classloader back to the webapp
classloader. Seems to work fine.
public class SpringInit implements Service {
public static final String SPRING_CONTEXT_FILE_NAMES =
"springContextFileNames";
private static Log logger = LogFactory.getLog(SpringInit .class);
// The web service
public OMElement springInit(OMElement ignore) {
return null;
}
public void init(ServiceContext serviceContext) {
}
public void setOperationContext(OperationContext arg0)
{
}
public void destroy(ServiceContext arg0) {
}
/**
* this will be called during the deployement time of the service.
irrespective
* of the service scope this method will be called
*/
public void startUp(ConfigurationContext ignore, AxisService service) {
ClassLoader contextCl =
Thread.currentThread().getContextClassLoader();
ClassLoader classLoader = service.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
String[] springContextFiles =
getSpringContextFileNames(service.getParameter(SPRING_CONTEXT_FILE_NAMES).getValue().toString(),
classLoader);
ClassPathXmlApplicationContext appCtx = new
ClassPathXmlApplicationContext(springContextFiles,
false);
ApplicationContextHolder contextHolder = new
ApplicationContextHolder();
contextHolder.setApplicationContext(appCtx);
appCtx.setClassLoader(classLoader);
appCtx.refresh();
Thread.currentThread().setContextClassLoader(contextCl);
if (logger.isDebugEnabled()) {
logger.debug("\n\nstartUp() set spring classloader via
axisService.getClassLoader() ... ");
}
}
-----Original Message-----
From: John Pfeifer [mailto:[EMAIL PROTECTED]
Sent: Thu 11/2/2006 5:25 PM
To: [email protected]
Subject: Axis2 Spring Integration, Problems using
Below I have a snippet from my spring context file that I use in one of my
.aar files.
The application works fine when I don't use the ProxyFactoryBean, but when
I include it, I get a NoClassDefFoundException for the
foo.dao.PayCaptureContextDAO
I did some digging into the spring code and it looks like spring uses the
Context class loader to load these classes (and not the AAR deployment
classloader, which is where my jar file resides). Has anyone else
encountered this problem? If so, what was your solution?
I really need to make this work because my web service uses hibernate for
persistence and that code uses proxy's for declarative transactions.
<bean id="methodInvocationTimer" class="foo.MethodInvocationTimer"/>
<bean id="payCaptureContextDAOTarget"
class="foo.PayCaptureContextDAOImpl">
<property name="sessionFactory">
<ref local="bmlXASessionFactory"/>
</property>
</bean>
<bean id="payCaptureContextDAO"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>foo.dao.PayCaptureContextDAO</value>
</property>
<property name="interceptorNames">
<list>
<value>methodInvocationTimer</value>
</list>
</property>
<property name="target">
<ref bean="payCaptureContextDAOTarget"/>
</property>
</bean>
Thanks,
jp4
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]