View Full Version : lmflex problem

07-20-2009, 10:57 AM
Hi all,

I am new to Your product and I am following Your documentation FLEXnet Licensing (v11.6.1.0 build 66138 i86_n3).

I have problems with part when I need to start lmflex.exe file from Command line.

I've completed everything without a problem till that moment. I've started Server, and when I enquiry from LMTOOLS I got:

Flexible License Manager status on Mon 7/20/2009 17:38

[Detecting lmgrd processes...]
License server status: 27000@astoisavljevic
License file(s) on astoisavljevic: D:\FLEXnet LM\i86_n3\counted.lic:

astoisavljevic: license server UP (MASTER) v11.6

Vendor daemon status (on astoisavljevic):

demo: UP v11.6
Feature usage info:

Users of f1: (Total of 4 licenses issued; Total of 0 licenses in use)

but when I try to start lmflex.exe in command line
I am getting:

D:\FLEXnet LM\i86_n3>lmflex
lc_flexinit failed: 20

Do You have any idea what is the reason ?

07-20-2009, 11:06 AM
The return value 20 from lc_flexinit means that the FLEXnet Licensing service hasn't been installed. There are a few ways to install it, the easiest (for testing) probably being to run:

installanchorservice.exe Sample lmflex

The C function reference and the trusted storage programming and reference guide have more information.

07-21-2009, 09:23 AM

thank You for Your quick answer but i found solution for previous problem.
I didn't have admin privileges on my local WinXP machine so I delivered
FlexNet to Linux OpenSUSE machine where at tje end my web application should run. There I managed to go through Starting and Stoping FlexNET LM and tried lmflex app supplied as example. It works.

Now I want to add demo license to my application. I am using Java implementation.

So what I accomplished till now ?

Step 1) Installed FLEXnet Licensing Toolkit for Java

Step 2) Created lmpubkey.h using lmnewgen -pubkey

Step 3) Copied machind\lm_code.h, i86_n3\lmpubkey.h and i86_n3\lmseeds.h to java folder in FLEXnet Licensing Toolkit for Java

Step 4) Started vendorInfo.bat that produced demoInfo.java

Step 5) Created Java project, added BasicExample.java, ConnDataExample.java and demoInfo.java.

= BasicExample.java =

package rs.in.staleksit.main;

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.macrovision.flexlm.Feature;
import com.macrovision.flexlm.FeatureSpecifier;
import com.macrovision.flexlm.FlexlmConstants;
import com.macrovision.flexlm.FlexlmException;
import com.macrovision.flexlm.License;
import com.macrovision.flexlm.VendorInfo;

