I'm writting my application using Intellij IDEA, maven, Spring MVC. I've added maven dependencies in my pom.xml:
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.0.1.Final</version>
</dependency>
But classes javax.validation and org.hibernate.validator cannot be found.
I try File->Invalidate Caches / Restart... in IntelliJ but it not works. All other dependencies work correct.
Try this:
right click on pom.xml
choose Maven -> Generate sources and update folders
Related
I am starting a new project and I am trying to configure spring boot as a web project to use jsp's. I am using Spring Tools Suite 4.
I have added the spring web option while setting up.
I have added the following in the application.properties
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
I have also have the following dependencies in my pom file
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- Need this to compile JSP -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
When I try to add a tsp to the main/webapp/WEB-INF/jsp folder I dont get the jsp option.
Try installing the plugin from eclipse marketplace
Go to help -> eclipse marketplace
Then search Eclipse Java EE Developer Tools
Install it and restart your IDE
Using spring boot war build during the start up of the application in the tomcat
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/scheduling/quartz/SpringBeanJobFactory.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180)
even though it exists as a dependency
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
And also spring-context-support
There are no issues with spring boot jar build and run
How to fix the issue for the war deployment?
This is what I get when debugging jar file - maybe this might help: (with war file ClassNotFoundException)
I'm not sure, it's just suggestion:
Try to add dependencies:
<!--Quartz-->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>2.2.1</version>
</dependency>
NOTE: It's just a way to 'hot fix'. And it is not a complete solution.
Figured out the issue. As I was running Tomcat from the IntelliJ Idea and new dependencies introduced to the project were not reflected. Needed to remove and reimport war/war exploded into Tomcat configuration - no issues.
Try to add the following dependency (if you want you can set Spring version by yourself):
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
I am bootstrapping my spring application to spring boot and I have the problem that the embedded tomcat is not rendering the jsp files instead the file will be downloaded.
I have googled and tried everything what I have found so far but I still do anything wrong.
I have the following dependencies in my pom.xml file
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<!-- Need this to compile JSP -->
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.6.1</version>
</dependency>
Clipping from the application.properties
server.port=8080
spring.mvc.view.prefix=/
spring.mvc.view.suffix=.jsp
Clipping from the Controller
#GetMapping(value= "/")
public String showPage(Model theModel) {
theModel.addAttribute("scrumbled", new Scrumbled());
return "main";
}
What am I doing wrong that the jsp file is downloaded instead of showing and rendered in the browser?
Thanks in Advance
The problem is with the jasper version. It worked with the below version irrespective of the tomcat version.
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-jasper -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>9.0.24</version>`enter code here`
</dependency>
My tomcat version was 9.0.63.
I have solved the issue.
The problem was a corrupted jar dependency. I had to maven clean, maven install the whole project to see the error. After deleting the jar from the file system maven downloaded the dependency again and now its working.
I am trying to integrate Spring 4 with Hibernate 4 and i am using eclipse ide with out maven dependencies,But i am getting below mentioned error:
Caused by: java.lang.classnotfoundexception : org.hibernate.annotations.Entity
if any one has implemented already and working fine, So please can you share the project for reference so that i can understand the flow of integration, As i am new to spring and hibernate.I need some good guidance.
you need to use some dependency, which you can find below :
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.5-Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.2.9.Final</version>
</dependency>
and if you are not using maven project then you need to download the hibernate-entitymanager and hibernate-annotations jar and add into build path and rebuild the project
I've imported magnolia-module-standard-templating-kit maven dependency in Pom file in webapp. It's version is 2.3.0 and Magnolia version is 5.3. After build & run Tomcat server and start install modules, I encountered a failure as below:
Magnolia Data Module (version 2.3.0)
Could not install or update data module. Task 'Data AppLauncher group ordering' failed. (PathNotFoundException: /modules/ui-admincentral/config/appLauncherLayout/groups/data)
pom.xml:
<!-- Overlay Magnolia Empty Webapp. Alternatively, use the bundled-webapp or the enterprise-webapp. Dependencies versions are already imported by parent, so no need to replicate here. -->
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-empty-webapp</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-empty-webapp</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>com.mycompany.projects</groupId>
<artifactId>myTemplateModule</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>info.magnolia.contacts</groupId>
<artifactId>magnolia-contacts</artifactId>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-module-standard-templating-kit</artifactId>
</dependency>
Anyone can help me resolve this problem?
I managed to replicate the exception you get and i think the problem is the order you add the dependencies and do the "Start install" process.
if i first do a "Start install" with only the magnolia-empty-webapp dependencies and then i stop the server, add the magnolia-module-standard-templating-kit to the pom.xml and do another "Start install" i got the exception:
But if instead i do a "Start install" specifying all the dependencies (stk and empty-webapp) from the beginning i don't get an exception at all
I recommend you to add these dependencies as well for demo project and the pop theme
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-theme-pop</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-demo-project</artifactId>
<version>${project.version}</version>
</dependency>