Project

Profile

Help

Support #5182

closed

Problem in adding license file for sexon-ee java

Added by Shivam Kumar Chaudhary over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2021-12-01
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Hello , I am trying to add license file for sexon-ee java lib by using following code

Configuration configuration = new Configuration();
        configuration.setConfigurationProperty(Feature.LICENSE_FILE_LOCATION,"C:/Users/shchaudhary/Downloads/saxon-license.lic");

Processor processor = new Processor(true);

But this is throwing following exception:

[2021-12-01T21:23:55.946Z] Caused by: java.lang.IllegalArgumentException: Unknown configuration property C:/Users/shchaudhary/Downloads/saxon-license.lic

I have also set the SAXON_HOME environment variable SAXON_HOME = "C:\Users\shchaudhary\Downloads"

Could anyone help me to identify the correct way?

Thanks

Actions #1

Updated by Michael Kay over 2 years ago

You've created a Configuration (as distinct from a ProfessionalConfiguration or EnterpriseConfiguration); that won't give access to any PE or EE features and therefore doesn't have the ability to load license files.

I'd recommend

Processor proc = new Processor(true);
proc.setConfigurationProperty(....);
Actions #2

Updated by Shivam Kumar Chaudhary over 2 years ago

actually with this saxon-ee lib , we are trying to call external jar methods by specifying jar in xslt file like this :

<xsl:stylesheet version="2.0"
     xmlns:fib="java:com.company.Main" >

<xsl:template match="/">
test value: <xsl:value-of select="fib:testMethod()"/>

  </xsl:template>

</xsl:stylesheet>

this is the jar class imp:

package com.company;

public class Main {

    public static void main(String[] args) {
	// write your code here
    }

    public static void testMethod() {
        System.out.println("testMethod Main");
    }
}

but after running all this code :

   Processor processor = new Processor(true);
            processor.setConfigurationProperty(Feature.LICENSE_FILE_LOCATION,"C:/Users/shchaudhary/Downloads/saxon-license.lic");
            processor.setConfigurationProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS,true);
            processor.setConfigurationProperty(Feature.TRACE_EXTERNAL_FUNCTIONS, true);
            XsltCompiler compiler = processor.newXsltCompiler();
            XsltExecutable stylesheet = compiler.compile(new StreamSource(new File("C:/Users/shchaudhary/Downloads/org.microsoft.functions.xslt/Artifacts/MapWithXslt20Function.xslt")));
            StringWriter writer = new StringWriter();
            Serializer out = processor.newSerializer(writer);
            out.setOutputProperty(Serializer.Property.METHOD, "xml");
            out.setOutputProperty(Serializer.Property.INDENT, "yes");
            Xslt30Transformer transformer = stylesheet.load30();
            transformer.transform(new StreamSource(new File("C:/Users/shchaudhary/Downloads/org.microsoft.functions.xslt/Artifacts/MapWithXslt20FunctionInput.xml")), out);

I am getting this error:

[2021-12-02T04:07:27.865Z] The class com.company.Main could not be loaded: com.company.Main

[2021-12-02T04:07:27.865Z] Error in {fib:testMethod()} at char 0 in xsl:value-of/@select on line 35 column 58 of MapWithXslt20Function.xslt:

[2021-12-02T04:07:27.865Z] XPST0017 Cannot find a 0-argument function named Q{java:com.company.Main}testMethod().

[2021-12-02T04:07:27.865Z] Cannot load Java class java:com.company.Main. For diagnostics on calls to Java methods,

[2021-12-02T04:07:27.866Z] use the -TJ command line option or set the Configuration property

[2021-12-02T04:07:27.866Z] FeatureKeys.TRACE_EXTERNAL_FUNCTIONS

Actions #3

Updated by Shivam Kumar Chaudhary over 2 years ago

package com.company;

public class Main {

    public static void main(String[] args) {
	// write your code here
    }

    public static String testMethod() {
        //System.out.println("testMethod Main");
        return "testMethod";
    }
}

Actions #4

Updated by Michael Kay over 2 years ago

The error " The class com.company.Main could not be loaded: com.company.Main" means that this class was not found on the classpath.

How did you invoke your application, and how did you set up the classpath?

Actions #5

Updated by Michael Kay about 2 years ago

  • Status changed from New to Closed
  • Assignee set to Michael Kay
  • Priority changed from High to Normal

I'm closing this as we haven't heard any further from you. Please feel free to reopen the issue if there is more information.

Please register to edit this issue

Also available in: Atom PDF