Issues while configuring collectd with java (GenericJMX) plugin to fetch weblogic data - weblogic12c

Actual behavior:
Does not connect to weblogic server, throws an error and does not load java plugin:
java plugin: cjni_create_jvm: JNI_CreateJavaVM failed with status -1.
[2017-05-04 04:23:34] java plugin: cjni_thread_attach: cjni_create_jvm failed.
[2017-05-04 04:23:34] java plugin: Configuration block for GenericJMX' found, but no such configuration callback has been registered. Please make sure, theLoadPlugin' lines precede the Plugin' blocks.
[2017-05-04 04:23:34] java plugin: cjni_init: jvm == NULL
[2017-05-04 04:23:34] Initialization of pluginjava' failed with status -1. Plugin will be unloaded.
Steps to reproduce
Enable Java plugin after making the below changes to the collectd.conf:,
JVMArg "-Djava.class.path=/scratch/gbuora/u00/app/ora_fmw/oracle/Middleware/Oracle_Home/wlserver/server/lib/wljmxclient.jar:/scratch/gbuora/u00/app/ora_fmw/oracle/Middleware/Oracle_Home/wlserver/server/lib/wlclient.jar:/opt/collectd/share/collectd/java/collectd-api.jar:/opt/collectd/share/collectd/java/generic-jmx.jar -Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -Djavax.net.ssl.trustStore=/scratch/gbuora/u00/app/ora_fmw/oracle/Middleware/Oracle_Home/wlserver/server/lib/connectTrust.jks -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder -Djavax.net.ssl.identityStore=/scratch/gbuora/u00/app/ora_fmw/oracle/Middleware/Oracle_Home/wlserver/server/lib/connectIdentity.jks-Djavax.net.ssl.identityStore=/scratch/gbuora/u00/app/ora_fmw/oracle/Middleware/Oracle_Home/wlserver/server/lib/connectIdentity.jks -Djava.naming.security.principal=weblogic -Djava.naming.security.credentials=welcome123 "
LoadPlugin "org.collectd.java.GenericJMX"
<MBean "garbage_collector">
ObjectName "java.lang:type=GarbageCollector,*"
InstancePrefix "gc-"
InstanceFrom "name"
<Value>
Type "invocations"
Table false
Attribute "CollectionCount"
</Value>
<Value>
Type "total_time_in_ms"
InstancePrefix "collection_time-"
Table false
Attribute "CollectionTime"
</Value>
</MBean>
<MBean "memory">
ObjectName "java.lang:type=Memory"
InstancePrefix "memory-"
<Value>
Type "memory"
Table true
Attribute "HeapMemoryUsage"
InstancePrefix "heap-"
</Value>
<Value>
Type "memory"
Table true
Attribute "NonHeapMemoryUsage"
InstancePrefix "nonheap-"
</Value>
</MBean>
<MBean "memory_pool">
ObjectName "java.lang:type=MemoryPool,*"
InstancePrefix "memory_pool-"
InstanceFrom "name"
<Value>
Type "memory"
Table true
Attribute "Usage"
</Value>
</MBean>
<Connection>
Host "localhost"
ServiceURL "t3://localhost:8001/jndi/weblogic.management.mbeanservers.domainruntime"
Collect "memory_pool"
Collect "garbage_collector"
Collect "memory"
</Connection>
Restart collectd.

renamed the localhost in the service:jmx:iiop url with complete hostname. the issue got resolved.

Related

Graphite server shows blank kafka metrics while using collectd JMX and java plugin

I am using collectd JMX and java plugin to gather kafka metrics and write to graphite server. When I run the command to see kafka metrics from the node it shows the data but when I use collectd plugin blank metrics are exported. Any idea if I am missing some configuration. Below is the sample code snipped
try this,
<Plugin java>
JVMARG "-Djava.class.path=/usr/share/collectd/java/collectd-api.jar‌​:/usr/share/collectd‌​/java/generic-jmx.ja‌​r"
LoadPlugin "org.collectd.java.GenericJMX"
<Plugin "GenericJMX">
<MBean "kafka-all-messages">
ObjectName "kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec"
<Value>
Type "counter"
Table false
Attribute "Count"
</Value>
</MBean>
<Connection>
ServiceURL"service:jmx:rmi:///jndi/rmi://localhost:2999/jmxr‌​mi"
Host "localhost"
Collect "kafka-all-messages"
</Connection>
</Plugin>
</Plugin>

