How can I get past this exception involving jvisualvm with oc4j? - java

Every time I try to start the CPU profiler I get the following exception. I have found reference to this exception in conjunction with Asian languages, but that is not the case here.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:348)
Caused by: java.lang.NullPointerException
at org.netbeans.lib.profiler.server.ProfilerActivate15.getArchiveFile(ProfilerActivate15.java:78)
at org.netbeans.lib.profiler.server.ProfilerActivate15.activate(ProfilerActivate15.java:99)
at org.netbeans.lib.profiler.server.ProfilerActivate15.agentmain(ProfilerActivate15.java:64)
... 6 more

I gave up and used the following instead
http://www.jvmmonitor.org/index.html

Related

SonarQube is unable to analyze file: ArrayIndexOutOfBoundsException

We're facing problems when analyzing one of our Java projects.
The following error is reported:
ERROR: Error during SonarQube Scanner execution
org.sonar.squidbridge.api.AnalysisException: SonarQube is unable to analyze file : '/jenkins/dev1/Project1/src/com/myproject/dm/voucher/image/TextblockContent.java'
at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:93)
at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:67)
at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:136)
at org.sonar.java.JavaSquid.scan(JavaSquid.java:129)
at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:90)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:98)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:185)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:243)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:238)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:228)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonar.runner.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:274)
at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:165)
at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:152)
at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:118)
at org.sonarsource.scanner.cli.Main.execute(Main.java:80)
at org.sonarsource.scanner.cli.Main.main(Main.java:66)
Caused by: java.lang.ArrayIndexOutOfBoundsException
We execute the analysis using SonarQube Scanner.
SonarQube V5.3 is in use.
Unfortunately I cannot append the file TextblockContent.java to this posting because stackoverflow seems not to offer this feature...

ParameterizedAssertionError using EasyTest when test case fails

