Skip to Content
4
Former Member
Jul 29, 2015 at 08:01 PM

No license has been found in the system exception when running JUnit tests in IntelliJ

742 Views

Hello all,

I'm currently on hybris 5.5.1and am using IntelliJ to run JUnit tests. I have initialized my JUnit tenant. Plain JUnit tests work fine, but when I extend ServicelayerTest I'm getting the following exception:

 java.lang.SecurityException: 
 **************************************************************
 No license has been found in the system. Check whether you have valid hybris or SAP license and install it before starting system.
 **************************************************************
 hybris licence []
     at de.hybris.platform.util.Utilities.failLicence(Utilities.java:2601)
     at de.hybris.platform.core.AbstractTenant.doStartUp(AbstractTenant.java:665)
     at de.hybris.platform.core.Registry.assureTenantStarted(Registry.java:639)
     at de.hybris.platform.core.Registry.activateTenant(Registry.java:700)
     at de.hybris.platform.core.Registry.setCurrentTenant(Registry.java:544)
     at de.hybris.platform.util.Utilities.setJUnitTenant(Utilities.java:1472)
     at de.hybris.platform.testframework.runlistener.PlatformRunListener.testRunStarted(PlatformRunListener.java:44)
     at de.hybris.platform.testframework.ChainingRunNotifierWrapper$1.notifyListener(ChainingRunNotifierWrapper.java:97)
     at de.hybris.platform.testframework.ChainingRunNotifierWrapper$SafeNotifier.run(ChainingRunNotifierWrapper.java:239)
     at de.hybris.platform.testframework.ChainingRunNotifierWrapper.fireTestRunStarted(ChainingRunNotifierWrapper.java:99)
     at de.hybris.platform.testframework.HybrisJUnit4ClassRunner.run(HybrisJUnit4ClassRunner.java:124)
     at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
     at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
     at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
     at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

I have added -DHYBRIS_CONFIG_DIR=hybris/config to the VM options so that HYBRIS_CONFIG_DIR would point to hybris/config. I have the hybrislicense.jar located in hybris/config/license. I can start the hybris server without any errors about the license. I can run the tests fine outside the IDE but not in IntelliJ.

Anyone have any ideas?