jmx

Getting JMX working under Tomcat 7 with SSL and a self-signed cert

↘锁芯ラ 提交于 2019-12-04 20:13:30
I'm trying to get JMX working under Tomcat 7.0.23 with SSL. The servers are located in AWS, which means all the hosts are NATed, and I need to use JmxRemoteLifecycleListener to explicitly set the two ports used by JMX. I've been doing a lot of reading on the subject but I just can't get all the pieces working together properly. I can get JMX working fine without SSL. I have downloaded the version of catalina-jmx-remote.jar for my version of Tomcat and installed it in my tomcat/lib directory. My server.xml contains: <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"

List all the user in weblogic by java

随声附和 提交于 2019-12-04 17:51:47
Does anyone know how to list all the weblogic users in java? For instance, there is 5 users in security realm, and I want to get all of them. How do I do? It's pretty easy. For future reference, if you want to look up something like "how do I do X with weblogic and Java..." use JMX in your google search. Here is an example from weblogic wonders . Note you will need to change your URL and user/password in the code: import javax.naming.*; import javax.management.MBeanInfo; import weblogic.jndi.Environment; import weblogic.management.runtime.ServerRuntimeMBean; import weblogic.security.providers

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

蹲街弑〆低调 提交于 2019-12-04 17:45:30
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 as described here http://internna.blogspot.com/2007/08/hibernate-statistics-in-enterprise-5.html but I

jboss datasource statistics JMX monitoring - inconsistent information

99封情书 提交于 2019-12-04 17:40:06
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-datasource-property> <xa-datasource-property name="User"> xxxx </xa-datasource-property> <xa-datasource

how to modify ThreadPoolTaskExecutor at runtime through jmx

旧巷老猫 提交于 2019-12-04 16:49:22
I'm having trouble modifying my MBean properties through JConsole. I have a Threading bean which invoked with: public static void main(String[] args) throws Exception { // JMX new SimpleJmxAgent(); // spring executor context ApplicationContext ctx = new FileSystemXmlApplicationContext( "src/resources/ThreadContent.xml"); startThreads(ctx); } private static void startThreads(ApplicationContext ctx) { TaskExecutor tE = (TaskExecutor) ctx.getBean("TaskExecutor"); System.out.println("Starting threads"); for (int i = 0; i < 10; i++) { tE.execute(new RepeatingGrpPoC()); } ThreadContent.xml contains

Name for @ManagedOperation in Spring JMX

别等时光非礼了梦想. 提交于 2019-12-04 14:18:41
I used org.springframework.jmx.export.annotation.@ManagedOperation to expose a method as MBean. I want the operation name different from the method name, but managed operation doesn't have any attribute for it. For example: @ManagedOperation public synchronized void clearCache() { // do something } and I want this operation exposed with name = "ResetCache". Create a custom annotation: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface JmxName { String value(); } And a custom subclass of MetadataMBeanInfoAssembler : public class CustomMetadataMBeanInfoAssembler

Unable to see metrics captured with spring metrics annotations

匆匆过客 提交于 2019-12-04 12:19:23
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-meter", "requests", TimeUnit.SECONDS).time(); try { ... } finally { timerContext.stop(); } with spring

Creating WebLogic users programmatically from a standalone Java client

安稳与你 提交于 2019-12-04 11:45:16
I'm trying to create users in WebLogic (10.3.4) programmatically from a simple standalone Java client (one class --> two methods: createWeblogicUser() & main()). public void createWeblogicUser() { try { Hashtable<String, String> env = new Hashtable<String, String>(); env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); env.put(Context.SECURITY_PRINCIPAL, "weblogic"); env.put(Context.SECURITY_CREDENTIALS, "weblogic"); env.put(Context.PROVIDER_URL, "t3://myserver:7001"); InitialContext ctx = new InitialContext(env); MBeanServer wls = (MBeanServer) ctx.lookup("java

实战利用tomcat的JMX端口上传webshell

微笑、不失礼 提交于 2019-12-04 11:13:55
1、 配置tomcat启动jconsole到1099端口的配置: 参考文章:https://www.cnblogs.com/baihuitestsoftware/articles/6405580.html //可以将其设置为无密码访问: cd /opt/apache-tomcat-8.0.3/bin vi catalina.sh # OS specific support. $var _must_ be set to either true or false.添加如下变量: CATALINA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=192.168.1.100 -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" //重启tomcaty ./shutdown.sh ./startup.sh 2、 本地->运行输入:jconsole //VM概要中获得tomcat的web主目录 : Dcatalina.home=/opt/apache-tomcat-8.0.3 //获得/manager/html后台的访问密码: /

Disabling JMX in a spring application

匆匆过客 提交于 2019-12-04 10:36:50
问题 I'm trying to disable jmx so that i don't get org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mbeanExporter'anymore. I've found a partial answer saying that I should include this in the application.properties file: spring.datasource.jmx-enabled=false So I created the file with that one line. But how do I make sure that Spring acutally reads it? Do I need to edit something in spring.xml? If so, where? 回答1: Are you using spring boot? If so you just need