Lm class is invalid in Unit test

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Lm class is invalid in Unit test

Postby weijenli » Tue Mar 18, 2014 11:07 am

I got below error message when using jacoco-maven-plugin for unit test.
The Lm class is invalid, exiting ...

I have put this before any JIDE component code.
com.jidesoft.utils.Lm.verifyLicense

But it does not work.
Does anyone know why?
weijenli
 
Posts: 12
Joined: Thu Sep 19, 2013 5:48 am

Re: Lm class is invalid in Unit test

Postby JIDE Support » Tue Mar 18, 2014 11:25 am

You probably have different versions of jide jars in your class path. Make sure you use all the jide jars from the same version.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Lm class is invalid in Unit test

Postby weijenli » Tue Mar 18, 2014 11:37 am

Thanks for quick replying.
I use the same pom.xml for both my local and server unit test.
My local is Eclipse and it works.
The server is Jenkins, and it breaks whenever the code goes to a JIDE component.
weijenli
 
Posts: 12
Joined: Thu Sep 19, 2013 5:48 am

Re: Lm class is invalid in Unit test

Postby JIDE Support » Tue Mar 18, 2014 11:55 am

I am not sure exactly but mixing jide jars is the only reason for this error. Maybe it has old cached jar somewhere?
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Lm class is invalid in Unit test

Postby weijenli » Tue Mar 18, 2014 12:16 pm

I have below code, which tells the jar file a class is using:
==============================
CodeSource src = com.jidesoft.utils.Lm.class.getProtectionDomain().getCodeSource();
if (src != null) {
URL jar = src.getLocation();
System.out.println("JIDE jar LM ===> " + jar);
}

CodeSource src = TreeTableModel.class.getProtectionDomain().getCodeSource();
if (src != null) {
URL jar = src.getLocation();
System.out.println("JIDE jar TreeTableModel ===> " + jar);
}
this.treeTableModel = new TreeTableModel();
====================================

And the sysout are the same in both environment. However Jenkins breaks at the last line this.treeTableModel = new TreeTableModel();

Eclipse:
JIDE jar LM ===> /repository/jide-common/jide-common/3.5.4/jide-common-3.5.4.jar
JIDE jar TreeTableModel ===> /repository/jide-grids/jide-grids/2013.04.25/jide-grids-2013.04.25.jar

Jenkins:
JIDE jar LM ===> /repository/jide-common/jide-common/3.5.4/jide-common-3.5.4.jar
JIDE jar TreeTableModel ===> /repository/jide-grids/jide-grids/2013.04.25/jide-grids-2013.04.25.jar
weijenli
 
Posts: 12
Joined: Thu Sep 19, 2013 5:48 am

Re: Lm class is invalid in Unit test

Postby JIDE Support » Tue Mar 18, 2014 12:40 pm

Does you unit test tool inject byte code by any chance? If so, it will cause our code to think the Lm class is invalid. I know some code coverage tools will inject byte code. If so, just tell them don't inject byte code to Lm class using their configuration file.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Lm class is invalid in Unit test

Postby cgg_interactif » Tue Jan 13, 2015 3:58 am

Replying late .. but since it took me quite a while to find the right option I thaught it was a good idea to add more details :
Indeed JaCoCo can be configured to ignore classes in sonar settings :
JVM options: -javaagent:/s0/JenkinsTmp/jacocoagent43992717808226532.jar=destfile=target/jacoco.exec,excludes=com.jidesoft.utils.Lm
an it works ! :D
Soinar/Settings/General Settings/Java/JaCoCo
cgg_interactif
 
Posts: 1
Joined: Tue Jun 24, 2014 12:03 am

Re: Lm class is invalid in Unit test

Postby skotty » Wed Apr 22, 2015 9:00 am

I am having a similar problem. We have started adding unit tests to an existing project and are using JUint and JMockit. I have tried adding com.jidesoft.utils.Lm.verifyLicense() in the setup of my test but I receive the unauthorized access message box. Has anyone else run into this problem and know how to fix it?
skotty
 
Posts: 1
Joined: Wed Apr 22, 2015 8:50 am

Re: Lm class is invalid in Unit test

Postby JIDE Support » Wed Apr 22, 2015 9:02 am

You can fix it by passing the following three license key parameters as system parameters using -D.

verifyLicense.companyName=xxx
verifyLicense.projectName=xxx
verifyLicense.licenseKey=xxx
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: Google [Bot] and 12 guests