Details

      Description

      The following error occurs for unit tests using NewEnvTestRule when running with JDK11.

          [junit] Testcase: testCustomizedClassInitialization(com.liferay.portal.kernel.io.SerializerTest):	Caused an ERROR
          [junit] com/liferay/whip/coveragedata/TouchUtil
          [junit] java.lang.NoClassDefFoundError: com/liferay/whip/coveragedata/TouchUtil
          [junit] 	at com.liferay.portal.kernel.io.Serializer.<clinit>(Serializer.java:381)
          [junit] 	at com.liferay.portal.kernel.io.SerializerTest.testCustomizedClassInitialization(SerializerTest.java:285)
          [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          [junit] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          [junit] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          [junit] 	at com.liferay.portal.kernel.test.rule.NewEnvTestRule.invoke(NewEnvTestRule.java:147)
          [junit] 	at com.liferay.portal.kernel.test.rule.NewEnvTestRule$RunInNewClassLoaderStatement.evaluate(NewEnvTestRule.java:477)
          [junit] 	at com.liferay.portal.kernel.test.rule.CodeCoverageAssertor$1.evaluate(CodeCoverageAssertor.java:85)
          [junit] Caused by: java.lang.ClassNotFoundException: com.liferay.whip.coveragedata.TouchUtil
          [junit] 	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
          [junit] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
          [junit] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      

      The Whip jar is specified as "-javaagent".

      In JDK<=8, the java agent jar will be automatically included in the value of system property "java.class.path".

      In JDK>=9, it's no longer included, see https://bugs.openjdk.java.net/browse/JDK-8208064.

      NewEnvTestRule relies on this property when creating the new env; on JDK11, the new env will not have Whip jar in its class path.

        Attachments

          Activity

            People

            • Assignee:
              brian.chan Brian Chan
              Reporter:
              dante.wang Dante Wang
              Recent user:
              Dante Wang
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                48 weeks, 1 day ago

                Packages

                Version Package
                7.1.X
                Master