I wanted to try EasyTest to get input parameters from a CSV and found the following, nicely written, example in a blog posted here:
http://gpcmol.blogspot.com/2013/06/easytest-unit-testing-with-externalized.html
If I follow the example it runs beautifully giving me a nice PDF output as advertised.
However if I cause a test case failure, by changing the last line of input from ",9,-12" to ",9,-13", I no longer get PDF output and get 2 failures rather than one.
The first failure is the correct assertion that the test case fails. The second failure is the following exception:
<testcase name="classMethod" classname="TransformCelciusTest" time="0.0">
<failure message="org.junit.experimental.theories.internal.ParameterizedAssertionError: testToCelsiusConverter(TestInfo [testClass=org.junit.runners.model.TestClass#90bb3e6, dataLoader=org.easetech.easytest.loader.CSVDataLoader#5f4fc5ad, filePaths=[data/temperatureConversionData.csv], methodName=testToCelsiusConverter])" type="org.junit.experimental.theories.internal.ParameterizedAssertionError">org.junit.experimental.theories.internal.ParameterizedAssertionError: testToCelsiusConverter(TestInfo [testClass=org.junit.runners.model.TestClass#90bb3e6, dataLoader=org.easetech.easytest.loader.CSVDataLoader#5f4fc5ad, filePaths=[data/temperatureConversionData.csv], methodName=testToCelsiusConverter])
at org.easetech.easytest.util.RunAftersWithOutputData.writeData(RunAftersWithOutputData.java:157)
at org.easetech.easytest.util.RunAftersWithOutputData.evaluate(RunAftersWithOutputData.java:133)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at org.easetech.easytest.loader.CSVDataLoader.writeDataToCSV(CSVDataLoader.java:364)
at org.easetech.easytest.loader.CSVDataLoader.writeData(CSVDataLoader.java:180)
at org.easetech.easytest.util.RunAftersWithOutputData.writeData(RunAftersWithOutputData.java:154)
... 27 more
Caused by: java.lang.NullPointerException
at org.easetech.easytest.loader.CSVDataLoader.writeOutputData(CSVDataLoader.java:382)
at org.easetech.easytest.loader.CSVDataLoader.writeDataToCSV(CSVDataLoader.java:347)
... 29 more
</failure>
</testcase>
Anybody understand how to modify the example so that it properly completes without the ParameterizedAssertionError exception so that the test case failure can be properly reported in the output (PDF)?
I think this is related:
JUnit #Theory : is there a way to throw meaningful exception?
I tested the scenario with EasyTest Core 1.3.1 library and indeed it is an issue(infact a bug) in EasyTest 1.3.1. Specifically there is a NullPointerException in CSVDataLoader because it is expecting the test Duration value but its not present because of test failure. I have to see whats the best solution for this problem. I will keep you posted of the solution. In the mean time, you could try the Excel and XML Data loader. Or if you want a quick solution, you can copy paste the CSVDataLoader and override the line 364 of CSVDataLoader such that it checks if DURATIOn is present and only then call toString on it. Then you can use this Loader as Custom loader in the #DataLoader annotation.
Thanks,
Anuj Kumar

jaxb implementation not working for windows 7

I am creating java classes from xsd using jaxb, but when i try to send xml over http i get a run time error
java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract javax.xml.bind.annotation.AccessType javax.xml.bind.annotation.XmlAccessorType.value() (Found data of type Ljavax/xml/bind/annotation/XmlAccessType;.FIELD)
sun.reflect.annotation.AnnotationTypeMismatchExceptionProxy.generateException(AnnotationTypeMismatchExceptionProxy.java:38)
sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:56)
$Proxy6.value(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.sun.xml.bind.v2.model.annotation.LocatableAnnotation.invoke(LocatableAnnotation.java:60)
$Proxy8.value(Unknown Source)
com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getAccessType(ClassInfoImpl.java:339)
com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:228)
com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:87)
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:127)
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.java:51)
com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.java:232)
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:201)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:327)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:198)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:124)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:358)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:323)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
com.arcot.jaxb.KECHPSWI.KECHPSWI.marshal(KECHPSWI.java:117)
com.arcot.jaxb.servlet.ClientMachine.doPost(ClientMachine.java:39)
com.arcot.jaxb.servlet.ClientMachine.doGet(ClientMachine.java:84)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
my development environment is Tomcat 6.0, jdk 1.6 on windows 7, can someone please help me resolve this problem?
Looks like you have two different version of class javax.xml.bind.annotation.AccessType.
May be you have duplicate jax-api.jar in your classpath.

InvocationTargetException, from this exception how to extract caused exception with message

When run this statement from other Java program.
mainMethod.invoke(null,(Object) args);
I got this Exception
I'm dying!
I'm not dead yet!
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.fourgid.ot.action.RunThread.run(RunThread.java:59)
***Caused by: java.lang.SecurityException
at Main$1.checkExit(Main.java:21)
at java.lang.Runtime.exit(Runtime.java:88)
at java.lang.System.exit(System.java:904)
at Main.main(Main.java:30)***
... 5 more
i just to show only caused exception that is SecurityException with messages and line numbers(above highlighted text) given by JVM.
I am developing an application for compile and execute the program on web.
Thank you!!
My suggestion: catch the InvocationTargetException and then try exception.getCause(). You might then be able to get more details from the underlying SecurityException.

Evasive cause inside InvocationTargetException

Executing a Java code I capture an InvocationTargetException. Using the printStackTrace method I get the following:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Tester.main(Tester.java:180)
Caused by: java.lang.NullPointerException
at [...] (it doesn't really matters)
My code checks several programs written by other persons, so the cause shown by printStackTrace is varied. However, if I try to get just the internal cause using method getCause, the result is always a disgusting null!
Java 6 API says that, from release 1.4 in advance, getCause returns the cause exception provided during construction... should I assume that Method.invoke does not construct the exception properly, or am I losing something?
Thanks in advance

Categories

Resources