How to connect JProfiler to an application running on remote OC4J? - jprofiler

Problem: the OC4J instance will now not start up after configuring for JProfiler.
Configuration:
OC4J 10.1.3.4.0, Java 1.5.0_06 (32-bit), remote server is Linux x86/AMD64, nowait. Manual sync of config, and I've copied over the config.xml from the .jprofiler directory. Default port of 8849.
In the ORACLE_HOME/opmn/logs/default_group~ifactory~default_group~1.log file, I see
13/03/19 14:48:42 Start process
--------
JProfiler> Protocol version 37
JProfiler> Using JVMTI
JProfiler> 32-bit library
JProfiler> Don't wait for frontend to connect.
JProfiler> Using config file /icu/ias/dev/ifactory/jprofiler/config.xml (id: 110)
JProfiler> Could not find session with id: 110
from ORACLE_HOME/opmn/conf/config.xml:
<process-type id="ifactory" module-id="OC4J" status="enabled">
<module-data>
<category id="start-parameters">
<data id="java-options" value="-server -Xmx1024m -Djava.security.policy=$ORACLE_HOME/j2ee/ifactory/config/java2.policy -Djava.awt.headless=true -Dhttp.webdir.enable=false -XX:MaxPermSize=512m -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -Dlog4j.debug=true -agentpath:/icu/ias/dev/ifactory/jprofiler/bin/linux-x86/libjprofilerti.so=port=8849,nowait,id=110,config=/icu/ias/dev/ifactory/jprofiler/config.xml "/>
</category>
<category id="stop-parameters">
<data id="java-options" value="-Djava.security.policy=$ORACLE_HOME/j2ee/ifactory/config/java2.policy -Djava.awt.headless=true -Dhttp.webdir.enable=false"/>
</category>
</module-data>
<start timeout="600" retry="2"/>
<stop timeout="120"/>
<restart timeout="720" retry="2"/>
<port id="default-web-site" range="12501-12600" protocol="ajp"/>
<port id="rmi" range="12401-12500"/>
<port id="rmis" range="12701-12800"/>
<port id="jms" range="12601-12700"/>
<process-set id="default_group" numprocs="1"/>
</process-type>
So, what am I missing?

Never mind. Apparently I had a slightly older version of the config.xml.

Related

tomee plus 1.7.2 - /bin/java: No such file or directory error

