I'm not entirely sure if we are running JAX-WS services as I am relatively
new to the codebase (and it is rather legacy, still working on
understanding it). That code snippet is correct. I believe it was set up to
work without a Servlet Context before (
https://axis.apache.org/axis2/java/core/docs/spring.html), but I had to
switch it to use a ServletContext after making the axis2.xml changes,
meaning that within our services.xml I changed the ServiceObjectSupplier
parameters from SpringAppContextAwareObjectSupplier
to SpringServletContextObjectSupplier. I considered investigating why it
didn't work as originally set up, but unfortunately I am constrained by a
timeline. I did not try your ServletContextInitializer code snippet.

Best,
Kevin

On Wed, Mar 10, 2021 at 11:10 AM robertlazarski <[email protected]>
wrote:

> For JAX-WS I think you may have just used this entry into axis2.xml?
>
> <deployer extension=".aar" directory="services"
> class="org.apache.axis2.deployment.ServiceDeployer">
> <serviceBuilderExtension name ="jwsbuilderExt"
> class="org.apache.axis2.jaxws.framework.JAXWSServiceBuilderExtension"/>
> <serviceBuilderExtension name ="wsdlbuilderExt"
> class="org.apache.axis2.deployment.WSDLServiceBuilderExtension"/>
> </deployer>
>
> On Wed, Mar 10, 2021 at 7:07 AM robertlazarski <[email protected]>
> wrote:
>
>> I see. I am looking at the docs now and am making some updates.
>>
>> Are you running JAX-WS services? How did you fix it? Did you use a
>> ServletContextInitializer like the code I pasted?
>>
>> I ask because I don't use JAX-WS myself, so I haven't run into the
>> problem.
>>
>> Regards,
>> Robert
>>
>> On Tue, Mar 9, 2021 at 11:44 AM Kevin Lee <
>> [email protected]> wrote:
>>
>>> Hey Robert,
>>>
>>> When I start work on upgrading a dependency between major versions that
>>> are expected to have breaking changes, I look towards the release
>>> documentation for the first major version release, which for 1.7 would be
>>> here <https://axis.apache.org/axis2/java/core/release-notes/1.7.0.html>.
>>> There is a section at the bottom that has several bullet points dedicated
>>> towards notable breaking changes, which I think is great. I propose that
>>> adding the contents of AXIS2-5340
>>> <https://issues.apache.org/jira/browse/AXIS2-5340> as a bullet point
>>> would be important as that seems to definitely be a notable breaking change.
>>>
>>> Best,
>>> Kevin
>>>
>>> On Tue, Mar 9, 2021 at 3:29 PM robertlazarski <[email protected]>
>>> wrote:
>>>
>>>> I'm not really sure how the axis2.xml docs could be in regards to this
>>>> issue - do you think you could contribute it?  Just paste what you have in
>>>> mind here if that is easier.
>>>>
>>>> On Tue, Mar 9, 2021 at 11:15 AM Kevin Lee <
>>>> [email protected]> wrote:
>>>>
>>>>> Hey Robert,
>>>>>
>>>>> I managed to upgrade successfully after finding that axis2.xml change,
>>>>> as the error messages for what to fix were fairly straightforward
>>>>> afterwards (before, the web service deployment appeared to be failing
>>>>> silently with a generic EPR reference cannot be found error). I think that
>>>>> axis2.xml deployer inclusion just needs to be more prominent in the
>>>>> documentation.
>>>>>
>>>>> Best,
>>>>> Kevin
>>>>>
>>>>> On Tue, Mar 9, 2021 at 2:59 PM robertlazarski <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> I was wondering if there are any spring boot users. I plan on writing
>>>>>> some docs as it is harder than it should be.
>>>>>>
>>>>>> I was able to successfully implement it though. Where are you stuck
>>>>>> exactly?
>>>>>>
>>>>>> Here's the main init code:
>>>>>>
>>>>>> package com.alphatheory.configuration;
>>>>>>
>>>>>> import com.mycompany.ATInit;
>>>>>> import org.apache.logging.log4j.LogManager;
>>>>>> import org.apache.logging.log4j.Logger;
>>>>>> import org.apache.axis2.transport.http.AxisServlet;
>>>>>> import org.springframework.boot.web.servlet.ServletContextInitializer;
>>>>>> import org.springframework.context.annotation.Configuration;
>>>>>> import
>>>>>> org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
>>>>>>
>>>>>> import org.springframework.core.annotation.Order;
>>>>>>
>>>>>> import org.springframework.beans.factory.annotation.Autowired;
>>>>>> import org.springframework.beans.factory.annotation.Value;
>>>>>> import org.springframework.context.annotation.Bean;
>>>>>> import org.springframework.context.annotation.PropertySource;
>>>>>> import
>>>>>> org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
>>>>>>
>>>>>> import javax.servlet.ServletContext;
>>>>>> import javax.servlet.ServletRegistration;
>>>>>>
>>>>>> import java.util.Set;
>>>>>>
>>>>>> @Configuration
>>>>>> @Order(4)
>>>>>> @PropertySource("classpath:application.properties")
>>>>>> public class ATWebAppInitializer implements ServletContextInitializer
>>>>>> {
>>>>>>
>>>>>>     private static final Logger logger =
>>>>>> LogManager.getLogger(ATWebAppInitializer.class);
>>>>>>     private static final String SERVICES_MAPPING = "/services/*";
>>>>>>
>>>>>>     @Value("${appInstance}")
>>>>>>     private String appInstance;
>>>>>>
>>>>>>     @Value("${appInstanceIP}")
>>>>>>     private String appInstanceIP;
>>>>>>
>>>>>>     @Value("${prodKillSwitchEnabled}")
>>>>>>     private String prodKillSwitchEnabled;
>>>>>>
>>>>>>     @Override
>>>>>>     public void onStartup(ServletContext container) {
>>>>>>         String logPrefix = "ATWebAppInitializer , appInstance: " +
>>>>>> appInstance + " , ";
>>>>>>         logger.warn(logPrefix + "inside onStartup() ...");
>>>>>>         // Create the 'root' Spring application context
>>>>>>         AnnotationConfigWebApplicationContext ctx = new
>>>>>> AnnotationConfigWebApplicationContext();
>>>>>>
>>>>>>         addAxis2Servlet(container, ctx);
>>>>>>         addATInitServlet(container, ctx);
>>>>>>         logger.warn(logPrefix + "onStartup() completed ...");
>>>>>>     }
>>>>>>
>>>>>>     private void addAxis2Servlet(ServletContext container,
>>>>>> AnnotationConfigWebApplicationContext ctx) {
>>>>>>
>>>>>>         ServletRegistration.Dynamic dispatcher = container.addServlet(
>>>>>>           "AxisServlet", new AxisServlet());
>>>>>>         dispatcher.setLoadOnStartup(1);
>>>>>>         Set<String> mappingConflicts =
>>>>>> dispatcher.addMapping(SERVICES_MAPPING);
>>>>>>         if (!mappingConflicts.isEmpty()) {
>>>>>>             for (String s : mappingConflicts) {
>>>>>>                 logger.error("Mapping conflict: " + s);
>>>>>>             }
>>>>>>             // throw new IllegalStateException("'AxisServlet' could
>>>>>> not be mapped to '" + SERVICES_MAPPING + "'");
>>>>>>         }
>>>>>>     }
>>>>>>
>>>>>>     private void addATInitServlet(ServletContext container,
>>>>>> AnnotationConfigWebApplicationContext ctx) {
>>>>>>
>>>>>>         ServletRegistration.Dynamic dispatcher = container.addServlet(
>>>>>>           "ATInit", new ATInit());
>>>>>>         dispatcher.setLoadOnStartup(1);
>>>>>> dispatcher.setInitParameter("appInstance", appInstance);
>>>>>>
>>>>>>         // do not add mapping
>>>>>>     }
>>>>>>
>>>>>> }
>>>>>>
>>>>>> On Tue, Mar 9, 2021 at 10:13 AM Kevin Lee <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi Axis2 team,
>>>>>>>
>>>>>>> I recently had to upgrade from Axis 1.6.3 to Axis 1.7.8 on the Java
>>>>>>> Spring Boot codebase I work on, and struggled greatly with making the
>>>>>>> upgrade work until I resolved the breaking change from AXIS2-5340
>>>>>>> <https://issues.apache.org/jira/browse/AXIS2-5340> that involved
>>>>>>> changing our axis2.xml config to properly deploy our web services.
>>>>>>>
>>>>>>> This breaking change is not listed clearly in the 1.7.0 major
>>>>>>> release notes
>>>>>>> <https://axis.apache.org/axis2/java/core/release-notes/1.7.0.html> -
>>>>>>> it is not included alongside the other breaking changes listed up front
>>>>>>> such as the MEP URI form change, and is tucked away in the complete
>>>>>>> list of JIRA issues that were addressed in the release
>>>>>>> <https://axis.apache.org/axis2/java/core/release-notes/1.7.0.html>.
>>>>>>> The only reason why I found out about this change was by downloading the
>>>>>>> binaries for 1.6.3 and 1.7.8 and stumbling upon the differences in 
>>>>>>> default
>>>>>>> axis2.xml configs.
>>>>>>>
>>>>>>> As mentioned in the issue, this seems like a rather important
>>>>>>> breaking change that will apply to the majority of Axis2 setups and 
>>>>>>> seems
>>>>>>> necessary for backward compatibility. I believe it will benefit future
>>>>>>> developers that have to do similar upgrades to make note of this 
>>>>>>> breaking
>>>>>>> change and include it in the 1.7.0 major release notes where it can be
>>>>>>> visibly seen.
>>>>>>>
>>>>>>> Best,
>>>>>>> Kevin Lee
>>>>>>>
>>>>>>>
>>>>>
>>>>> --
>>>>> *Kevin Lee (이지환)*
>>>>> Northwestern University 2020
>>>>> B.S. in Computer Science
>>>>> www.kevinjihwanlee.com | (773) 647-6146
>>>>>
>>>>
>>>
>>> --
>>> *Kevin Lee (이지환)*
>>> Northwestern University 2020
>>> B.S. in Computer Science
>>> www.kevinjihwanlee.com | (773) 647-6146
>>>
>>

-- 
*Kevin Lee (이지환)*
Northwestern University 2020
B.S. in Computer Science
www.kevinjihwanlee.com | (773) 647-6146

Reply via email to