Using log4j in User definied Extension Function java class

Hi
I am having a java class where I defined all the user defined XSL Functions.
I used System.out.println for printing.
But I want to use log4j. But when I use this to debug. It is not recognising only.
Could you please tell me why this is not working in this class?
Regards,
Praveena

Hi Anuj,
I can see the below error in the default log file:
09/08/11 16:25:21 log4j:ERROR A "org.apache.log4j.RollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
09/08/11 16:25:21 log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
09/08/11 16:25:21 log4j:ERROR [global.libraries:1.0] whereas object of type
09/08/11 16:25:21 log4j:ERROR "org.apache.log4j.RollingFileAppender" was loaded by [oracle.bpel.common:10.1.3].
09/08/11 16:25:21 log4j:ERROR Could not instantiate appender named "LOGFILE".
09/08/11 16:25:21 log4j:WARN No appenders could be found for logger (oracle.sample.XSLFunction).
09/08/11 16:25:21 log4j:WARN Please initialize the log4j system properly.
log4j.properties file:
# Set root category priority to INFO and its only appender to CONSOLE.
log4j.rootCategory=INFO, LOGFILE
# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.LOGFILE.File= C:/product/10.1.3.1/OracleAS_1/opmn/logs/XSLUtilExten.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.Threshold=INFO,DEBUG
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=<%d>[%t] %p %C: %m%n
log4j.appender.LOGFILE.MaxFileSize=40MB
log4j.appender.LOGFILE.MaxBackupIndex=10
Could you please tell me what is the problem?
Edited by: Jakarta on Aug 11, 2009 4:16 AM