Issue enabling jpa and jdbc in Websphere Liberty

I am following these exercises for learning Liberty.
I am having an issue in he Lab 3 - Module 2.2 Liberty and JPA (DB2) .
After setting all the JDBC and Data Source details, i restart the server and i do not see the two lines that mention the dataSource and jdbd driver.
[AUDIT] J2CA8004I : The dataSource DB2Connection is avilable as jdbc/DB2Connection.
[AUDIT] J2CA8000I : The jdbcDriver my JDBCDriver is available.
How can i know if the jpa and jdb features ae correctly set?
This is the server.xml
<!-- Enable features -->
<featureManager onError="WARN">
<feature>jsp-2.2</feature>
<feature>jpa-2.0</feature>
<feature>jdbc-4.0</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
httpPort="9080"
httpsPort="9443" />
<jdbcDriver id="myJDBCDriver">
<library name="DB2Lib">
<fileset dir="C:\wlp\db2jdbc" includes="db2jcc4.jar, db2jcc_license_cu.jar"></fileset>
</library>
</jdbcDriver>
<dataSource jndiName="jdbc/DB2Connection" id="DB2Connection"
jdbcDriverRef="myJDBCDriver">
<properties.db2.jcc databaseName="SAMPLE" serverName="igacloud" password="{xor}FhgeOz1tPj08" user="db2admin"></properties.db2.jcc>
</dataSource>
Unlike Classic WebSphere, which has a "test connection" capability in its admin console (datasource panel), there is no equivalent means with WebSphere Liberty yet. Have you tried testing the connection with a simple "Hello World" JPA application?
The CWWKF0012I message is simply confirming what features have been enabled - some features depend on other features and automatically enables them, which is why you see more features than defined in your server.xml.

Meaning of name attribute in JBoss MBean xml descriptor

