I m getting the following exception while trying to deploy the war file on Weblogic 10.3.6 server.
The application is using SPring mvc.
Error loading DispatcherServlet's default strategy class [org.springframework.web.servlet.mvc.support.Def
aultHandlerExceptionResolver] for interface [org.springframework.web.servlet.HandlerExceptionResolver]: problem with class file or dependent class; nested exception is
java.lang.NoClassDefFoundError: org/springframework/web/bind/MethodArgumentNotValidException
at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:766)
at org.springframework.web.servlet.DispatcherServlet.initHandlerExceptionResolvers(DispatcherServlet.java:604)
at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:423)
at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:410)
at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:752)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:989)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1)
at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51)
at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:97)
at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:68)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:324)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:929)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:467)
Your classpath doesn't have spring-web-x.x.x.jar, that's why the exception is. Please use Maven build tool for building your Spring MVC project. Add all the necessary dependencies in pom.xml. For spring-web 3.0.4 version, it would be
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
Related
I have a simple app that uses Netflix Zuul as an API gateway
I added the Zuul dependency in the pom.xml file as follows:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
<version>2.2.10.RELEASE</version>
</dependency>
and #EnableZuulProxy for the main class of the app
The problem is that whenever I try to run the API, It fails to start and shows in the console:
Consider defining a bean of type
'org.springframework.cloud.client.loadbalancer.reactive.DeferringLoadBalancerExchangeFilterFunction'
in your configuration.
I couldn't solve the issue, what's the problem?
The issue was solved when I added the following dependency in pom.xml:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
and as a result, spring also asked me to add this to my app configuration:
spring.main.web-application-type=reactive
Then my API ran successfully without failing or throwing any exception
I have a maven based project. This is how the project looks like in eclipse:
So I have separate front and back end that are packed into one EAR. The application were deployed on Weblogic 12c server but now I have to move it to Glassfish. I can deploy to Glassfish and my application is running. But, i got an error message when I invoke a method which use Primefaces UploadFile class. This is the error message:
java.lang.NoClassDefFoundError: org/primefaces/model/UploadedFile
javax.ejb.EJBException: java.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.NoClassDefFoundError: org/primefaces/model/UploadedFile
This two dependency:
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.0</version>
</dependency>
Are in both POM.xml (front and back end) And the maven dependency is in my classpath as you can see in this picture:
My question is, where should I put the Primefaces jar, to make visible for Glassfish in runtime?
You'll either need to add the dependencies to the /lib folder of Glassfish as this is where the container will check for them, or bundle them up with the deployable artifact - in your case the .ear file. As you are using maven there are a couple of plugins available that may help you e.g. the Maven Assembly or Maven Ear plugins.
-Answer based on my comment above.
I have a war and want to deploy it on a websphere application server.
The application server has slf4j, version 1.4.2 installed.
However, my application requires at least version 1.6.1.
Here's the dependency defined in my POM:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
I can build the application successfully, but everytime I try to launch it on the websphere server, I get the following error:
DispatcherSer E org.springframework.web.servlet.DispatcherServlet initServletBean Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' defined in ServletContext resource [/WEB-INF/spring/timer-context.xml]: Invocation of init method failed; nested exception is java.lang.LinkageError: org.slf4j.Logger
What do I have to do so that my application uses version 1.6.1, and ignores the already installed version on the server?
Related Question: java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
I have used 2.2.5 version of [https://github.com/fge/json-schema-validator] using maven dependency
<dependency>
<groupId>com.github.fge</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.2.5</version>
</dependency>
I am trying to validate a simple json against schema given in code samples. When I load the page, I get a runTimeException as:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.github.fge.jsonschema.cfg.ValidationConfigurationBuilder
at com.github.fge.jsonschema.cfg.ValidationConfiguration.newBuilder(ValidationConfiguration.java:92)
at com.github.fge.jsonschema.cfg.ValidationConfiguration.byDefault(ValidationConfiguration.java:102)
at com.github.fge.jsonschema.main.JsonSchemaFactoryBuilder.(JsonSchemaFactoryBuilder.java:68)
at com.github.fge.jsonschema.main.JsonSchemaFactory.newBuilder(JsonSchemaFactory.java:123)
at com.github.fge.jsonschema.main.JsonSchemaFactory.byDefault(JsonSchemaFactory.java:113)
Do I need a version upgrade for any of the jars or is it because of some other issue?
I am trying to get a Tomcat server (7.0.54) to support WebSocket and having a hard time deploying it. I have a simple endpoint:
#ServerEndpoint(value = "/test")
public class TestEndpoint {
In order to have this endpoint processed, I need to include a container (which uses ServiceLoader to start, introspect all the classes with endpoint annotations, etc...). I use the following:
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat7-websocket</artifactId>
<version>7.0.47</version>
</dependency>
However, mvn tomcat7:run then fails to start with:
SEVERE: Parse error in application web.xml file at jndi:/localhost/WEB-INF/web.xml
org.xml.sax.SAXParseException; systemId: jndi:/localhost/WEB-INF/web.xml; lineNumber: 13; columnNumber: 12; Error at (13, 12) : org.apache.catalina.deploy.WebXml addFilter
If instead, I specify the scope as system and I point it to my local file system:
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat7-websocket</artifactId>
<version>7.0.47</version>
<scope>system</scope>
<systemPath>${somewhere}/tomcat7-websocket-7.0.54.jar</systemPath>
</dependency>
... then everything works fine, but of course, this can't be reliably deployed on a live server.
What can I do to start my WebSocket container properly?
You need to use this dependency and marked it as provided (and not the one coming from org.apache.tomcat never included tomcat dependency as it's all provided by the container). That's similar to servlet-api:
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>