I'm getting the following error when starting TOMEE plus 1.7.2:
/home/atom/tomee-apps/boss/bin/catalina.sh: line 392: /opt/oracle/jdk/jdk1.8.0_60/jre
/bin/java: No such file or directory
If I do below from console, it works, which means that the java file does exist:
[atom#ustxplmadevapp1 bin]$ /opt/oracle/jdk/jdk1.8.0_60/jre/bin/java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
The startup.sh console output is like below:
[atom#ustxplmadevapp1 bin]$ ./startup.sh
Using CATALINA_BASE: /home/atom/tomee-apps/boss
Using CATALINA_HOME: /home/atom/tomee-apps/boss
Using CATALINA_TMPDIR: /home/atom/tomee-apps/boss/temp
Using JRE_HOME: /opt/oracle/jdk/jdk1.8.0_60/jre
Using CLASSPATH: /home/atom/tomee-apps/boss/bin/bootstrap.jar:/home/atom/tomee-apps/boss/bin/tomcat-juli.jar
Using CATALINA_PID: /var/apps/apache-tomee-plus-1.7.2/boss/tomcat.pid
Existing PID file found during start.
Removing/clearing stale PID file.
Tomcat started.
The setenv.sh is as of below:
JRE_HOME="/opt/oracle/jdk/jdk1.8.0_60/jre"
CATALINA_PID="/var/apps/apache-tomee-plus-1.7.2/boss/tomcat.pid"
Any idea why I'm getting such error? I've notice that the error always has a line break between /opt/oracle/jdk/jdk1.8.0_60/jre and /bin/java. Not sure if that is the cause of what.

Why does JProfiler log "ERROR: could not retransform class"?

I'm profiling (using instrumentation) a Java web app on Tomcat. When I attach a JProfiler session it first goes through a period of Retransforming Classes. During this period I am seeing numerous messages in the Tomcat log like these:
JProfiler> ERROR: could not retransform class Lcom/zaxxer/hikari/pool/HikariPool$HouseKeeper$$Lambda$36/1482601803; (62).
JProfiler> ERROR: could not retransform class Lcom/zaxxer/hikari/pool/HikariPool$HouseKeeper$$Lambda$35/545889432; (62).
JProfiler> ERROR: could not retransform class Lcom/sun/jersey/atom/rome/impl/provider/entity/AtomEntryProvider; (113).
JProfiler> ERROR: could not retransform class Lcom/sun/jersey/atom/rome/impl/provider/entity/AtomFeedProvider; (113).
What is the cause and implication of these errors?
I'm using:
Tomcat 7.0.55
Java 8
JProfiler 8.0.7
The used version of JProfiler is too old and does not fully support Java 8. Updating to 8.1.4 will fix this issue.

Changing the path for Worklight LogDirectory

I want to change the log directory to my custom path. So i have edited the server.xml like below.
<logging consoleLogLevel="OFF" copySystemStreams="false" maxFileSize="5" maxFiles="5" messageFileName="messages.log" logDirectory="/var/log" />
But once i changed and restarted the server it is not starting and throwing the below error
Launching LibertyServer (WebSphere Application Server 8.5.5.0/wlp-1.0.3.20130510-0831) on Java HotSpot(TM) 64-Bit Server VM, version 1.6.0_45-b06 (en_US)
[AUDIT ] CWWKE0001I: The server LibertyServer has been launched.
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at ../../../src/share/instrument/JPLISAgent.c line: 806
Worklight version 6.0.0.2 Liberty profile version 8.5.5.0-20130510-0831
if you need any info please comment.
Found the issue. it is the problem with the permission.
Please follow the below steps to avoid the errors.
Modify server.xml logging property like in the question.
Modifying value of ‘com.ibm.ws.logging.log.directory’ property in bootstrap.properties file to "/var/log"
Giving write permission to wladmin in folder ‘/var/log’ using the following command.
chmod -R 777 /var/log with superuser (superuser is root)

How to connect a JProfiler session with the designed ID?

I 've started a Java application with the args :
"-agentpath:C:\Program Files\jprofiler7\bin\windows-x64\jprofilerti.dll=port=8849,id=134,nowait"
then the console showed:
JProfiler> Protocol version 37
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 64-bit library
JProfiler> Don't wait for frontend to connect.
JProfiler> Using config file C:\Users\user\.jprofiler7\config.xml (id: 134)
JProfiler> Listening on port: 8849.
JProfiler> Instrumenting native methods.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Using dynamic instrumentation
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
JProfiler> Hotspot compiler enabled
Then I could connect by JProfiler GUI now.
But I need connect that via another Java application with JProfiler API.
How could I connect that ? By any VM argument ?
I just know maybe I have to create a connection first , but I don't know how to choose the session ID.
Connection connection = ConnectionFactory.createRemoteConnection("localhost", 8849, 30);
If I ran the agent application then connect via JProfiler GUi firstly ,I could get the cpu information by my Java application , including then running my JProfiler API application .
Profiling data :
Hot spots:
Top 5 hot spots:
Hot spot 1: ProfilerTest.main(java.lang.String[ ]): 34 ms (100 %)
Backtraces:
ProfilerTest.main(java.lang.String[ ]): 34722 (0)
***: 34722 (0)
Cpu tree:
***: 34722 (0)
ProfilerTest.main(java.lang.String[ ]): 34722 (0)
java.util.Scanner.next(): 34722 (0)
But I'll get nothing if I ran the agent application then connect via my JProfiler API application firstly.
Profiling data :
Hot spots:
Top 5 hot spots:
Cpu tree:
***: 0 (0)
After ",nowait", add ",config=[path to config file],id=nnn" where "[path to config file]" is %USERPROFILE%.jprofiler8\config.xml and "nnn" is the session ID that is visible in the top-right corner of the application settings tab in the session settings dialog.

Migrating from jboss 4.2 to jboss 6.0

we are planned to migrate the server file which are working in jboss 4.2 to jboss 6.0,
application.xml
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
ModuleMenuEar
<ejb>ModuleMenuBean.jar</ejb>
<web>
<web-uri>ModuleMenuWeb.war</web-uri>
<context-root>/ModuleMenuWeb</context-root>
</web>
In jboss 4.2, if is not available it takes as context-root, but if we deploy the same file in jboss 6.0 its throwing error like required context-root, is the any xml confoguration which make jboss 6.0 work like jboss 4.0
IN ejb-jar.xml
<session>
<display-name>ModuleRightsSB</display-name>
<ejb-name>ModuleRightsBean</ejb-name>
<local-home>lrp.settings.modulerights.shared.ModuleRightsLocalHome</local-home>
<local>lrp.settings.modulerights.shared.ModuleRightsLocal</local>
<ejb-class>lrp.settings.modulerights.bean.ModuleRightsBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jdbc/ReportDB</res-ref-name>
<jndi-name>java:/REPORTDS</jndi-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<res-ref-name>jdbc/ClientDB</res-ref-name>
<jndi-name>java:/MSSQLDS</jndi-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
in some ejb-jar.xml file, we used in ejb -jar.xml file itself , which is working properly in jboss 4.2, if we deploy the same file in jboss 6.0, its throwing error like required res-type, but its already available in ejb-jar.xml file,
Is there any xml configuration can be removed, so that it works without throeing any error,
kindly refer the attachment for more details
kindly help me to resolve this,
thanks in advance,
Vairam S
<jndi-name>java:/MSSQLDS</jndi-name> is not a valid tag for <resource-ref>. Try removing that, then make sure the sub-tags are in the following order:
<res-ref-name>jdbc/ClientDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
If that doesn't work, providing your stack trace might be helpful.