Similar Messages

  • XSLT Mapping - user defined Extension function

    Hi to all,
    can somebody helps me, please?
    I need an own function, that can be used by the XSL Mapper. First I have only tried the sample given in Path <BPELPM>\integration\orabpel\samples\demos\XSLMapper\ExtensionFunctions
    There is a java file with the defined functions and a xml file with the definition of this function for the mapper and last but not least a jar-file with the java class.
    I have copied the jar to <JDEV_HOME>\jdev\lib\ext directory and in JDeveloper I have added SampleExtensionFunctions.xml to Tools->Preferences->XSL Map -> "User Defined Extension Functions Config File" field. After a restart of JDeveloper I find 2 new functions in the "User Defined Extension Functions" component palette page when a XSL Map is open. That's fine.
    But if I test the mapping I get an error: "Failed to transform source XML.
    java.lang.NoSuchMethodException: For extension function, could not find method org.apache.xpath.objects.XNodeSet.replaceChar([ExpressionCotext,]#STRING, #STRING)."
    What is wrong?
    Thanks in advance of your answer
    best regard,
    uno

    Oracle XML support Extension function.
    For example:
    If we would like to import FAQDBUri.class with user-defined java functions, like TranslateDBUri(), we can write XSL file like this:
    <xsl:template match="/" xmlns:dburig="http://www.oracle.com/XSL/Transform/java/FAQDBuri">
    <xsl:variable name="urladd" select="dburig:TranslateDBUri($url)"/>

  • Please help for User defined extension functions

    the tutorial given for extension functions doesn't work as well as our new functions
    even though i follow all the given steps and see the functions in my user defined extension functions tab in xslt map.
    all the target nodes that use the extension function disappear in the resulted target xml.
    please help.

    have you compiled your java file and uploaded the jar file(containg the .class file and the Manifest.MF file) in the <OC4J_HOME>\j2ee\home\applib directory and then restarted the server??

  • User Defined Extension functions XML file

    Hi,
    Can we define exception In custom XSLT function XML file.
    Like i have following Custom XSLT function XML-
    <?xml version="1.0" encoding="UTF-8"?>
    <extension-functions>
    <functions xmlns:uppercase="http://www.oracle.com/XSL/Transform/java/oracle.Uppercase">
    <function name="uppercase:GetName" as="string">
    <param name="fname" as="string"/>
    <param name="lname" as="string"/>
    </function>
    </functions>
    </extension-functions>
    So in case i need to throw an exception in my java function GetName so how can i define that in XML?
    Please give some suggestion?
    Thanks.

    Hi,
    Thanks for your reply. When I created extensions.xml (as advised by you) and tried specifying it as User Defined Extension Functions Config file, I get the following error:
    Invalid User Extension Functions Config File
    Invalid value 'object' for attribute:'as' line 5 column 52
    i.e. the following line:
    <function name="extensions:getMSPDate" as="object">
    Any pointers on what will be the correct value for attribute 'as' for element 'function'?
    Also, what is the default namespace being used in the extensions.xml?
    Is there a link for more documentation on the format for extensions.xml?

  • User defined extension functions

    Hi,
    I have a requirement to create a user defined extension function.
    I followed the demo in the BPEL tutorials,and created the java function and then the extensions.xml.
    I have registered the .xml file,and have copied the .jar to jdev/extensions directory.
    Once i restart the Jdeveloper i am getting the following error.
    Severe(0,0): file:/D:/Software/Jdeveloper/jdevstudio10133/jdev/extensions/LogP1ExtensionFunctions.jar does not contain an extension manifest.
    Can anybody help me on this
    Thanks in advance
    Regards
    Ashwini

    Hi,
    I am trying to create user defined extension function in JDeveloper 10.1.3.4 to be used with the Oracle ESB.I have followed the documentation provided by the Oracle to resolve this issue without any success can you please help me in providing me the details how did you resolved this issue.
    Anticipating your earliest reply
    regards
    Narasimha

  • Component Palette --- "User Defined Extension Functions" not visible

    I added a User-Defined XPath Extension Function in JDeveloper 11.1.1.3.0 --> Tools > Preferences > SOA As given here http://download.oracle.com/docs/cd/E15523_01/integration.1111/e10224/bp_appx_functs.htm#BEIHEBIJ
    But I am not able see "User Defined Extension Functions" section itself in the component palette. Do I need to enable anything for see the section.
    Can somebody help.
    Thanks

    Hi,
    I am trying to create user defined extension function in JDeveloper 10.1.3.4 to be used with the Oracle ESB.I have followed the documentation provided by the Oracle to resolve this issue without any success can you please help me in providing me the details how did you resolved this issue.
    Anticipating your earliest reply
    regards
    Narasimha

  • Help! Can I have user defined extension function?

    Under SQL Sever XML, I can write a xsl script like this:
    <msxsl:script language="JScript" implements-prefix="myfunc">
    function getvalue(nodelist,name,istag){
    var subNode=nodelist.nextNode();
    if(subNode == null) return('?');
    if(istag == '') name = '@' + name;
    var value=subNode.getElementsByTagName(name);
    return((value == null)?'':value);
    </msxsl:script>
    and I can call this function in the xsl, obviously, msxsl supported by microsoft. I know that Oracle XML support Extension function, but you can tell here that I want a user defined function while not a predefined function. Can I have such feature with Oracle XML, and How? Thanks.

    Oracle XML support Extension function.
    For example:
    If we would like to import FAQDBUri.class with user-defined java functions, like TranslateDBUri(), we can write XSL file like this:
    <xsl:template match="/" xmlns:dburig="http://www.oracle.com/XSL/Transform/java/FAQDBuri">
    <xsl:variable name="urladd" select="dburig:TranslateDBUri($url)"/>

  • Soa 11g and jdeveloper 11g user defined extension function

    I have developed a set of extension functions,
    in design time for the previous version, I can put the deployment file (jar file) that contains the extension functions in the %JDEV_HOME%\jdev\lib\ext directory and jdeveloper recognizes the set of extension functions if previously i have defined an xml descriptor with every one of the functions i need to include in the panel.
    Now, with the jdeveloper 11g i have tried the same, and jdev recognizes the functions, but when I am going to test one transformation that includes the extension function, the parser is not founding the jar file; the error (in spanish) is:
    XML-22045: (Error) Error de funcion de extension: No se ha encontrado la clase '
    Falta la clase: aac._shared.extensions.xsl.XmlW3cDomFunctions
    Clase Dependiente: oracle.xml.xpath.XSLExtFunctions
    Cargador: main:11.0
    Origen del Codigo: /C:/.extracted/jdevstudio1111/lib/xmlparserv2.jar
    Configuraci≤n: system property PCLMain.createExtensionManagerLoader()
    Esta carga se ha iniciado en main:11.0 mediante el mΘtodo loadClass().
    La clase que falta no esta disponible desde ningun origen de codigo o cargador del sistema.
    my dude is:
    + at design time, where can I put the jars with extension functions to make one transformation function used in a mediator component can works fine?
    + at runtime, where can I put those libraries? (in the previous version, we can put this libraries in the %APP_SERVER%\j2ee\home\applib, or create one shared library and reference it in the oracle.bpel.common shared library declaration of the server.xml configuration file).

    Hi,
    please post this question to the JDeveloper 11 forum. Please translate the messages into English as well
    JDeveloper and OC4J 11g Technology Preview
    Frank

  • Using oracle.sql.BLOB data type in Java Class to pass in a Blob

    All,
    I'm trying to pass in a BLOB from PL/SQL to a Java Class, but the BLOB isn't passed correctly.
    When I check the length of the BLOB in PL/SQL its different from the length of the BLOB in java.
    I'm using DB 11g and the ojdbc5.jar file in my java classes.
    The java function uses the oracle.sql.BLOB type to get the parameter.
    The java class is loaded into the DB and called via a PL/SQL function.
    Kind regards,
    Nathalie

    The question is indeed a little ambigious defined ;o)
    When I pass the BLOB to the java method and invoke BLOB.getBytes() and then get the length of the BLOB in java the length of the BLOB is bigger than in PL/SQL.
    When I use the method 'getBinaryStream' and write this to a buffer, the code works.
    I will log a tar regarding the getBytes()-method to ask for more detailed information regarding the methods provided using the JDBC Drivers.
    Kind regards,
    Nathalie

  • C++ functions --- Java classes ---- C++ DLL

    Hi java programmers,
    It's been two weeks that I'm searching response to this problem :
    I hava some code written in c and java, here's the structure :
    Partner program c++ main function <---> MyProgram : ( C++ functions <---communicate/JNI---> Java classes <---communicate/JNI---> C++ DLL )
    I must give this program to a partner,who will communicate with it through a c++ main function. So can I convert my c++ functions and my java classes to DLLs and make the all program runs. Or may I package all the program, but I don't know how to do it, and I don't find any docs. Does anyone have an idea, thanks in advance.
    Any help would be appreciated,
    Best regards

    Hi Schell,
    The sockets would be pretty difficult to handle I guess. Not hard at all.
    The size of data types vary in C++ and
    Java not to speak of endians. Which is only a problem if you try to shove data down a socket rather than messages.
    A socket based
    implementation would also have to handle the
    marshalling and unmarshalling which would be a huge
    premium. Not at all.
    Looks like this application might use some
    CORBA implementation where the middleware handles the
    messaging part between C++ and Java. JNI would let
    the Java application call C++ code through DLLs which
    is not what the owner of the post likes to do.
    Choices are open take your best shot.
    And what do you think happens when java calls a native method?

  • Anyone who use form to transfer chinese char to java class?

    It is Urgent!
    I use form6i to construct my application,but when I use
    import java class to call a java program,I find then I input
    some chinese character, whether the java program return it
    directly or decode it as GBK, ISO8859_1,ASCII. the form
    can not get the original charater,but when we not use java
    and just return the character in the form. the charater can
    work.....
    so I want to ask,if we must use java program to handle
    the chinese character,what can I do...
    My email is [email protected]
    Thanks!!

    There is a bug on this already - Forms should handle the characterset translation from Java to whatever charset is being used by Forms, but it does not. You can work around it by running Forms with UTF8 as a characterset (using the NLS_LANG parameter to set it)

  • Using an * for all file extensions in a class selection parser

    Using iFS 1.1.9....
    I have successfully gotten a custom document class created using
    xml. I have used the following code to set up the parser, etc.
    If I use a specific file extension like txt the parser will
    upload the file as my custom class. However, if I use * for all
    file extensions the parser uploads all files as Document class.
    Here is what I am using:
    <?xml version='1.0' standalone = 'yes'?>
    <!--RegisterQualParser-->
    <PropertyBundle>
    <Update
    Reftype='ValueDefault'>ParserLookupbyfileExtension</Update>
    <Properties>
    <Property Action = 'add'>
    <Name>*</Name>
    <Value Datatyupe = 'String'>
    oracle.ifs.beans.parsers.ClassSelectionParser
    </Value>
    </Property>
    </Properties>
    </Propertybundle>
    When the above is uploaded I can go into iFS Manager and see
    that the parser has been registered with * as the file extention.
    I then upload this:
    <?xml version='1.0' standalone = 'yes'?>
    <!--RegisterCustomClass-->
    <PropertyBundle>
    <Update
    Reftype='ValueDefault'>IFS.PARSER.ObjectTypeLookpByFileExtension
    </Update>
    <Properties>
    <Property Action = 'add'>
    <Name>*</Name>
    <Value Datatype='String'>QualDocument</Value>
    </Property>
    </Properties>
    </PropertyBundle>
    If I have txt or some other extension for the Name in place of
    the * and upload a document it will put the class as
    QualDocument. If I have the * it defaults to Document.
    Is there a way to have the parser make all uploaded documents
    QualDocument instead of Document without doing this for each and
    every possible file extension?
    Thanks.

    Using iFS 1.1.9....
    I have successfully gotten a custom document class created using
    xml. I have used the following code to set up the parser, etc.
    If I use a specific file extension like txt the parser will
    upload the file as my custom class. However, if I use * for all
    file extensions the parser uploads all files as Document class.
    Here is what I am using:
    <?xml version='1.0' standalone = 'yes'?>
    <!--RegisterQualParser-->
    <PropertyBundle>
    <Update
    Reftype='ValueDefault'>ParserLookupbyfileExtension</Update>
    <Properties>
    <Property Action = 'add'>
    <Name>*</Name>
    <Value Datatyupe = 'String'>
    oracle.ifs.beans.parsers.ClassSelectionParser
    </Value>
    </Property>
    </Properties>
    </Propertybundle>
    When the above is uploaded I can go into iFS Manager and see
    that the parser has been registered with * as the file extention.
    I then upload this:
    <?xml version='1.0' standalone = 'yes'?>
    <!--RegisterCustomClass-->
    <PropertyBundle>
    <Update
    Reftype='ValueDefault'>IFS.PARSER.ObjectTypeLookpByFileExtension
    </Update>
    <Properties>
    <Property Action = 'add'>
    <Name>*</Name>
    <Value Datatype='String'>QualDocument</Value>
    </Property>
    </Properties>
    </PropertyBundle>
    If I have txt or some other extension for the Name in place of
    the * and upload a document it will put the class as
    QualDocument. If I have the * it defaults to Document.
    Is there a way to have the parser make all uploaded documents
    QualDocument instead of Document without doing this for each and
    every possible file extension?
    Thanks.

  • User Defined External Function - How to work?

    I have defined some external functions in java by following the description in
    C:\OraBPELPM_3\integration\orabpel\samples\demos\XSLMapper\ExtensionFunctions
    I can use my functions in JDeveloper, but they do not work on the Oracle BPEL engine.
    Is it enough just to place the jar-file in <OC4J_HOME>\j2ee\home\applib and add the jar-file in class-path (as described)?
    What about the xml-file specifying the functions (called SampleExtentionFunctions.xml in the documentation)?
    Should this file be copied to <OC4J_HOME>\... ?
    Here is the error message I get by running my service:
    XPath expression failed to execute.
    Error while processing xpath expression, the expression is "ora:processXSLT("TransformationInput.xsl", bpws:getVariableData("inputVariable", "request"))", the reason is java.lang.NoSuchMethodException: For extension function, could not find method org.apache.xpath.objects.XNodeSet.leadingZeros([ExpressionContext,] #NUMBER)..
    Please verify the xpath query.
    ______________ MY JAVA CODE EXAMPLE: _____________________________
    package extentionfunctions;
    This is a sample XSL Mapper User Defined Extension Functions implementation class.
    public class JavaExtensionFunctionsBpel
    * Inserts leading zeros to a text, if this starts with a digit.
    * Else the return value will be the same as the given text.
    * The return value will have the specified length.
    public static String leadingZeros(String text, int len)
    {  String retur = text;
    char c = (text == ""?'0':text.charAt(0));
    if ('0'<=c && c<='0'+9) { // Is first char a digit?
    retur = "";
    int n = len - (text == ""?0:text.length());
    for (int i=0; i<n; i++) { // Insert zeros:
    retur = '0' + retur;
    retur = retur + text;
    return retur;
    * Removes leading zeros from a text.
    public static String removeLeadingZeros(String text)
    {  String retur = text;
    int pos = 0;
    int len = (text == ""?0:text.length());
    for (int i=0; i<len; i++) {
    if (text.charAt(i)=='0') { // Is char a digit?
    pos++;
    return retur;
    public static void main(String[] args)
    { // Basic test of functions:
    int len = 5;
    String s = "1234";
    String r;
    System.out.println("leadingZeros("+s+","+len+")="+(r=leadingZeros(s,len)));
    System.out.println("removeLeadingZeros("+r+")="+removeLeadingZeros(s));
    Regards
    Flemming Als

    Flemming, it looks like somthing is wrong in the xsl that it still goes to org.apache.xpath.objects.XNodeSet package instead of yours ..
    I created a sample that illustrates the usage of this functions (even with 2 params, different types).
    Java class (com.otn.samples.xslt.CustomXSLTFunctions)
    package com.otn.samples.xslt;
    public class CustomXSLTFunctions
    <function name="extension:multiplyStringAndInt" as="number">
    <param name="base" as="String"/>
    <param name="multiplier" as="number"/>
    </function>
    public int multiplyStringAndInt (String pString, int pMultiplier)
    int base = Integer.parseInt(pString);
    return base * pMultiplier;
    XML descriptor:
    Note the types (in the java class and the xml descriptor)
    for java:base -> string and for xslt:base -> string
    for java:multiplier -> int and for xslt:multiplier -> number
    <?xml version="1.0" encoding="UTF-8"?>
    <extension-functions>
    <functions extension:multiplyStringAndInt="http://www.oracle.com/XSL/Transform/java/com.otn.samples.xslt.CustomXSLTFunctions">
    <function name="extension:multiplyStringAndInt" as="number">
    <param name="base" as="string"/>
    <param name="multiplier" as="number"/>
    </function>
    </functions>
    </extension-functions>
    Definition of variables in the process:
    (as you can see, the base is a string - I do the conversion in my method, and the return value
    is converted to a string by the engine)
    <!-- Input -->
    <element name="CustomXSLTFunctionProcessRequest">
    <complexType>
    <sequence>
    <element name="base" type="string"/>
    <element name="multiplier" type="int"/>
    </sequence>
    </complexType>
    </element>
    <!-- Output -->
    <element name="CustomXSLTFunctionProcessResponse">
    <complexType>
    <sequence>
    <element name="result" type="string"/>
    </sequence>
    </complexType>
    </element>
    Using the new function in the XSL transformation:
    - watch out for the namespace declaration (xmlns:sample="...")
    - and the usage (sample:multiplyStringAndInt)
    <xsl:stylesheet version="1.0"
    xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
    xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
    xmlns:extension="http://www.oracle.com/XSL/Transform/java/com.otn.samples.xslt.CustomXSLTFunctions"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:ns0="http://www.w3.org/2001/XMLSchema"
    xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
    xmlns:client="http://xmlns.oracle.com/CustomXSLTFunction"
    exclude-result-prefixes="xsl plnk ns0 client ldap xp20 bpws extension ora orcl">
    <xsl:template match="/">
    <client:CustomXSLTFunctionProcessResponse>
    <client:result>
    <xsl:value-of select="extension:multiplyStringAndInt(/client:CustomXSLTFunctionProcessRequest/client:base,/client:CustomXSLTFunctionProcessRequest/client:multiplier)"/>
    </client:result>
    </client:CustomXSLTFunctionProcessResponse>
    </xsl:template>
    </xsl:stylesheet>
    Then I created a jar file with the class (and for testing the xml descriptor in it)...
    and put it into j2ee/home/applib directory
    hth clemens

  • ESB XSLT Extension Functions

    Hi
    Could anybody tell me if we can use log4j in the java class which we write for XSLT Extension Functions which will be used in ESB XSL mappings?
    It is not recognizing log4j only.It is not giving any error also.
    Thanks
    Praveena

    Thanks Kanchan.
    This is talking about how to implement Extension functions.
    I have done this. but my question I am not able to use log4j for debugging purpose in this java class. It is not recognising this.
    We need to use logger instead of System.out.println .
    Thanks
    Praveena

  • Implemented OWSM -- XML-22045: (Error) Extension function error

    good day
    When I activated my OWSMAgent within ESB, I launched a null pointer Exception when running a fault, since I have reviewed the documentation WSM_DeploymentGuide and commented that it is not possible to add an error handler general, reviewing the logs I found the following error:
    XML-22045: (Error) Extension function error: Class not found '
    Missing class: com.cablemas.extensionfunctioncablemas.ExtensionFunctionCablemas
    Dependent class: oracle.xml.xpath.XSLExtFunctions
    Loader: oracle.xml: 10.1.0_2
    Code-Source: / F: / product/10.1.3.1/OracleAS_1/lib/xmlparserv2.jar
    Configuration: <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in F: \ product \ 10.1.3.1 \ OracleAS_1 \ j2ee \ home \ oc4j.jar
    This load was initiated at oc4j: 10.1.3 using the loadClass () method.
    The missing class is available from the following locations:
    1. Code-Source: / F: / product/10.1.3.1/OracleAS_1/j2ee/oc4j_soa/applib/ExtensionFunctionCablemas.jar (from <code-source> in / F: / product/10.1.3.1/OracleAS_1/j2ee/oc4j_soa/config / server.xml)
    This source code is available in loader global.libraries: 1.0. This shared-library can be made visible to the "oc4j" by modifying the boot loader descriptor.
    Class ExtensionFunctionCablemas use it to take the code of the error, locate it within a table in the DB and return the corresponding message, the null pointer exception only if it throws error. OWSM reviewing the request is recorded correctly, and the answer recorded as a fault but I'm not returning the message corresponding to error code.

    Greetings,
    Quoted:
    When using Oracle XSLT extensions, make sure you set the namespace of the extension class to be:
    http://www.oracle.com/XSL/Transform/java/This was excerpted from the pdf at:
    http://www.oracle.com/technology/tech/xml/xdk/collateral/OracleAS10g_10.1.2_XDK_FAQ.pdfThe namespace tells the application how to interpret your XSLT attributes\elements.
    -Michael

Maybe you are looking for

  • Sound dosen't work when hdmi cable is in?

    when i have Hdmi type cable in for monitor sound does not come out of laptop 

  • Display HTML code in Crystal Reports

    We have a field in the database in which the data is encoded HTML, it includes links to images.  I have tried to use the RTF/HTML interpretation option for the field but it doesn't work.  I saw on the other thread that there's limitation to displayin

  • How to buy a 16 gb white iPhone 3gs from U.S to Brazil?

    Hi! i`m from brazil and i want an iphone so much, but here is so expensive!it's almost $950, there is any way I can buy from U.S with the same price of the apple store? Does anyone understand me? It`s very difficult to do this?? Please! I need help o

  • In house production time

    hi folks ,i have a requirement like when a for a sales order qty say 1000 for finished goods product, the required delivery date is say 31.12.2007 , the sales order receiving date is say todays date . time required to produce 100 base qty of the fini

  • Mac OS X won't install on external FW drive.

    I recently purchased a new Intel iMac and I wanted to use the backup FireWire drive I had been using with my previous computer as an emergency startup disk incase something were to go wrong with the main HD. When I had used the FW drive in this capac