axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Diegoq Lin" <diegoq...@dmxtechnologies.com>
Subject Re: axis2 with spring doesn't work on the weblogic, I have a temp solution
Date Tue, 13 Nov 2007 10:18:56 GMT
hi all,
I am so disappointed to tell you it didn't work according to what Robert said yet. The issue:

the standard war package without specific weblogic config file extracted into autodeploy dictionary
of weblogic9.2 did work well! But the war package didn't work. The exception as follow(by
the way I am using the axis2.1.3.):
Caused by: java.lang.NullPointerException
        at org.apache.axis2.extensions.spring.receivers.SpringServletContextObje
ctSupplier.getServiceObject(SpringServletContextObjectSupplier.java:58)
the corresponding code is : 
Parameter servletConfigParam = axisService.getAxisConfiguration().getParameter(HTTPConstants.HTTP_SERVLETCONFIG);

I am sure that axisService.getAxisConfiguration() was NULL!

I think http://ws.apache.org/axis2/1_3/app_server.html is stale. As the link inside the web
is still about weblogic8.1. The most thing is that It didn't work when I did it according
to the instruction.

config is below: 
the axis2.war\META-INF\weblogic-application.xml file : 
<?xml version="1.0"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <prefer-application-packages>
    <package-name>com.ctc.wstx.*</package-name>
    <package-name>javax.xml.*</package-name>
    <package-name>org.apache.*</package-name>
  </prefer-application-packages>
</weblogic-application>

the axis2.war\WEB-INF\weblogic.xml : 
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">
  <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
  </container-descriptor>
</weblogic-web-app>

whether the app is deployed by war package or not, the exception is :
java.lang.ClassCastException: com.ctc.wstx.stax.WstxInputFactory
        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136
)
        at weblogic.servlet.internal.WebAppHelper.addListenerElements(WebAppHelp
er.java:244)
        at weblogic.servlet.internal.WebAppHelper$IOHelperImpl.parseXML(WebAppHe
lper.java:224)
        at weblogic.descriptor.DescriptorCache.parseXML(DescriptorCache.java:324
)
        at weblogic.servlet.internal.WebAppHelper.registerTagLibListeners(WebApp
Helper.java:174)

Do you have any advice? Thank you very much.

Regards
javafoot


----- Original Message ----- 
From: "robert lazarski" <robertlazarski@gmail.com>
To: <axis-user@ws.apache.org>
Sent: Monday, November 12, 2007 8:57 PM
Subject: Re: axis2 with spring doesn't work on the weblogic, I have a temp solution


> Oh yeah, please follow the instructions in the link first and my
> general ideas. If that fails, any patches need to be put into a jira
> issue that you create. My guess though is that this is a weblogic
> classloader issue that can be solved via the link below.
> 
> Robert
> 
> On Nov 12, 2007 7:53 AM, robert lazarski <robertlazarski@gmail.com> wrote:
>> 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 <diegoqlin@dmxtechnologies.com> 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: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
Mime
View raw message