vaadin / vaadin/spring

Using Spring Web Application in Vaadin Flow throw Exception in Oracle Weblogic

Open
#342 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
186
Forks
98
PR merge metrics
No merged PRs in 30d

Description

Hi everybody,
following this article to set up Spring in my Weblogic application with the next code that is part of class that implements WebApplicationInitializer.

@Override
public void onStartup(ServletContext servletContext) {
    AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
    context.scan("...");
    servletContext.addListener(new ContextLoaderListener(context));

    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new SpringServlet(context));
    dispatcher.setLoadOnStartup(1);
    dispatcher.addMapping("/*");
}

If I run this Web application on Oracle Weblogic 12.2.1 then I got the next error and the servlet cannot started. With Jetty server working fine.

Aug 22, 2018 1:05:56 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 3763 ms
<Aug 22, 2018 1:05:56 PM GMT> <Servlet: "dispatcher" failed to preload on startup in Web application: "icbsfe-war-1.0-SNAPSHOT.war".
org.jboss.weld.exceptions.CreationException: WELD-001530: Cannot produce an instance of class com.vaadin.flow.spring.SpringServlet.
at org.jboss.weld.injection.producer.NonProducibleInjectionTarget.produce(NonProducibleInjectionTarget.java:55)
at com.oracle.injection.provider.weld.WeldBeanManager.newBeanInstance(WeldBeanManager.java:94)
at com.oracle.injection.integration.utils.InjectionBeanCreator.newBeanInstance(InjectionBeanCreator.java:127)
at weblogic.servlet.internal.InjectionBasedWebComponentCreator.createServletInstance(InjectionBasedWebComponentCreator.java:102)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.newServletInstanceIfNecessary(StubSecurityHelper.java:365)

Pieces of my pom.xml:
Vaadin core version: 10.0.2
Vaadin spring version: 10.0.0
Weblogic version: 12.2.1

Thanks in advice,
Balazs

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WebApplicationInitializer setup shown in the issue and the WebLogic/Weld stack trace for SpringServlet creation. Compare the same registration under Jetty against WebLogic 12.2.1 using Vaadin Flow 10.0.2 and Vaadin Spring 10.0.0. Done means the dispatcher servlet starts successfully on WebLogic without the WELD-001530 exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.