Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not initialize jdk.net.SocketFlow: org/evosuite/runtime/instrumentation/InstrumentedClass #39

Closed
MingWEN-CS opened this issue Jun 19, 2016 · 4 comments
Labels

Comments

@MingWEN-CS
Copy link

MingWEN-CS commented Jun 19, 2016

I have used Evosuite to generate test cases for a library, and then try to run with it using JUnit command.

However, for some test cases, it will pops out the could not initialize jdk.net.SocketFlow error, which hinders the suceesfully run of the JUnit test cases.

I have no idea of this problem, is this a compatibility issue?

I use the Evosuite 1.0.2 sevosuite-standalone-runtime-1.0.2.jar, and tried with jdk 8 and openjdk and JUnit 4.12.

Hope you can help me!
The following is part of the output of the running

`[stdin] JUnit version 4.12
[stderr] 7 [main] INFO org.evosuite.runtime.agent.AgentLoader - dynamically loading javaagent
[stderr] 24 [main] INFO org.evosuite.runtime.agent.AgentLoader - Using JavaAgent in ./lib/evosuite-standalone-runtime-1.0.2.jar
[stderr] 31 [main] INFO org.evosuite.runtime.agent.AgentLoader - Classpath: ./lib/junit-4.12.jar:./lib/hamcrest-all-1.3.jar:../TargetLibraries/google-collections-1.0/lib/google-collections-1.0.jar:./lib/evosuite-standalone-runtime-1.0.2.jar:./lib/slf4j-simple-1.6.1.jar:../TargetLibraries/google-collections-1.0/evosuite-tests/evosuite-tests-30-0
[stderr] 31 [main] INFO org.evosuite.runtime.agent.AgentLoader - Going to attach agent to process 13392
[stderr] 295 [Attach Listener] INFO org.evosuite.runtime.agent.InstrumentingAgent - Executing agentmain of JavaAgent
[stderr] 956 [main] INFO org.evosuite.runtime.instrumentation.CreateClassResetClassAdapter - Found static initializer in class com/google/common/collect/ReverseNaturalOrdering
[stderr] 956 [main] INFO org.evosuite.runtime.instrumentation.MethodCallReplacementClassAdapter - No hashCode defined for: com/google/common/collect/ReverseNaturalOrdering, superclass = com.google.common.collect.Ordering
[stderr] 957 [main] INFO org.evosuite.runtime.instrumentation.MethodCallReplacementClassAdapter - Adding mock interface to class jdk/net/SocketFlow
[stderr] 961 [main] INFO org.evosuite.runtime.instrumentation.MethodCallReplacementClassAdapter - No hashCode defined for: jdk/net/SocketFlow, superclass = java.lang.Object
[stderr] 961 [main] INFO org.evosuite.runtime.instrumentation.CreateClassResetClassAdapter - Creating brand-new static initializer in class jdk/net/SocketFlow
[stderr] 961 [main] INFO org.evosuite.runtime.instrumentation.CreateClassResetClassAdapter - Adding bytecode for initializing field UNSET
[stderr] 961 [main] INFO org.evosuite.runtime.instrumentation.CreateClassResetClassAdapter - Adding bytecode for initializing field NORMAL_PRIORITY
[stderr] 961 [main] INFO org.evosuite.runtime.instrumentation.CreateClassResetClassAdapter - Adding bytecode for initializing field HIGH_PRIORITY
## [stderr] 962 [main] ERROR org.evosuite.runtime.classhandling.ClassStateSupport - Could not initialize jdk.net.SocketFlow: org/evosuite/runtime/instrumentation/InstrumentedClass
[stderr] 962 [main] INFO org.evosuite.runtime.instrumentation.MethodCallReplacementClassAdapter - Adding mock interface to class com/google/common/collect/Collections2
[stderr] 964 [main] INFO org.evosuite.runtime.instrumentation.CreateClassResetClassAdapter - Found static initializer in class com/google/common/collect/Collections2
[stderr] 964 [main] INFO org.evosuite.runtime.instrumentation.MethodCallReplacementClassAdapter - No hashCode defined for: com/google/common/collect/Collections2, superclass = java.lang.Object
[stderr] 965 [main] INFO org.evosuite.runtime.instrumentation.MethodCallReplacementClassAdapter - Adding mock interface to class com/google/common/base/Preconditions
[stderr] 972 [main] INFO org.evosuite.runtime.instrumentation.MethodCallReplacementClassAdapter - No hashCode defined for: com/google/common/base/Preconditions, superclass = java.lang.Object
[stderr] 972 [main] INFO org.evosuite.runtime.instrumentation.CreateClassResetClassAdapter - Creating brand-new static initializer in class com/google/common/base/Preconditions
[stderr] 973 [main] INFO org.evosuite.runtime.instrumentation.MethodCallReplacementClassAdapter - Adding mock interface to class com/google/common/collect/ImmutableCollection$1
[stderr] 973 [main] INFO org.evosuite.runtime.instrumentation.MethodCallReplacementClassAdapter - No hashCode defined for: com/google/common/collect/ImmutableCollection$1, superclass = java.lang.Object

@MingWEN-CS
Copy link
Author

When I use evosuite-1.0.2.jar instead of evosuite-standalone-runtime-1.0.2.jar in the command line, it had no such error, however, the program hang at a certain point after displaying the following stack traces:

Exception in thread "main" java.util.NoSuchElementException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1431)
at java.util.HashMap$KeyIterator.next(HashMap.java:1453)
at org.pitest.mutationtest.report.html.MutationTestSummaryData.getPackageName(MutationTestSummaryData.java:60)
at org.pitest.mutationtest.report.html.MutationHtmlReportListener.generateAnnotatedSourceFile(MutationHtmlReportListener.java:81)
at org.pitest.mutationtest.report.html.MutationHtmlReportListener.handleMutationResult(MutationHtmlReportListener.java:246)
at org.pitest.mutationtest.config.CompoundTestListener.handleMutationResult(CompoundTestListener.java:39)
at org.pitest.mutationtest.execute.MutationAnalysisExecutor.processResult(MutationAnalysisExecutor.java:71)
at org.pitest.mutationtest.execute.MutationAnalysisExecutor.run(MutationAnalysisExecutor.java:54)
at org.pitest.mutationtest.tooling.MutationCoverage.runReport(MutationCoverage.java:148)
at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:103)
at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:45)
at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:87)
at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:45)
stderr : Error opening zip file or JAR manifest missing : /tmp/146640709654706336871413656663603559246791606654.jar

@arcuri82
Copy link
Member

hmmm... jdk.net classes shouldn't had been instrumented by EvoSuite. I made a fix in a new alpha2 release:

1.0.4-alpha2

can you confirm if you still get same problem with that release?

cheers

@MingWEN-CS
Copy link
Author

Thanks ! @arcuri82 I will try this one!!

@gofraser
Copy link
Member

Since jdk.* is now excluded from instrumentation, this problem should be fixed. If it re-appears, please re-open this issue.

gofraser pushed a commit that referenced this issue Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants