I can run my app and there's no problem at all but when i'm adding
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-solr</artifactId>
<version>1.1.0.RELEASE</version>
</dependency>
to my pom file it throws:
15:59:18,172 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-3) Context initialization failed: java.lang.IllegalStateException: Cannot load configuration class: eu.combc.webuzu.configuration.SecurityConfig
any idea what's going on?
check with this :
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>4.10.1</version>
</dependency>
Related
as per the title above.
Been getting this error:
00:41:21.549 [main] DEBUG io.netty.util.internal.NativeLibraryLoader - Unable to load the library 'netty_resolver_dns_native_macos_x86_64', trying other loading mechanism.
java.lang.UnsatisfiedLinkError: no netty_resolver_dns_native_macos_x86_64 in java.library.path:
While trying to test out WebClient as a replacement for RestTemplate.
What I've tried:
Excluding Netty from the spring-boot-starter-webflux dependency and adding spring-boot-starter-reactor-netty as an explicit dependency.
Adding netty-resolver-dns-native-macos as a dependency.
Neither seems to work.
Using spring boot parent 2.4.2
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<version>4.1.79.Final</version>
<classifier>osx-aarch_64</classifier>
</dependency>
endpoints-management-control-appengine-all
endpoints-framework
Both of these packages come with some version of servlet-api-2.5.jar/servlet-api dependency
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
Without any exclusions
2020-07-16 01:22:48.113 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextExcepti
on: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2020-07-16 01:22:48.127 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-07-16 01:22:48.130 ERROR 1 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1321)
The following method did not exist:
'java.lang.String javax.servlet.ServletContext.getVirtualServerName()'
The method's class, javax.servlet.ServletContext, is available from the following locations:
jar:file:/app/libs/servlet-api-2.5.jar!/javax/servlet/ServletContext.class
jar:file:/app/libs/endpoints-management-control-appengine-all-1.0.12.jar!/javax/servlet/ServletContext.class
jar:file:/app/libs/tomcat-embed-core-9.0.36.jar!/javax/servlet/ServletContext.class
The class hierarchy was loaded from the following locations:
javax.servlet.ServletContext: file:/app/libs/servlet-api-2.5.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.servlet.ServletContext
With one exclusion
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-framework</artifactId>
<version>${endpoints.framework.version}</version>
</dependency>
<!-- [START api_management] -->
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-management-control-appengine-all</artifactId>
<version>1.0.12</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- [END api_management] -->
(Exact same as above)
With other exclusion
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-framework</artifactId>
<version>${endpoints.framework.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- [START api_management] -->
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-management-control-appengine-all</artifactId>
<version>1.0.12</version>
</dependency>
<!-- [END api_management] -->
2020-07-16 01:25:49.509 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextExcepti
on: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2020-07-16 01:25:49.524 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-07-16 01:25:49.529 ERROR 1 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1321)
The following method did not exist:
'java.lang.String javax.servlet.ServletContext.getVirtualServerName()'
The method's class, javax.servlet.ServletContext, is available from the following locations:
jar:file:/app/libs/endpoints-management-control-appengine-all-1.0.12.jar!/javax/servlet/ServletContext.class
jar:file:/app/libs/tomcat-embed-core-9.0.36.jar!/javax/servlet/ServletContext.class
The class hierarchy was loaded from the following locations:
javax.servlet.ServletContext: file:/app/libs/endpoints-management-control-appengine-all-1.0.12.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.servlet.ServletContext
With both exclusions
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-framework</artifactId>
<version>${endpoints.framework.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- [START api_management] -->
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-management-control-appengine-all</artifactId>
<version>1.0.12</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- [END api_management] -->
(same as above)
So we can conclude that exclusions simply aren't working for endpoints-management-control-appengine-all.
I have no idea how to fix this? There has got to be some weird quirk going on.
Obviously the goal is to remove all outdated transitive servlet dependencies so that jar:file:/app/libs/tomcat-embed-core-9.0.36.jar!/javax/servlet/ServletContext.class can be auto-selected, which probably has the new virtualization method, as recommended by answers like An attempt was made to call a method that does not exist. STS.
To test these exclusions I am creating a docker container with google jib plugin and docker run
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>2.4.0</version>
<configuration>
<to>
<image>gcr.io/${endpoints.project.id}/endpoints-container</image>
</to>
</configuration>
</plugin>
PORT=8080 && docker run --rm -p 9090:${PORT} -e PORT=${PORT} gcr.io/project-id/endpoints-container
I'm not sure whether this detail is relevant, but something I did notice was that endpoints-management-control-appengine-all has a different package structure, with respect to the way javax servlet 2.5 is included compared to endpoints-framework.
included alongside com which doesnt happen in endpoints-framework
When I run “mvn spring-boot:run” I get the following error:
[ERROR] org.springframework.boot.context.embedded.tomcat.TomcatStarter - Error starting Tomcat context: org.springframework.beans.factory.BeanCreationException
[WARN] org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
I'm not sure what's causing it... my pom.xml file is too long to post here but I wonder if this is the issue and I should comment out the exclusions:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>
My colleague create a spring boot project used 2.0.0.M7, when I run the project by run Application class in idea it cloud be stopped successfully, but if I run it in tomcat(war exploded)
in this case when I stop it I always get below error
Exception in thread "scheduler_Worker-7" Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.core.status.WarnStatus]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1305)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1293)
java.lang.NoClassDefFoundError: ch/qos/logback/core/status/WarnStatus
at ch.qos.logback.classic.LoggerContext.noAppenderDefinedWarning(LoggerContext.java:186)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:264)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at ch.qos.logback.classic.Logger.debug(Logger.java:482)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:612)
So what the difference between run Application class and run Tomcat, why run Tomcat could have the additional error when stop it?
In additional in very rare situation it also could be stopped successfully.
Your question has 2 parts.
Part 1: Running options
When you run by Tomcat (as you seen yellow Tom cat icon), you run/debug application on local/remote real server.
When you run by SpringBootApplication, it mean, fat JAR (executable JAR, with embedded Apache Tomcat 8.5.x server).
Part 2: Error what related Logback
Add dependencies
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>audit-client</artifactId>
<version>0.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>audit-common</artifactId>
<version>0.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>log4j-bridge</artifactId>
<version>0.9.7</version>
</dependency>
Let's me know what happen after apply the above solutions.
I'm trying to do a ConfigServer with a remote repository.
The ConfigServer pom's file is:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-monitor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Inthe the properties file, i have the url, user and password of the repository. Is necessary anything else?. The file is like:
server.port:8888
spring.cloud.config.server.git.uri:git#gitlab.com:user/repo.git
spring.cloud.config.server.git.uri.username:user
spring.cloud.config.server.git.uri.password:password
spring.profiles.active:config-monitor
rabbitmq.host:rabbitmq
rabbitmq.port:5672
rabbitmq.username:guest
rabbitmq.password:guest
spring.cloud.bus.enabled:true
spring.cloud.config.server.monitor.gitlab.enabled:true
And I created a Webhook in gitLab with url http://localhost:8888/monitor too.
But when a client try to start, the ConfigServer's console shows:
**2017-03-14 23:46:35.767 ERROR 10595 --- [nio-8888-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Cannot clone or checkout repository] with root cause
com.jcraft.jsch.JSchException: USERAUTH fail
at com.jcraft.jsch.UserAuthPublicKey.start(UserAuthPublicKey.java:118) ~[jsch-0.1.50.jar:na]
at com.jcraft.jsch.Session.connect(Session.java:463) ~[jsch-0.1.50.jar:na]
2017-03-14 23:46:51.162 WARN 10595 --- [nio-8888-exec-2] .c.s.e.MultipleJGitEnvironmentRepository : Could not fetch remote for master remote: git#gitlab.com:user/repo.git**
Dou you know how can i resolver it?
Thanks!