Am trying to integrate Spring security into a Grails Web application using NetBeans IDE.
Steps were:
added mavenRepo "http://repo.spring.io/milestone" to repository
compile ":spring-security-core:2.0-RC2" to plugins.
When I try grails s2-quickstart com.zot.auth User Role in cmd prompt I get below error. Can anyone help. Also would like to know if we can create the spring security files directly in NetBeans like we create the pojos I mean without using a commandline.
| Error Error generating web.xml file (Use --stacktrace to see the full trace)
I faced same problem and resolved using following steps:
grails clean
grails refresh-dependencies
If still not work then remove target folder.
Related
I am using Google App Engine gradle plugin with yaml file, but the plugin version for it has no task appengineRun or appengineStart like the appengine-web.xml version.
TL;DR appengineRun is only available for appengine-web.xml based projects. If you want to use app.yaml, you must provide your own server, for example Spring Boot with Jetty or Tomcat.
To run your application locally, you must provide your own server.
This guide shows how to test your application using app.yaml alongside with the app-gradle-plugin, on section Testing your application with the development server:
During the development phase, you can run and test your application at any time in the development server by invoking Gradle:
gradle jettyRun
Alternatively, you can run Gradle without installing it by using the Gradle wrapper.
As said on this comment on GitHub:
If you want to use app.yaml from your root directory, you must upgrade to Java 11. Learn more here. With the Java 11 runtime, you must provide your own server, for example Spring Boot with Jetty or Tomcat. The appengine:run goal does not work for app.yaml based projects because each server has a different start up command i.e. spring-boot:run for Spring Boot.
When creating a Spring Boot application, in development environment, IntelliJ Idea creates a Run Configuration that is without Maven and it directly calls the static Main method with type of 'Spring Boot'.
When I run without Maven my JSP template files are not being resolved and I get the error page below.
When I run with Maven they are resolved but I can't debug. I am seeing some POM.xml configuration to be able to attach the debugger but then it debugs all the time even when I fire the app with Run and not Debug.
Should I run Boot app without Maven at all?
If I shouldn't, is this how the debug should be?
I feel something is wrong here...
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Mar 16 08:53:54 GMT 2017
There was an unexpected error (type=Not Found, status=404).
No message available
I believe I see this error page because it tries to locate my index.jsp, can't find it, then tries for error.jsp and can't find that as well.
Okay after doing more research it seems it is right to run Spring Boot application through the Main method directly rather than Maven in development environment.
Issue with JSPs are not being rendered without Maven was the Tomcat Jasper dependency's scope was <scope>provided</scope>, after changing that to "compiled" or "runtime" it started to work without maven. Interestingly when it was "provided" JSP rendering was only working with Maven.
You can try different URLs like URL without or with the project (artifact) name. Maybe something wrong with the way how IDEA and maven deploy your war.
Also, it is possible to run the app from maven and then connect with the Remote run configuration of the IDEA to it. For this, you need to use mvnDebug instead of mvn - it is situated in the same folder as mvn ($MAVEN_HOME/bin/). And then you need to add Remote configuration to the IDEA with the port 8000 - it is default port.
Try re-importing Maven projects first before running application from IntelliJ, or make it happen automatically when you change something in your pom.xml file (File | Settings | Build, Execution, Deployment | Build Tools | Maven | Importing | Import Maven projects automatically).
I use IntelliJ execution in my dev environment. What's more, if you would like to have features like hot-reloading for instance, consider using devtools module shipped with Spring Boot which easily integrates with IntelliJ debug execution (just add spring-boot-devtools to your dependencies).
When I execute the project on the command line mvn spring-boot:run -Dskiptests, the project loads up just fine. But when I run the project from the STS IDE, Debug As --> Spring Boot App or Debug As --> Debug on Server, I get the below error
java.lang.NoSuchMethodError: com.google.common.collect.Multimaps.asMap(Lcom/google/common/collect/ListMultimap;)Ljava/util/Map;
NoSuchMethodError usually points to a different version of a library being used than what is expected. As the app runs when using mvn, the version in your pom.xml seems to be fine. Please make sure if you have not added a different version of Guava in your project classpath. You may also make sure that you are using the correct version of your Maven settings.xml file in STS, and update the project with 'Force update of snapshots / releases' on.
EDIT:
I've just reread your qustion: -Dskiptests may cause the portion of your code that causes the problems be skipped. Please check your pom.xml if you have the correct version of Guava in it.
EDIT 2:
The method you are trying to call has been in Guava since 15.0.
I am trying to create a simple Maven project in Eclipse Luna. I am trying to create a simple web project using the Artifact Id spring-webmvc 4.0.5.RELEASE.
Now, when I click finish it's giving me the following error...
Spring_mvc_err
I thought, may this arctifact id does not exist in my Eclipse Luna, therefore search google for this artifact id and found this url:
Spring Web MVC
Any idea, how i can add this artifact id in my eclipse IDE.
i have managed to create and successfully deploy (on web server) the basic spring MVC application for the archetype 'maven-archetype=webapp', using following command on command-line:
mvn archetype:generate -DgroupId=com.wiley.beginningspring -DartifactId=basic -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
I've managed to resolve my issue by following this link https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
I'm looking for an example Spring MVC 2.5 web app that I can easily:
Setup as a project in Eclipse
Deploy to a local app server (using Ant/Maven)
There are a couple of example applications included with the Spring distribution ('petclinic' and 'jpetstore'), but they don't provide any Eclipse project files (or a way to generate them). They also seem a bit complicated for my needs, e.g. require a local database to be setup.
The easiest way to get up and running with a Spring MVC project is to use SpringSource Tool Suite, which is another free IDE based on Eclipse.
The integration between the IDE and Spring/Maven is tight, and it comes with an application server already setup for you to deploy your web app.
Follow these steps to get a working Spring MVC web app.
To setup a new project in STS: Click File -> New -> Spring Template Project -> Spring MVC Project
To pull in dependencies and compile your project: Right click your new project -> Run As -> Maven install
To run your project inside an application server: Right click your new project -> Run As -> Run on Server -> SpringSource tc Server
If it works, you'll see a web page saying "Congratulations! You're running Spring!"
While not specifically an app you can download, Developing a Spring Framework MVC application step-by-step covers creating a spring application in Eclipse with an ant build script, complete with unit tests.
This meets the following requirements:
Spring MVC 2.5
Project in Eclipse
Deploy to a local app server using Ant
Uses HSQL (no need to install a local DB)
There's a Maven archetype (template project structure) for Spring MVC here:
http://docs.codehaus.org/display/MAVENUSER/Archetypes+List
That's a good starting place for this kind of investigation. To create an archetype using Maven, first install Maven:
http://maven.apache.org/plugins/maven-install-plugin/
and then create a project using the archetype:
http://maven.apache.org/guides/introduction/introduction-to-archetypes.html
You can also use the m2eclipse plugin for Eclipse to simplify this and it takes you through the stages of the project using a wizard. Just right click -> New Project -> Other, Maven and select the archetype. Hope that helps.
Just spotted http://blog.springsource.com/2010/07/22/spring-mvc-3-showcase/ which could be interessting for you.
To generate Eclipse project files:
Use mvn eclipse:eclipse before importing the project into your workspace. This will create all required configuration files and hook your project up with all the required dependencies.
The mvc-basic and mvc-ajax sample projects in spring-samples (SVN URL: https://src.springframework.org/svn/spring-samples) are simple projects that do not need any local database support.
Use AppFuse
I got it working just as Drew described, but there is a trap for new users (meaning fresh install, no familiarity with Maven or m2eclipse). You'll get this error:
[ERROR] Error executing Maven.
[ERROR] The specified user settings file does not exist: /home/user/.m2/settings.xml
And the work around is to just make an almost empty settings.xml:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
</settings>
(I later found this bug report.)
After that, I was in business. I was even able to export as a WAR file and deploy onto my installation of WebSphere Community Edition. Thank you, Drew!
A little less earlier, I wrote:
Hmph. Never mind. I gave up, shut down my machine, and when I came back, everything worked (except for a minor Maven issue I'm working on). Chalk it up to a bug.
Earlier, I wrote:
I was very excited to hear about STS, so I downloaded and installed it. It went perfectly. This is a new machine, so I have the latest of everything - java 1.6, eclipse 3.5.1, etc.
On step 2 of the above instructions, I get this error:
"The specified JRE installation does not exist"
I've set paths everywhere I can find, so I'm not sure which JRE it's complaining about. Help?
You could also use Spring Roo to do this. http://www.springsource.org/roo
You can use below link to download hello world spring mvc project
Spring MVC hello world example