spring-petclinic / spring-petclinic-graphql

PetClinic Example based on GraphQL
Other
212 stars 123 forks source link

deploy WAR to weblogic #3

Closed hfye closed 6 years ago

hfye commented 6 years ago

Hi,

I'm trying to deploy this demo app to weblogic 12c but failed to start it:

INFO AutoConfigurationReportLoggingInitializer -

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. ERROR SpringApplication - Application startup failed org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLServletRegistrationBean' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLServletRegistrationBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLServlet' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLServlet' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLSchemaProvider' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLSchemaProvider' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLSchema' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLJavaToolsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLSchema' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaParser' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLJavaToolsAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParser]: Factory method 'schemaParser' threw exception; nested exception is java.lang.IllegalStateException: No *.graphqls files found on classpath. Please add a graphql schema to the classpath or add a SchemaParser bean to your application context. at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)

To support weblogic, I also made a few changes:

  1. change the main application as: public class PetClinicApplication extends SpringBootServletInitializer implements WebApplicationInitializer {...}
  2. add weblogic.xml to resolve the dependency conflicts: <wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">

    true

but the same WAR file can be deployed to TOMCAT and start it successfully. I also check the source code GraphQLJavaToolsAutoConfiguration.java which loads the files: Resource[] resources = applicationContext.getResources("classpath*:*/.graphqls"); if(resources.length <= 0) { throw new IllegalStateException("No *.graphqls files found on classpath. Please add a graphql schema to the classpath or add a SchemaParser bean to your application context."); }

hfye commented 6 years ago

I've figured out the cause of this issue. It's a bit odd in weblogic when deploying war file. It creates an internal _wl_cls_gen.jar file to package all files for /WEB-INF/classes folder. but the application still looking for resources in match directory like /j2ee/wl12/cp_domain/servers/cp_msp01/tmp/_WL_user/cpapps-graphql-results/g4qyhf/war/WEB-INF/classes/*/.graphqls.

okonmarcin commented 3 years ago

Hi, I know it's been a while, but I am facing the same problem. Did you manage to solve it? Any clues on that? I would really appreciate your help on that.