What version of axis2 are you using? You don't seem to be using the
latest stable version 1.3, as line 58 is:
58 if (servletConfigParam == null) {
Furthermore, have you read this?
http://ws.apache.org/axis2/1_3/app_server.html
Your problem seems like its classloader related, ie, its possible by
following the instructions in the above link you can solve the
problem. While its been a while since I've used weblogic, some simple
googling show people have been running spring / axis2 / weblogic
successfully.
If all else fails, while I'm hesitant to patch axis2 for specific app
servers and would probably verify the problem myself first that
there's absolutely no other way - the first step would be getting your
code to compile with svn or a nightly:
http://people.apache.org/dist/axis2/nightly/
http://ws.apache.org/axis2/svn.html
HTH,
Robert
On Nov 12, 2007 6:22 AM, Diegoq Lin <[EMAIL PROTECTED]> wrote:
> hi all,
>
> I have a strange issue. I integrated axis2 and spring2.0.5. And I distributed
> the app on the tomcat5.5.20, it works well. but the same war package was put
> down the directory "autodeploy" of weblogic9.2, It didn't work and had many
> excetions. The most valueable exception is as follow:
>
> Caused by: java.lang.NullPointerException
> at
> org.apache.axis2.extensions.spring.receivers.SpringServletContextObje
> ctSupplier.getServiceObject(SpringServletContextObjectSupplier.java:58)
> ... 53 more
>
> I inquired the code in number 58:
> Parameter servletConfigParam = axisService.getAxisConfiguration()
> .getParameter(HTTPConstants.HTTP_SERVLETCONFIG);
>
> if (servletConfigParam == null) {
> throw new Exception("Axis2 Can't find ServletConfigParameter");
> }
> Object obj = servletConfigParam.getValue();
> ServletContext servletContext;
> if (obj instanceof ServletConfig) {
> ServletConfig servletConfig = (ServletConfig)obj;
> servletContext = servletConfig.getServletContext();
> } else {
> throw new Exception("Axis2 Can't find ServletConfig");
> }
> ApplicationContext aCtx =
> WebApplicationContextUtils.getWebApplicationContext(servletContext);
> any help would be appreciated.
>
> the method main function is just find out the spring application context in
> the servletContext properties.
> after servlet initialized phase, ConfigurationContext and AxisConfiguration
> objects are impossibly null. why axis2 get a null object? see the
> getAxisConfiguration method:
> public AxisConfiguration getAxisConfiguration() {
>
> if (this instanceof AxisConfiguration) {
> return (AxisConfiguration) this;
> }
>
> if (this.parent != null) {
> return this.parent.getAxisConfiguration();
> }
>
> return null;
> }
>
> the implementation of the method is the problem! I don't know how to do
> correctly. my temp solution that can make the application work on the
> weblogic is as follow:
>
> 1.add the bean in applicationContext.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
>
> <bean id="myVersion" class="sample.axisversion.Version" />
>
> <bean id="globalSpringContext"
> class="sample.axisversion.GlobalSpringContext" lazy-init="false" />
> </beans>
>
> 2.new the class GlobalSpringContext.java:
> package sample.axisversion;
>
> import org.springframework.beans.BeansException;
> import org.springframework.context.ApplicationContext;
> import org.springframework.context.ApplicationContextAware;
>
> public class GlobalSpringContext implements ApplicationContextAware {
> private static ApplicationContext ac;
>
> /* (non-Javadoc)
> * @see
> org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
> */
> public void setApplicationContext(ApplicationContext ac) throws
> BeansException {
> GlobalSpringContext.ac = ac;
>
> }
>
> public static ApplicationContext getApplicationContext() {
> return ac;
> }
> }
>
> 3.new the MyServiceObjectSupplier.java:
> package sample.axisversion;
>
> import org.apache.axis2.AxisFault;
> import org.apache.axis2.description.AxisService;
> import
> org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier;
> import org.apache.axis2.i18n.Messages;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.springframework.context.ApplicationContext;
>
> public class MyServiceObjectSupplier extends
> SpringServletContextObjectSupplier {
>
>
> private static Log log = LogFactory.getLog(MyServiceObjectSupplier.class);
> /**
> * Method getServiceObject that is Spring aware via ServletContext.
> *
> * @param axisService
> * @return Returns Object.
> * @throws AxisFault
> */
> public Object getServiceObject(AxisService axisService) throws AxisFault {
> try {
> String beanName =
> ((String)axisService.getParameter(SERVICE_SPRING_BEANNAME).getValue()).trim();
> if (beanName != null) {
> ApplicationContext aCtx =
> GlobalSpringContext.getApplicationContext();
> if (aCtx == null) {
> log.warn("Axis2 Can't find Spring's ApplicationContext");
> return null;
> } else if (aCtx.getBean(beanName) == null) {
> throw new Exception("Axis2 Can't find Spring Bean: " +
> beanName);
> }
> return aCtx.getBean(beanName);
> } else {
> throw new AxisFault(
> Messages.getMessage("paramIsNotSpecified",
> "SERVICE_SPRING_BEANNAME"));
> }
> } catch (Exception e) {
> throw AxisFault.makeFault(e);
> }
> }
> }
>
> 4.services.xml:
> <service name="Version">
> <description>
> This service is to get the running Axis version
> </description>
> <!--parameter name="ServiceClass">sample.axisversion.Version</parameter-->
> <parameter name="ServiceObjectSupplier" locked="false">
> sample.axisversion.MyServiceObjectSupplier
> </parameter>
> <parameter name="SpringBeanName" locked="false">myVersion</parameter>
>
> <operation name="getVersion">
> <messageReceiver
> class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
> </operation>
> </service>
>
>
> However i still want to know why it works on tomcat but it doesn't work on
> weblogic. Do you have any experience about it? Any help would be appreciated.
> thanks.
>
> Best Regards
>
> javafoot
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]