* @author a.stoisavljevic
public class BasicExample implements FlexlmConstants {

private static final Log LOGGER = LogFactory.getLog(BasicExample.class);

private static final String DEF_VERSION = "1.0";
private static final String DEF_PATH = "@localhost&counted.lic";

* @param args
public static void main(String[] args) {
LOGGER.info("+++++ Basic Example start +++++");
if ( args.length < 1 ) {
// use specified version if it's here
String version = null;
if (args.length > 1) {
version = args[1];
} else {
version = DEF_VERSION;
String licSpec = null;
if ( args.length > 2 ) {
licSpec = args[2];
} else {
licSpec = DEF_PATH;

VendorInfo vInfo = getVendorInfo();

FeatureSpecifier fs = null;
License lic = null;
try {
// creates a feature specifier from the feature name supplied
// Use version 1.0
fs = new FeatureSpecifier(args[0], version);

ConnDataExample connData = null;

lic = new License(fs, licSpec, vInfo, connData);

// checkout the license

// Get the vendor string from the checked-out license,
// if present
Feature feat = lic.getFeature();
String vendorString = feat.getVendorString();
LOGGER.info(args[0] + " checked out (VS: " + vendorString + ")");
LOGGER.info("Hit return to checkin: ");

try {
int i = System.in.read();
} catch (IOException e) {
LOGGER.info("ERROR! IOException: " + e.getMessage(), e);

} catch (FlexlmException e) {
LOGGER.info("+++++ FlexLm Exception occured! +++++");


private static VendorInfo getVendorInfo() {
VendorInfo vInfo = null;
try {
vInfo = new demoInfo();
} catch (FlexlmException e) {
throw new RuntimeException(e.getMessage());
return vInfo;

private static void usage() {
LOGGER.info("usage: BasicExample <featurename> [version] [lic-path]");
LOGGER.info("\tversion defaults to: " + DEF_VERSION);
LOGGER.info("\tlicence path defaults to: " + DEF_PATH);


= demoInfo.java =

//This file is auto-generated, do not edit by hand
package rs.in.staleksit.main;

import com.macrovision.flexlm.FlexlmConstants;
import com.macrovision.flexlm.FlexlmException;
import com.macrovision.flexlm.VendorInfo;
import com.macrovision.flexlm.misc.FlexlmPublicKey;
import java.security.PublicKey;

public class demoInfo extends VendorInfo implements FlexlmConstants {

public demoInfo() throws FlexlmException {

public String getVendorName() {
return "demo";

public PublicKey getPublicKey(int strength) {
switch (strength) {
return new FlexlmPublicKey(getVendorName(),"679CB2969DE9742459A08C008165671E");

return new FlexlmPublicKey(getVendorName(),"67A2394A31B335FA7CB4F251F6DF6C9412872A0CBDEE");

return new FlexlmPublicKey(getVendorName(),"66CB85D5F8CEF5AE75FE646E2F7D5D1B535D7DC22206D5C244E7E669BB6A75");

return null;

public int[] getEncryptionSeeds() {
return new int[] {0x0,0x686cb677 };

public int[] getVendorKeys() {
return new int[] {0x0,0x0,0x0,0x0 };

public int[] getCroKeys() {
return new int[] { };

public int getDefaultStrength() {
return LM_STRENGTH_113BIT;



And when I try to start application at getVendorInfo() method on
vInfo = new demoInfo(); I am getting RuntimeException with next key

Invalid FLEXlm key data supplied (-44,7004)

What I am doing wrong ???

Can some help me about this ?

07-21-2009, 10:21 AM
Hmmm... The fact that getVendorKeys and getCroKeys in demoInfo.java both return zeroes is a problem. Do your demo keys in lm_code.h have nonzero VENDOR_KEY and TRL_KEY values? You will need TRL keys to use the FLEXnet Java API...

07-21-2009, 10:27 AM
I just copied lm_code.h from i86_n3 as suggested in demo.

Here is lm_code.h that demoInfo.java is generated upon:


* Copyright (c) 1990-2008 Acresso Software Inc. All Rights Reserved.
* This software has been provided pursuant to a License Agreement
* containing restrictions on its use. This software contains
* valuable trade secrets and proprietary information of
* Acresso Software Inc. and is protected by law. It may
* not be copied or distributed in any form or medium, disclosed
* to third parties, reverse engineered or used in any manner not
* provided for in said License Agreement except with the prior
* written authorization from Acresso Software Inc.
* Description: Used to generate lm_new.o/.obj and by license-
* generators.
* Once the kit is "built" (using make or nmake) this file is no longer
* needed, but should be stored somewhere safe.
* Set the following values:
* VENDOR_KEY1-5 Provided by Acresso Software Inc.
* VENDOR_NAME If not evaluating, set to vendor name.
* LM_SEED1-3 Make up 3 32-bit numbers, (or use
* 'lmrand1 -seed' to make up), keep secret, safe,
* and never change.
* TRL_KEY1-2 Provided by Acresso Software Inc. if TRL used.
* LM_STRENGTH: If using TRL, set to desired length
* Upgrading: from version older than 8.1: Copy your
* ENCRYPTION_SEEDs from the old lm_code.h file.
* Make sure LM_STRENGTH matches, if you were

#ifndef LM_CODE_H
#define LM_CODE_H
#include "lm_trl.h"
* Vendor keys: Enter keys received from Acresso Software Inc.
* Changing keys has NO impact on license files
* (unlike LM_SEEDs).
#define VENDOR_KEY1 0x0
#define VENDOR_KEY2 0x0
#define VENDOR_KEY3 0x0
#define VENDOR_KEY4 0x0
#define VENDOR_KEY5 0x0
* Vendor name. Leave "demo" if evaluating. Otherwise,
* set to your vendor daemon name.
#define VENDOR_NAME "demo"
* Private SEEDs: Make up 3, 8-hex-char numbers, replace and
* guard securely. You can also use the command
* 'lmrand1 -seed' to make these numbers up.
#define LM_SEED1 0x12345678
#define LM_SEED2 0x87654321
#define LM_SEED3 0xabcdef01
* Pick an LM_STRENGTH:
* LM_STRENGTH Options are
* Public key protection unused. Use SIGN=
* attribute. sign length = 12
* TRL:
* LM_STRENGTH_113BIT, LOW: sign length= 60 chars
* LM_STRENGTH_163BIT, MEDIUM:sign length= 84 chars
* LM_STRENGTH_239BIT, HIGH: sign length=120 chars
* Pre-v7.1:
* LM_STRENGTH_LICENSE_KEY: Use old license-key.
* If you're upgrading from
* pre-v7.1, and want no changes, set this to
* TRL Keys: Provided by Acresso Software Inc., if TRL is used.
* Be sure to set LM_STRENGTH to
* LM_STRENGTH_DEFAULT, above, if TRL_KEYs are zero.
#define TRL_KEY1 0x0
#define TRL_KEY2 0x0

#include "lm_code2.h"
#endif /* LM_CODE_H */

07-21-2009, 10:34 AM
I believe you'll need to contact Acresso sales to get demo (evaluation) VENDOR_KEY and TRL_KEY values for lm_code.h. There are evaluation and contact links on the FLEXnet Publisher page here: http://www.acresso.com/products/fnp/flexnet-publisher-overview.htm.