JBoss 4/5 MBeans such as NamingAlias are defined in XML as follows
<mbean code="org.jboss.naming.NamingAlias" name=":service=NamingAlias,fromName=queue/original">
<attribute name="ToName">queue/linked</attribute>
<attribute name="FromName">queue/original</attribute>
</mbean>
Paying attention to the attributename=":service=NamingAlias,fromName=queue/original I see the parameters service and fromName.
Following the instructions to create a custom MBean here:
https://developer.jboss.org/wiki/ExampleHelloWorldService
The XML configuration for the MBean created is
<server>
<mbean code="com.acme.HelloWorldService" name="acme.com:service=HelloWorld">
<attribute name="Message">Hello World</attribute>
</mbean>
</server>
I noticed only service is specified in the name attribute.
Is service mandatory for all the beans? What about adding additional parameters such as fromName? Can these values be used from within the class that implements the MBean or are those mandated?
The name attribute can be any valid (and unique) JMX ObjectName. The keys and values themselves do not have any special significance other than their subjective significance to the developer.
In the first example, the ObjectName does not specify a domain (the value to the left of the colon) so the MBeanServer assumes the default domain, which in this case would be jboss so notionally:
:service=NamingAlias,fromName=queue/original == jboss:service=NamingAlias,fromName=queue/original
The ObjectName (and it's embedded domain and key/values) can be used within the class. In standard JMX, one would typically make the impl implement MBeanRegistration which injects the MBeanServer and ObjectName when the bean is registered. However, the example you referenced is a specialized JBoss ServiceMBean which does this automatically and your implementation will store the ObjectName in the field called serviceName.

Jboss5.01GA RMI EJB3.0

I have a cloud instance where i have installed Jboss5.0.1GA server. Server instance contains a Public ip and a natted Ip Address. I have run Jboss server using -b with ip(natted) address and web url is working fine. Now i am creating Java external client to access EJB3 bean which is deployed in Jboss server where i am getting the exception and trying solution using google which is not helped my case. Find below code which tells what i am using in external client to access EJB3.
properties = new Properties();
properties.load(stream);
// Set the context
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
ht.put(Context.PROVIDER_URL,"public ip address");
ht.put(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
// Find and create a reference to the bean using JNDI
context = new InitialContext(ht);
While executing it localhost its working fine. While connecting remote throwing below exception. "javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: ". Can anyone help me on the same.
`This is my connector file(ejb3-connectors-jboss-beans.xml).
EJB3 Connectors
-->
JBoss Remoting Connector
Note: Bean Name "org.jboss.ejb3.RemotingConnector" is used
as a lookup value; alter only after checking java references
to this key.
-->
<property name="invokerLocator">
<value-factory bean="ServiceBindingManager"
method="getStringBinding">
<parameter>
jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3
</parameter>
<parameter>
<null />
</parameter>
<parameter>socket://${jboss.bind.address}:${port}</parameter>
<parameter>
<null />
</parameter>
<parameter>3873</parameter>
</value-factory>
</property>
<property name="serverConfiguration">
<inject bean="ServerConfiguration" />
</property>
AOP
org.jboss.aspects.remoting.AOPRemotingInvocationHandler
`
Do a telnet to the ip and port you are trying to connect on the jboss from the remote server instance. If that's not working then you have to solve networking issues first. (Let me know, so I can guide you on how to do it)
Also check your EJB3 binding settings and check networking. Out of the box config looks looks this..
<mbean code="org.jboss.remoting.transport.Connector"
xmbean-dd="org/jboss/remoting/transport/Connector.xml"
name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
<depends>jboss.aop:service=AspectDeployer</depends>
<attribute name="InvokerLocator">socket://0.0.0.0:3873</attribute>
<attribute name="Configuration">
<handlers>
<handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
</handlers>
</attribute>
</mbean>
Thanks!
#leo.
To my case below 2 things worked for me.
1. Running Jboss server using run.bat -b **public ip(not nat ip)** -Djboss.bind.address=0.0.0.0
2. Enabling my **local** machine hosts file to point remote ip to hostname ie remoteip remotehostname.
Hope it will help to others as well.

How to configure startup sequence of JBoss services (JmsActivation)

When I deploy my application on JBoss 5 the EJBs are created before the QueueService is started. Creation of Message Driven beans now fails miserably because the queues are not yet available:
17:11:29,151 INFO [EJBContainer] STARTED EJB: .....
17:11:29,266 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
..
..
17:11:29,928 WARN [JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec#11694c ...
javax.naming.NameNotFoundException: ... not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.server.NamingServer.lookup(NamingServer.java:399)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.util.naming.Util.lookup(Util.java:222)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:464)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:352)
at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:729)
at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:213)
at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
17:11:30,027 INFO [QueueService] Queue[/queue/....] started, fullSize=200000, pageSize=2000, downCacheSize=2000
How can the deploy sequence be configured?
Found the answer myself. I added the following annotation to the message driven bean:
#Depends({"jboss.messaging.destination:service=Topic,name=XxxxTopic"})
<?xml version="1.0" encoding="UTF-8"?>
<!--
Null persistence config.
Use this if you don't actually want to persist anything
$Id$
-->
<server>
<!-- Persistence Manager MBean configuration
======================================== -->
<mbean code="org.jboss.messaging.core.jmx.NullPersistenceManagerService"
name="jboss.messaging:service=PersistenceManager"
xmbean-dd="xmdesc/NullPersistenceManager-xmbean.xml"/>
<!-- Messaging Post Office MBean configuration
========================================= -->
<mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
name="jboss.messaging:service=PostOffice"
xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
<!-- The name of the post office -->
<attribute name="PostOfficeName">JMS post office</attribute>
<!-- This post office is clustered. If you don't want a clustered post office then set to false -->
<attribute name="Clustered">false</attribute>
</mbean>
<!-- Messaging JMS User Manager MBean config
======================================= -->
<mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
name="jboss.messaging:service=JMSUserManager"
xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
<depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
</mbean>
</server>
save this as 'null-persistence-service.xml' and put this deploy/messaging/
Now it will works