I have configured JavaMelody in my application and its working fine with one instance and returning all the required graph and stats when I hit {domain-url}/monitoring but actual problem comes when I deployed my application on multi ageing environment(AWS EC2 load balancer) and suppose if I have 3 (server Ips: 10.45.120.10, 10.45.120.11 and 10.45.120.103) instance there then when I call {domain-url}/monitoring it shows once instance(server Ip 10.45.120.10) stats and graphs and when I re-hit {domain-url}/monitoring it display another instance(Server Ip 10.45.120.11) stats and graphs and so on.
Is there any way to view aggregate stats and graphs from all instance in one page on one hit {domain-url}/monitoring
Javamelody dependencies is below
<dependency>
<groupId>net.bull.javamelody</groupId>
<artifactId>javamelody-spring-boot-starter</artifactId>
<version>1.81.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</dependency>
and my application.properties for javamelody
javamelody.enabled=true
javamelody.init-parameters.log=true
javamelody.spring-monitoring-enabled=true
javamelody.init-parameters.url-exclude-pattern=(/webjars/.*)
javamelody.init-parameters.authorized-users= user:mypass
javamelody.init-parameters.monitoring-path= /monitoring
javamelody.obsolete-graphs-days=60
javamelody.obsolete-stats-days=60
Note: when I am using javamelody.init-parameters.storage-directory=/opt/myapp then no stats is displaying
P.S. I am using maven spring boot 2.1.1, Java11, javamelody 1.81.0 and my application is restful only.
Related
Jaeger traces to spring-boot application are not able to capture traces for the DB calls made using spring-data. All other calls like RESTTemplate are able to have the traces captured.
Using springboot version 2.2.2.RELEASE and added below jaeger dependencies,
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-jaeger-web-starter</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-jdbc</artifactId>
<version>0.2.11</version>
</dependency>
Any additional dependencies are missing here?
Remove your dependencies and use the following one that will include also the instrumentation you need
<dependency>
<groupid>io.opentracing.contrib</groupid>
<artifactid>opentracing-spring-jaeger-cloud-starter</artifactid>
<version>3.2.0</version>
</dependency>
I've developed a stand-alone drools application, with rules implemented via .drl files. I'm used the Eclipse IDE to develop the app. I want to embed this application in a web application using the tomcat web server package. I'd like to create a web app project in Eclipse and add the drools dependencies to the project, as needed. Which drools libraries/artifacts do I need to add to the project, e.g. kie and drools libraries/artifacts?
More specifically, if I create a maven-based web-app project using Eclipse. What other maven artifacts will I need to add to the POM for the drools capabilities?
The logic in the web application servlet will create a kie container and session, instantiate a set of Facts based on model definitions, insert the Facts into the session, fire the rules, and respond to the initial http request based on the results of rules evaluation.
I resolved the question I posed above a while ago. I'm posting an answer to close the question. I came up with a set of maven dependencies that I used to create a java servlet application that initializes and invokes an embedded DROOLS rules engine to process an http request. I've successfully tested the servlet-based application within a Tomcat server (v8.5). I used the Eclipse IDE to create the application as a maven-based project. The pom.xml file for the application has the following dependencies.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.4</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>6.5.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>6.5.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>6.5.0.Final</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
I have swagger.json generated using java code and used maven. I have downloaded the static files and placed inside WEB-INF folder, however I cannot access the swagger-ui.html/ index.html
Thanks in advance.
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
<version>1.5.13</version>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
</exclusions>
</dependency>
ServletRegistration.Dynamic swaggerServlet = servletContext.addServlet("Jersey2Config", new JerseyJaxrsConfig());
swaggerServlet.setInitParameter("api.version", "1.0.0");
swaggerServlet.setInitParameter("swagger.api.basepath","/");
swaggerServlet.setLoadOnStartup(2);
I finally figured out that this is a conflict with default servlet and my rest servlet,
so i changed my service to go under /service/*
and then now i can access static swagger-ui.html and feed the swagger.json to get my swagger-ui.html working..
I built an application using spring cron jobs using boot and is working fine.
But I want to create a jar that will be executed via command line to execute my cron jobs.
I don't want to use spring boot and xml.
I searched ,but found nothing
How can I do this? I am not getting from where I should start
You can have fun and add all hierarchy dependencies from parent and all children depencies:
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-batch/1.4.0.RELEASE
<!-- Spring Batch -->
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
...
It was long and not funny job to get juste the necessary dependencies.
When using embedded jetty and started via
mvn jetty:run
The following exception is thrown:
Exception in thread "main" java.util.ServiceConfigurationError:
org.apache.juli.logging.Log: Provider org.eclipse.jetty.apache.jsp.JuliLog not a subtype
Here is the pom.xml snippets:
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<version>3.0.0.v201112011016</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>
<version>8.1.19.v20160209</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>8.1.19.v20160209</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.6</version>
</dependency>
Any pointers to a correctly configured embedded jetty (preferably also using websockets) appreciated.
Don't try to enable everything all at once.
Jetty is a highly modular system, you can pick and choose what you want to run. Nothing is mandatory by default, even the Server!
If you want examples of embedded jetty with websockets, consider reviewing the example projects that the Jetty project has put together at ...
https://github.com/jetty-project/embedded-websocket-echo-examples
Some advice:
Build up your requirements layer by layer
Start with basic websocket endpoint functionality (get this working first!)
then add slf4j + logback. (be sure you use an appropriate version, see the <scope>optional</scope> dependencies present in your previous layer before you choose a version of slf4j or logback). Test this like there is no tommorrow.
then add jsp support (as your error seems to indicate your desire for jsp support)