I created spring + angular + gradle with Jhipster.
I first do
npm install
Then , I run this command:
./gradlew -Pprod -Pwar clean bootWar
which reads gradle/war.gradle:
apply plugin: "war"
bootWar {
mainClassName = "com.bpn.legolas.ExtractAccountApp"
includes = ["WEB-INF/**", "META-INF/**"]
webXml = file("${project.rootDir}/src/main/webapp/WEB-INF/web.xml")
}
war {
webAppDirName = "build/resources/main/static/"
webXml = file("${project.rootDir}/src/main/webapp/WEB-INF/web.xml")
enabled = true
archiveExtension = "war.original"
includes = ["WEB-INF/**", "META-INF/**"]
}
and it creates a war. But when i deploy to another machine, to tomcat, i got the error page:
An error has occured :-( Usual error causes You started the
application from an IDE and you didn't run npm start or npm run
webpack:build. You had a network error while running npm install. If
you are behind a corporate proxy, it is likely that this error was
caused by your proxy. Have a look at the JHipster error logs, you will
probably have the cause of the error. You installed a Node.js version
that doesn't work with JHipster: please use an LTS (long-term support)
version, as it's the only version we support. Building the client side
code again If you want to go fast, run ./mvnw to build and run
everything.
If you want to have more control, so you can debug your issue more
easily, you should follow the following steps:
Install npm dependencies with the command npm install Build the client
with the command npm run webpack:build or npm start Start the server
with ./mvnw or using your IDE Getting more help If you have a question
on how to use JHipster Go to Stack Overflow with the "jhipster" tag.
If you have a bug or a feature request First read our contributing
guidelines.
Then, fill a ticket on our bug tracker, we'll be happy to resolve your
issue!
If you want to chat with contributors and other users Join our chat
room on Gitter.im. Please note that this is a public chat room, and
that we expect you to respect other people and write in a correct
English language!
For same steps, i export as jar.
First
npm install
Then
./gradlew -Pprod -Pjar clean bootJar
Than at that machine, i do
java -jar xxxx.jar
and it works! But for war, as i said before, it does not work. It says about npm install orwebpack`
Please help me about it.
STEPS
1- My war name is halil-0.0.1-SNAPSHOT.war
2- I put to webapps under tomcat
3- Then i go to:
http://localhost:8080/halil-0.0.1-SNAPSHOT/
4- I see the errors which i put in the screenshot.
Which i posted as text in this question
5- Javascript console shows those errors:
6- Network shows those errors:
7- When i go to
http://localhost:8080/halil
or
http://localhost:8080/
it brings 404 page
I had the same problem when I was trying to migrate from Angular 4 to Angular 12 in my Jhipster project.
The issue was that the static folder was not being created before creating the war:
gradle script was wrong (the npm build was running in the correct step before the war)
So I have solved it following these steps:
Run npm build, so the static folder was created (you must be sure the exact path for your static folder is correct)
Check if the static folder was created in the path your war is expecting
Run ./gradlew -Pprod -Pwar clean bootWar
Related
I have a Spring project to which I have made two very basic changes:
logger.info("testing changes made");
return new ResponseEntity<>(HttpStatus.NO_CONTENT); //previously HttpStatus.OK
I then:
git committed the changes (not really necessary)
mvn clean install -P docker-build-image
docker tag my-service:old-tag my-service:new-tag
I then used this image to install the service in a kubernetes pod as follows:
echo "🟢 deploying auth service"
helm uninstall auth
kubectl delete pod -l app.kubernetes.io/name=auth
kind load docker-image my-service:new-tag
helm install auth ./auth --wait
The trouble is: I am never getting any changes. I only see the output from the old version of the application.
What is going on here? This is very strange to me. This feels very much like a maven|docker plugin kind of problem. Or, is it a kubernetes|kind|helm problem?
mvn install will just install the package.
You should do mvn package before install to make new jar file.
The problem I was experiencing resulted from the docker-building module was using an old snapshot to build the docker image. The wrong dependency was being used in the POM file of that module. I changed the dependency and everything worked just fine.
Im trying to run my Vaadin14 project to production and my application cant find any vaadin flow components. I have a default application.properties and POM, and downloaded it from here https://vaadin.com/start/latest. I already have tried,
delete node modules
mvn clean
mvn clean install -Pproduction
mvn clean package -Pproduction
and I get this error
Failed to find the following imports in the `node_modules` tree:
- #vaadin/flow-frontend/contextMenuConnector-es6.js
- #vaadin/flow-frontend/comboBoxConnector.js
- #vaadin/flow-frontend/gridConnector.js
- #vaadin/flow-frontend/contextMenuConnector.js
- #vaadin/flow-frontend/flow-component-renderer.js
- #vaadin/flow-frontend/gridConnector-es6.js
- #vaadin/flow-frontend/comboBoxConnector-es6.js
- #vaadin/flow-frontend/vaadin-grid-flow-selection-column.js
If the build fails, check that npm packages are installed.
To fix the build remove node_modules directory to reset modules.
In addition you may run npm install to fix node_modules tree structure.
TIA
nvm guys, already found the answer.. Vaadin 14.0.11v
add this to your application.properties
vaadin.productionMode = true <----- comment this line when in dev mode
spring.servlet.multipart.enabled = false
OpenDaylight Oxygen
Maven 3.3.9
Ubuntu 16.04
karaf 4
~/.m2/settings.xml - cp -n ~/.m2/settings.xml{,.orig} ; wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml
Process used to create skeleton
mvn archetype:generate -DgroupId=org.opendaylight.controller -DartifactId=testing -Dcopyright="None" -DclassPrefix="\${artifactId.substring(0,1).toUpperCase()}\${artifactId.substring(1)}" -DarchetypeGroupId=org.opendaylight.archetypes -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeVersion=1.1.0-SNAPSHOT -DinteractiveMode=false
mvn clean install -Dcheckstyle.skip
I'm trying to build a sample app and deploy it on a separate instance of ODL (karaf 4). I cannot find a working answer to this anywhere.
I've tried copying the contents of PROJECT/karaf/target/assembly/system/org/opendaylight/controller to the equivalent folder on the other ODL instance. Then used feature:add-repo to add the feature. It was able to detect the plugin, but feature:install odl-testing failed to install.
Any help would be greatly appreciated.
You are not showing what exact failure you hit when you say "feature:install odl-testing failed to install", but FYI most people don't actually use the process you are trying to get working.. it's technically possible to build your new bundles and Karaf feature separately and then manually add it to deploy on a separate instance of ODL... but every project I know of finds it easier to just let the build produce a ready-to-use Karaf distribution.
You have probably seen the distro in karaf/target/assembly which the the ODL archetype (documented here BTW; note the use of archetypeGroupId changed to org.opendaylight.archetypes in the just released latest Fluorine version) produces?
So what you can do instead is to just add your "base" feature which you are presumably wanting to add your feature into as a dependency to your custom feature. With this, you get your ready-to-run custom distribution including your new code and whatever other ODL features you want to include.
I downloaded the cf java buildpack zip from https://github.com/cloudfoundry/java-buildpack and unzipped it(on a windows 7 machine). I made some changes and created a custom buildpack by creating a zip file(By simply compressing to zip and not using buildpack packager). Now my app deployment is failing with error:
2017-05-23T15:14:03.19+0000 [STG/17] OUT -----> Downloaded app package (59M)
2017-05-23T15:14:03.36+0000 [STG/0] OUT Staging failed: Buildpack compilation step failed
2017-05-23T15:14:03.36+0000 [STG/0] ERR
2017-05-23T15:14:03.46+0000 [API/0] ERR encountered error: App staging failed in the buildpack compile phase
These are the only error logs even after setting CF_TRACE=true. Please suggest how to see more descriptive logs on buildpack compilation or any tool which may help in debugging.
Thanks in advance.
I made some changes and created a custom buildpack by creating a zip file(By simply compressing to zip and not using buildpack packager).
Don't do that. If you need a build pack to upload to your CF foundation, then use the instructions here to build a proper build pack.
https://github.com/cloudfoundry/java-buildpack/#building-packages
Brief Instructions:
Install Ruby
git clone https://github.com/cloudfoundry/java-buildpack.git
cd java-buildpack
git checkout <version> ex: git checkout v3.16
bundle install
bundle exec rake clean package for a version without dependencies or bundle exec rake clean package OFFLINE=true PINNED=true for a version with dependencies.
or
If you don't need a build pack to upload and just want to test your changes then...
Fork the Java build pack.
Make your changes.
Push them to your fork.
Run cf push -b <url-to-your-git-project>. Ex: cf push -b https://github.com/dmikusa-pivotal/java-buildpack.
This will instruct the single app to use your copy of the build pack. This will only work if your CF foundation has network access to the Git URL specified.
Hope that helps!
My current Setup:
I have Ecliple Mars installed on Windows 10
I have some repositories checked out in my Project explorer which I basically use for any code changes, debugging purpose.
I have tomcat installed in C directory and have its path configured in the Servers section of eclipse.
So, every time I do any code changes in eclipse, I manually go into the eclipse workspace, and do the maven build using the following commandmvn -Plocal -DskipTests=true clean install, and then manually copy the war generated in the target folder into the webapps directory of my tomcat.
After doing all these, I start my tomcat in debug mode catalina jpda start and then setup Remote Java Application in eclipse for a particular module.
I can then setup breakpoints and see the changes in the debugger.
I am wondering , all of the above steps are time consuming if I have to do frequent code changes and then debug something in Debug mode in eclipse as I have to repeat steps 4 to 6 again and again for any code changes.
Could anyone tell me if there is a quick way to achieve the same goal?
You can run application dirrectly from maven via maven-{your_servlet_container}-plugin (maven-tomcat-plugin, maven-jetty-plugin, etc.). you can also specify debug mode there, so all you need to do is just run maven and connect in eclipse to remote app.
set ENV variable for always run maven in debug:
set MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
(unset by setting this value to empty string)
with env variable:
mvn -Plocal -DskipTests=true clean tomcat7:run
or run mvnDebug:
mvnDebug -Plocal -DskipTests=true clean tomcat7:run
If you have your tomcat configured with eclipse properly, then you don't need to perform all these steps. I am not sure if you want to automate all these steps from outside. if yes, then either you can automate above steps with writing all in a batch file & triggering all steps with it (not a standard way) or using maven plugins to automate most of these steps.
Hope this information will help...