jmx

Exposing Hibernate (cache) statistics through JMX with Spring in Tomcat

只愿长相守 提交于 2019-12-21 21:35:04
问题 Collecting Hibernate/Ehcache statistics and exposing them through JMX in Spring-based setups seems easy. The Internet has lots of resources that help e.g. http://snippets.dzone.com/posts/show/11159 However, all those articles assume one is working with a Hibernate session factory of some sort. I'm not - my entities are JPA annotated and I use a javax.persistence.EntityManager . If I were deploying to a Java EE container I might have been able to obtain a Hibernate session factory through JNDI

Will ThreadMXBean#getThreadAllocatedBytes return size of allocated memory or objects?

做~自己de王妃 提交于 2019-12-21 21:33:41
问题 I want to employ com.sun.management.ThreadMXBean to do something like this: long before = threadMxBean.getThreadAllocatedBytes(currentThreadId); seriousBusiness(); // some calls here long after = threadMxBean.getThreadAllocatedBytes(currentThreadId); long allocDiff = after - before; // use for stats or whatever The question is, what does this method actually return: amount of new memory allocated at the moment of method invocation or the size of allocated objects ? To be clear on what

jboss datasource statistics JMX monitoring - inconsistent information

那年仲夏 提交于 2019-12-21 21:27:23
问题 I have defined two datasources in *-ds.xml on jboss 4.2.3 (redhat 4.3) Both datasources are identical. Only jndi-name differ Each defines min=max=10 <xa-datasource> <jndi-name>com.trax.hibernate.DataSource</jndi-name> <track-connection-by-tx>true</track-connection-by-tx> <isSameRM-override-value>false</isSameRM-override-value> <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class> <xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:1521:orcl10</xa

Unable to see metrics captured with spring metrics annotations

流过昼夜 提交于 2019-12-21 20:26:47
问题 How can I do the equivalent of: @Override public void init(final ServletConfig config) throws ServletException { super.init(config); CsvReporter.enable(new File("/tmp/measurements"), 1, TimeUnit.MINUTES); GraphiteReporter.enable(1, TimeUnit.MINUTES, "my.host.name", 2003); } @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { final TimerContext timerContext = Metrics.newMeter(CreateSessionServlet.class,"myservlet

Unable to see metrics captured with spring metrics annotations

≡放荡痞女 提交于 2019-12-21 20:26:18
问题 How can I do the equivalent of: @Override public void init(final ServletConfig config) throws ServletException { super.init(config); CsvReporter.enable(new File("/tmp/measurements"), 1, TimeUnit.MINUTES); GraphiteReporter.enable(1, TimeUnit.MINUTES, "my.host.name", 2003); } @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { final TimerContext timerContext = Metrics.newMeter(CreateSessionServlet.class,"myservlet

Can't stop tomcat normally when I configure jmxremote

淺唱寂寞╮ 提交于 2019-12-21 12:31:32
问题 I added a jmxremote configuraiton in the catalina.bat: set JAVA_OPTS=-Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false so that I could start jconsole to monitor the tomcat's performance. But I got a problem that I couldn't stop tomcat normally through $CATALINA_HOME\catalina.bat stop , neither did $CATALINA_HOME\shutdown.bat Any suggestions? 回答1: There are 2 things: Please have a look at my blog post, where I

Is it possible to programmatically close a Java process through JMX

假装没事ソ 提交于 2019-12-21 12:29:26
问题 I'm currently writing an app to monitor another Java process and take specific actions when certain targets are hit. For example, if a thread deadlocks for a certain time, kill the thread, if the memory usage goes over a specific amount, send email alerts and kill the process, etc. My app will run as a stand-alone app, monitoring specific other apps (locally, though from what I can see remote or local makes no difference here). I'm monitoring the external JVMs via MXBeans, but cannot see a

How to change tomcat jmx password's file permission

試著忘記壹切 提交于 2019-12-21 07:16:09
问题 I am trying to secure JMX access on my local tomcat instance hosted on Windows platform. I have created access and password files and plugged those using the following VM arguments: -Dcom.sun.management.jmxremote.password.file -Dcom.sun.management.jmxremote.access.file But I am running into an issue during tomcat start-up: Error: Password file read access must be restricted . I tried changing the password's file owner and access using file security tab but it doesn't seem to be working. Any

How to make the JMX custom authentication work?

北慕城南 提交于 2019-12-21 06:17:33
问题 I am using the password and access file based authentication on JMX. When building my JMXConnectorServer, i use the property names and it works fine. Map<String, String> env = new HashMap<String, String>(); env.put(ApplicationProperties.JMX_PWD_FILE_PROP, pwdFile); env.put(ApplicationProperties.JMX_ACCESS_FILE_PROP, accFile); connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(jmxServiceURL, env, mBeanServer); However, now i want to use a custom authenticator and i implemented

How should I monitor a web application on tomcat using JMX?

情到浓时终转凉″ 提交于 2019-12-21 05:51:51
问题 I would like to monitor web applications running under tomcat using JMX. I don't want to just use the built in JMX implementation of Tomcat, I want to implement an mbean for the actual Web Application so I can get information on application-specific settings and monitor it. The problem with web applications and online monitoring is that web applications are not always active but are "awaken" to handle requests by the server so monitoring them is not just plugging in with JMX as I would for a