I am trying to implement newrelic in my spring boot JPA project.
I am using this link to implement this. new relic guid for spring boot
Now I have installed newrelic-java-7.9.0.zip (new relic zip)from this link and changed the yml as per my requirment.
I am not able to understand what to do next as per the link. also how can run this in production environment.
AFter researching on internet I got this command to execute :
java -javagent:<path to your new relic jar>\newrelic.jar -jar <path to your application jar>\<you rapplication jar name>.jar
Now I have new relic jar but i don't have jar of my application in target folder. i am ruuning an application by clicking on play window. (Can not see any jar though target folder is getting created.)
How to run this in local
How to run this in production (How to make this command production ready)
Related
I can't get my custom environment to run under Tomcat. It always loads the development profile.
I create a WAR with the following under Grails 4.0.5:
grails -Dgrails.env=qa war
The resulting grails.build.info looks correct:
info.app.version=2.0.7
info.app.name=myapp
grails.env=qa
info.app.grailsVersion=4.0.5
However, when I drop it into Tomcat 8 and run, I get this:
[ost-startStop-1] com.myapp.ApplicationLoader : The following profiles are active: development
Running standalone, though, works just fine:
./gradlew -Dgrails.env=qa bootRun
grails.util.Environment, defines a number of pre-configured environments.
Environment APPLICATION
Environment CUSTOM
Environment DEVELOPMENT
Environment PRODUCTION
Environment TEST
In application.yml we get pre-configured development, test, and production environments. So if we want to add custom environments we add similarly. In your case it will be qa.
With Grails command line we can execute any command within the context of a specific environment. The format is:
grails [environment] [command name]
Suppose if want to create a WAR for the test environment you wound run:
grails test war
To target other environments you can pass a grails.env variable to any command:
grails -Dgrails.env=UAT run-app
I create a WAR with the following under Grails 4.0.5:
grails -Dgrails.env=qa war
Yes, all looks good as per grails documentation and configuration.
I have Created POC app for same with Grails 4.0.5 and also downloaded external tomcat apache-tomcat-8.5.63.
My application.yml with qa ENV:
Running standalone, though, works just fine:
./gradlew -Dgrails.env=qa bootRun
Yes. This also works fine.
So, now i have created war file with grails -Dgrails.env=qa war
Then i started my tomcat and dropped my poc-app-0.1.war file into tomcat.
when tomcat deployed/extracted my war, entered local url into browser.
You can see in above image, Environment is qa
So everything is running as i passed to env while creating war.
I tested with multiple environments, both pre-configured and custom environments. But did not got any issue like created war for qa and running on dev.
Also i have tested with java -jar poc-app-0.1.war and it's running on same env as we given.
Application details:
and tomcat version is apache-tomcat-8.5.63
It may be some versions or configuration issue with your app.
Please refer this link of my poc. Can you please try to create war and deploy in same way to your tomcat and let me know.
If you are still getting issue, then please share your minimal code or poc.
Even i got one more similar kind of issue on grails repo, please do refer this.
I have followed lot of documentation and references but still not able to reproduce your issue.
Links:
Environment class
Upgrade Doc
Command Line
API Doc
Conf Doc
I am trying to use jhipster, so far Ive seen how it works on java8, I even found an example repo with java7 that is certainly java 8 (https://github.com/jhipster/jhipster-sample-app-java7).
I was wondering if there is any way I can generate an app to run with java7? I know is deprecated from jhipster but seems like if I can run jhipster v 1.7.0 I could do it, any idea how?
So far this is what jhipster -help shows
C:\Users\user>jhipster -help
Usage: jhipster [command] [options]
Commands:
app Create a new JHipster application based on the selected options
aws Deploy the current application to Amazon Web Services
ci-cd Create pipeline scripts for popular Continuous Integration/Continuous Deployment tools
client Create a new JHipster client-side application based on the selected options
cloudfoundry Generate a `deploy/cloudfoundry` folder with a specific manifest.yml to deploy to Cloud Foundry
docker-compose Create all required Docker deployment configuration for the selected applications
entity [name] Create a new JHipster entity: JPA entity, Spring server-side components and Angular client-side components
export-jdl [jdlFile] Create a JDL file from the existing entities
heroku Deploy the current application to Heroku
import-jdl [jdlFiles...] Create entities from the JDL file passed in argument
info Display information about your current project and system
kubernetes Deploy the current application to Kubernetes
languages [languages...] Select languages from a list of available languages. The i18n files will be copied to the /webapp/i18n folder
openshift Deploy the current application to OpenShift
rancher-compose Deploy the current application to Rancher
server Create a new JHipster server-side application
service [name] Create a new Spring service bean
upgrade Upgrade the JHipster version, and upgrade the generated application
completion Print command completion script
Options:
-h, --help output usage information
-d, --debug enable debugger
-V, --version output the version number
You're referring to a 2 years old project sample. Current version of JHipster 4.x requires JDK 8, there's no way to generate a project compatible with JDK 7 with it.
The only solution would be to install an obsolete version of JHipster like 2.22.0 which is the one used to generate this JDK 7 sample project:
npm install -g generator-jhipster#2.22.0
then follow instructions of this version's documentation: http://www.jhipster.tech/documentation-archive/v2.22.0/
I have a current setup of intellij 2016 which compiles my java files on the fly. Due to some configuration in intellij it is possible to propagate any changes directly to tomcat. This way I don't have to manually build a new application and deploy it to tomcat which increases user productivity.
We want to remove tomcat and start using wildfly10 but also keep the hotdeploy functionality. On top of that the wildfly server will be hosted in a docker container.
So what I did is that I mounted the wildfly/standalone/deployment/myapp.war using docker to my host directory myapp/target/myapp.war. In addition I configured a jboss remote server configuration with remote stating set to same file system and let maven build an exploded war. This way if a maven build is performed, the contents of the target/myapp.war directory is directly available in my docker container. When I run the container and perform a new maven package, I do see that wildfly states that the new changes are found and redeploying has succeeded. Unfortunately this only goes well once or two times in a row.
So coming from the tomcat hotdeploy where no maven build was involved and any changes where directly available in tomcat, I'm wondering if the same can be achieved with the setup: intellij, maven, wildfly and docker. So if a change of a java file in intellij is compiled and pushed to wildfly without redeploying or maven build?
Wild-fly - eclipse supports 100 % Hot Code replacement
you have to start web-app in debugging mode .
For every change in java code just do a maven install and refresh
the target .
Limitations :
you can only replace statements in method .
you are not allowed to change whole class and new methods .
I just followed the steps at
https://devcenter.heroku.com/articles/newrelic#java-configuration
from step
Add the New Relic agent as a Maven dependency
up until step
Add the New Relic agent as a Scala+SBT/Play 2 dependency
to install New Relic add on for my web service (Jetty JAX-RS REST).
I customized the newrelic.yml (same folder as pom.xml) with my own app license_key and app name. However, when logged onto my Heroku app's newrelic page, I just see a bunch of configuration steps. After clicking on "Connect to my application", it just stalls. Needless to say, it's been over a couple of hours with my webservice taking traffic.
I have a feeling new relic isn't even running. I updated the newrelic.yml to have DEBUG logging, but there were no logs from new relic at startup. Does newrelic.jar expect the newrelic.yml at the root with pom.xml?
Thanks,
Luke
Turns out I had to add
$JAVA_OPTS
in
java $JAVA_OPTS -cp target/classes:target/dependency/* service.Main
I have installed Heroku java plug-in and trying to set example application i.e. "Web & Asynchronous worker with Spring, CloudAMQP". This project is following maven and application gets deployed on heroku thru maven.
Would it be possible to run same application using local java container, rabbitmq and worker running in same and/or different JVM?
Yes, Foreman will start any project that has a Procfile. If there are multiple processes defined it will start them all.
https://devcenter.heroku.com/articles/procfile#developing-locally-with-foreman
You'll have to build the project locally with Maven first. You can either set the config info for your rabbitmq instance into environment variable or save them in a .env file which foreman will pick up. You can look at your Heroku app with 'heroku config' to see the variables that the app is expecting.