Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy WAR to weblogic #3

Closed
hfye opened this issue Sep 29, 2017 · 2 comments
Closed

deploy WAR to weblogic #3

hfye opened this issue Sep 29, 2017 · 2 comments

Comments

@hfye
Copy link

hfye commented Sep 29, 2017

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">

    wls:container-descriptor
    wls:prefer-web-inf-classestrue</wls:prefer-web-inf-classes>
    </wls:container-descriptor>
    </wls:weblogic-web-app>

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
Copy link
Author

hfye commented Sep 29, 2017

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.

@hfye hfye closed this as completed Sep 29, 2017
@okonmarcin
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants