Project

Profile

Help

Support #5182

Problem in adding license file for sexon-ee java

Added by Shivam Kumar Chaudhary about 2 months ago. Updated 17 days 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

History

#1 Updated by Michael Kay about 2 months 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(....);

#2 Updated by Shivam Kumar Chaudhary about 2 months 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

#3 Updated by Shivam Kumar Chaudhary about 2 months 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";
    }
}

#4 Updated by Michael Kay about 2 months 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?

#5 Updated by Michael Kay 17 days 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