XSL parsing in EJB environment

Hi,
I have a requirement to parse XSL, XML in Session EJB.
I have read through a lot of article where parsing is normally done in Servlet.
Can the requirement be achievable. Can anyone kindly help (it's urgent).
Thank you

Thank you so much to AMPHIGIS_X and gimbal2 for your reply.
My early concern is that I am not sure of how intensive the XSL parser will java.io package during transformation. This is because usage of java..io package in EJB environment must be handle with care.
I am more concerned when I read through a lot tutorial where the parsing is done by servlet level.

Similar Messages

  • How to define your own context in an EJB environment - possibly distributed

    I would like to setup a context (an object accissible per logical thread) in an EJB environment, but I am too unfamiliar with the options I may have.
    My objective is to create a context in which I may set a value, then invoke a method on an object (which in turn invokes a method on another object and so forth) and eventually get back the value from the context. In other words I am trying to pass a value without passing it as a parameter. More specifically, I have written a JDBC Driver wrapper in which I want to intercept a number of method calls and based on the context settings perform one or the other JDBC preprocessing. The reason for not passing the values as parameters is to interfere as little as possible with any environment in which this code is to be integrated. I simply want to set the context and get the context (in my JDBC wrapper) without the surrounding code needing to change.
    I have succeded partially by using a ThreadLocal object to hold my context. I can set and get the values to and from the context and actually pass values to my Driver wrapper without explicitly passing them as parameters. This works well in a non-EJB environment. My concern arises when I switch to the EJB environment.
    If my context is set in a session bean, which invokes an entity bean, am I then guaranteed that these will execute in the same physical thread?
    If the session and the entity beans are hosted on seperate machines then the answer would certainly be NO. Is there any way to have the container manage the context and propagate it accross containers when needed?
    Any thoughts or suggestions on this topic are wellcome, even if they don't solve the issue entirely.
    Looking forward to hear from you all!
    /poul

    In an EJB environment, you have absolutely no control over threading issues. (It was purposefully designed that way.) However, you do have your own little "sandbox" in the EJB ClassLoader - which is why there is a lot of use of the Singleton pattern for factories and (very carefully!) as small caching mechanisms. You might want to look into that avenue - but you have to know how your EJB vendor's ClassLoader scheme works (there does appear to be a convergence in this area) and you must be very sensitive to potential thread-blocking operations that may take a while to complete.

  • Oracle xsl parser equivalent to msxsl:node-set()?

    Hello
    I am looking for an equivalent to the msxsl:node-set() that I can use with the Oracle xsl parser.
    Any sugestions?
    Ade

    We have ora:node-set()
    Use http://www.oracle.com/XSL/Transform/java
    as the namespace URI for the "ora" prefix.

  • How to get EJBs environment?

    EJBContext.getEnvironment() is deprecated.
    "Deprecated. Use the JNDI naming context java:comp/env to access enterprise bean's environment."
    I'm confused on how to use "java:comp/env" to the the EJBs environment. Can anyone shed some light on this for me?
    Thanks.
    Eric

    Thanks.
    After reading that, I think I've asked the wrong question. I want to be able to set/change an MDB's provider-url. I assume I could do this in the setMessageDrivenContext method. The problem is that our dev/test/prod environments will each have a different provider-url. Building a different weblogic-ejb-jar.xml file for each environment will pretty much ensure that someone will eventually deploy the wrong one and prod will be listening to a dev topic. Anyone have an elegant solution for this?
    Thanks.

  • Utilizing EJB Environment Entries in different runtime env

    Hello
    We are in the process of moving to the NWDI environment.
    Most of our EJBs are using the EJB Environment Entries (defined in the deployment descriptors)
    Some of those EJBs rely on the fact that the same property will have different values in different runtime environments.
    I have noticed that during the import process (from one env to another) done by the CMS there is no option to change those environment varialbles.
    I have also noticed that there is no option to change the values of those environment entries during runtime in the SAPJ2EE 6.40 (that option existed in SAPJ2EE 6.20)
    I just need to get an official answer;
    Is there no way to control the values of the environment entries during deployment with NWDI?
    Do we have to change our code (that relied on J2EE standards) so it does not expect different values in different runtime environments?
    I have an open CSN about this, but no answer there yet...
    <a href="https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smp_custmsg/main.do?event=LOAD&smpsrv=h">CSN 0120025231 0001708443 2005</a>

    hi
    I have the same problem describewd in this <a href="https://www.sdn.sap.com/irj/sdn/thread?threadID=45460">SDN thread</a>
    to save you the time, it says that You must add the declaration within the sda-dd.xml
    <substitution-variable>
    <variable-name>com.vendor.yourVarName</variable-name>
    </substitution-variable>
    Note that if you write a Server library this file is displayed by the NWDS
    However, if you are using a J2EE application module, this file is generated during the build and stored into the ear.
    if you try using a substitution variable in your deployment descriptor without specifying it in the sda-dd.xml you get a deployment error -
    com.sap.engine.deploy.manager.MissingSubstitutionException: Missing substitution value for variable
    (see full log message below)
    As a workaround, I edited the sda-dd.xml after the EAR was generated (added the required entry), repacked it and deployed it.
    Then it worked.
    The problem is, if I use NWDI, I CANNOT edit the EAR that gets generated!
    any idea of how to solve this?
    <u>full log message of deployment error</u>
    02/01/2006 13:58:13 /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [001]Deployment aborted
    Settings
    SDM host : zaksrv2
    SDM port : 50018
    URL to deploy : file:/C:/DOCUME1/zak/LOCALS1/Temp/temp19284checkpoint.comtimeofftest5substear.ear
    Result
    => deployment aborted : file:/C:/DOCUME1/zak/LOCALS1/Temp/temp19284checkpoint.comtimeofftest5substear.ear
    Aborted: development component 'timeoff/test5/subst/ear'/'checkpoint.com'/'DEV_TIMEOFF6_D'/'20060102135547':
    Caught exception during application deployment from SAP J2EE Engine's deploy API:
    com.sap.engine.deploy.manager.MissingSubstitutionException: Missing substitution value for variable [com.cp.sapGRP].
    (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).DMEXC)
    Deployment exception : The deployment of at least one item aborted

  • XML parsing in EJB

    I am using WLS 7.0. XML Message is passed to Session EJB. EJB needs to process
    the XML. How can we pass the XML to a parser class or so and check Well-Formedness
    and Validate against a XML schema respective to the XML. Any examples, sample
    code would be a great help.
    Method which has xml messages
    public String processXML( String[] xmlStrs ) {
    //String[] xmlStrs = (String[]) xmlList.toArray();
    for ( int i=0; i < xmlStrs.length; i++ ) {
    System.out.println( xmlStrs.toString() );
    return new Integer(xmlStrs.length).toString();
    Thanks in Advance
    Ganesh C.

    Your well-formed validation can go thru a DTD file. Inside the XML file file
    header, include the proper DTD definition.
    "Ganesh C" <[email protected]> wrote in message
    news:[email protected]..
    >
    I am using WLS 7.0. XML Message is passed to Session EJB. EJB needs toprocess
    the XML. How can we pass the XML to a parser class or so and checkWell-Formedness
    and Validate against a XML schema respective to the XML. Any examples,sample
    code would be a great help.
    Method which has xml messages
    public String processXML( String[] xmlStrs ) {
    //String[] xmlStrs = (String[]) xmlList.toArray();
    for ( int i=0; i < xmlStrs.length; i++ ) {
    System.out.println( xmlStrs.toString() );
    return new Integer(xmlStrs.length).toString();
    Thanks in Advance
    Ganesh C.

  • XML/XSL parser/processor problem

    Can anyone telle why mij code doesn't work
    DECLARE
    XMLdoc CLOB;
    XSLdoc sys.xslprocessor.stylesheet;
    HTMLdoc CLOB;
    HTMLparser sys.xmlparser.parser;
    XSLprocessor sys.xslprocessor.processor;
    DOMdoc sys.xmldom.DOMdocument;
    queryCtx DBMS_XMLquery.ctxType;
    BEGIN
    queryCtx := DBMS_XMLQuery.newContext('select * from scott.emp');
    XMLdoc := DBMS_XMLQuery.getXML(queryCtx);
    DBMS_XMLQuery.closeContext(queryCtx);
    HTMLparser := sys.xmlparser.newparser;
    XSLprocessor := sys.xslprocessor.newprocessor;
    sys.xmlparser.parseclob(HTMLparser,XMLdoc);
    DOMdoc := sys.xmlparser.getdocument(HTMLparser);
    XSLdoc := sys.xslprocessor.newstylesheet(DOMdoc,'http://www.w3.org/TR/WD-xsl');
    sys.xslprocessor.processxsl(XSLprocessor,XSLdoc,DOMdoc,HTMLdoc);
    sys.xslprocessor.freestylesheet(XSLdoc);
    sys.xslprocessor.freeprocessor(XSLprocessor);
    sys.xmlparser.freeparser(HTMLparser);
    END;
    there should be html-output but it gives a error:
    ora-20100 attribute "xsl:version" not found in ROWSET......
    Can anyone help me get this code to wrk
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    It appears that you're trying to use the result of the GETXML() -- which is some XML like <ROWSET>/<ROW> -- as the stylesheet itself.<HR></BLOCKQUOTE>
    but the function XSLdoc := sys.xslprocessor.newstylesheet(DOMdoc,'http://www.w3.org/TR/WD-xsl');
    makes a xsl from a xmldom object or am I wrong in this assumption.
    How would I do it then
    null

  • EJB Environment

    Not sure if this belongs in this forum, but it seems like a reasonable choice.
    My question is involving the environment for WLS 6.1; specifically involving EJBs.
    I'm sure this has been discussed before. I did a quick search and had no luck,
    however.
    During our build process, we compile our EJB classes directly into the class path
    ("./serverclasses" directory under WLHOME) where the rest of the classes are compiled.
    If I'm not mistaken, any client of an EJB is going to require those classes (at
    least the remote interface?) in the classpath in order to compile itself.
    The problem we have is that when WLS starts, the warnings come up that the bean classes
    should not be in the classpath. I could remove them, but that's a little painful.
    If I do go to the pain of removing them, do I not have to place the EJB's .jar
    file in the classpath prior to starting the server? That seems a little tedious
    to have to modify the server's classpath each time I deploy a new EJB. If I don't
    have the .jar in the classpath, will clients to the EJB that run in the server work?
    Any thoughts you may have as to build process (seperate class path for build versus
    server run, etc) would be most appreciated.
    Thanks!
    Brian

    Hi,
    I would advise not to use the standard EJB compile/generate scripts(ANT/batch files)
    that come with Weblogic. Are you deploying your application as an EAR file. Classloader
    would be different in that case. If not, you could try like this
    1) If you have RMI remote clients for your EJBS you need Home and Remote interfaces
    for EJB call. Otherwise if servelts/JSP on the same server use, you do not.
    2) I am not 100% sure, but server startup classpath sould have only those classes
    that your Remote or Home interface extends. Otherwise every thing at say WEB-INF/classes
    would be visible and work. This is based on my experience. So if your EJB say remote
    interface does not extents anything, you need nothing extra at you Weblogic startup
    classpath.
    3) The templates have concept of serverclasses and clientclasses which is only relevant
    for Weblogic examples (I guess inherited from Weblogic5.1x which was not J2EE complient.
    Hope this helps
    Regards
    HS
    "Brian Snyder" <[email protected]> wrote:
    >
    Not sure if this belongs in this forum, but it seems like a reasonable choice.
    My question is involving the environment for WLS 6.1; specifically involving
    EJBs.
    I'm sure this has been discussed before. I did a quick search and had
    no luck,
    however.
    During our build process, we compile our EJB classes directly into the class
    path
    ("./serverclasses" directory under WLHOME) where the rest of the classes
    are compiled.
    If I'm not mistaken, any client of an EJB is going to require those classes
    (at
    least the remote interface?) in the classpath in order to compile itself.
    The problem we have is that when WLS starts, the warnings come up that the
    bean classes
    should not be in the classpath. I could remove them, but that's a little
    painful.
    If I do go to the pain of removing them, do I not have to place the EJB's
    .jar
    file in the classpath prior to starting the server? That seems a little
    tedious
    to have to modify the server's classpath each time I deploy a new EJB.
    If I don't
    have the .jar in the classpath, will clients to the EJB that run in the
    server work?
    Any thoughts you may have as to build process (seperate class path for build
    versus
    server run, etc) would be most appreciated.
    Thanks!
    Brian

  • Is function current() supported by the XSL parser?

    Section 12.4 of the XSL spec describes the current() function (http://www.w3.org/TR/xslt#function-current). Is this supported by the oracle parser? It didn't seem to work for me.
    TIA,
    Ion Moraru
    [email protected]

    There was a bug with current() in 2.0.2.5 that was fixed in 2.0.2.6 (the current release) are you using the latest?
    If so, can you post a simple testcase that demonstrates the problem?
    Thanks

  • Error parsing weblogic-ejb-jar. HELP please :(

    When I have added the transaction-descriptor into weblogic-ejb-jar.xml I start getting next error:
    [java] ERROR: Error parsing 'META-INF/weblogic-ejb-jar.xml' line 18: The content of element type "weblogic-enterprise-bean" must match "(ejb-name,caching-descriptor?,persistence-descriptor?,clustering-descriptor?,transaction-descriptor?,reference-descriptor?,enable-call-by-reference?,jndi-name?,transaction-isolation*)".
    The weblogic-ejb.jar.xml is the next:
    <?xml version="1.0"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
         <weblogic-enterprise-bean>
         <ejb-name>statelessSession</ejb-name>
         <caching-descriptor>
              <max-beans-in-free-pool>100</max-beans-in-free-pool>
              <idle-timeout-seconds>1200</idle-timeout-seconds>
         </caching-descriptor>
         <transaction-descriptor>
         <trans-timeout-seconds>50</trans-timeout-seconds>
         </transaction-descriptor>
         <jndi-name>statelessSession.EcasServicesHome</jndi-name>
         </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    Please tell me what did I do wrong and how to fix the problem.
    Thnx.
    VG.

    I suspect you are using a version of WebLogic higher than 5.1. Coz, your XML is invalid if I use the following DOCTYPE.
    <!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">
    You can try this
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>statelessSession</ejb-name>
    <stateless-session-descriptor>
    <pool>
    <max-beans-in-free-pool>100</max-beans-in-free-pool>
    <initial-beans-in-free-pool>20</initial-beans-in-free-pool>
    </pool>
    </stateless-session-descriptor>
    <transaction-descriptor>
    <trans-timeout-seconds>50</trans-timeout-seconds>
    </transaction-descriptor>
    <jndi-name>statelessSession.EcasServicesHome</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    cheers !
    Dips

  • XSL variable and unix environment variable

    Any idea how I can pass the unix environment variable to the custom XSL file? I want to be able to pass the $PO_TOP path so the file location can be derived
    The below code works fine for static file location but I want it to be more generic.
    <fo:block xsl:use-attribute-sets="termcond">
    <xsl:if test="($print_draft = '')">
         <xsl:value-of select="unparsed-text('/usr/tmp/tc.txt','UTF-8')"/>
    </xsl:if>
    </fo:block>
    <fo:block id="last-page"/>
    Thanks in advance

    you'll need to use the name(.) XPath function to test the name of the current node.

  • EJB environment question (static helper classes)

    We're using JBoss as AS containing several stateless session beans.
    Now, we have certain helper classes that are abstract and contain static methods. Is this a problem for the EJBs? All of them use these helper classes all over their methods. Are they sharing the static class and will slow down somehow? Or is each EJB using its version of the class and can run concurrently?
    Should we rethink this and put an INSTANCE of each helper class in each ejb instead of using static methods in the helper class?
    Now in EJB method:
    Helper.calculateStuff();
    Should it be?
    Helper h = new Helper(); // defined when ejb is created
    helper.calculateStuff();
    Edited by: JAeon on Sep 8, 2008 12:21 AM
    Edited by: JAeon on Sep 8, 2008 12:22 AM

    >
    The helper methods do database querries etc and return results that the EJB sends onwards to clients. If these methods
    are NOT synchronized (and the ejbs share the static class) won't it cause concurrency errors? I think most of our methods are not
    synchronized (and it doesn't seem to cause any concurrency errors so far... though the system have not beeen stressed test that much,
    and concurrency bugs tends to pop up later and randomly :P).
    >
    No, if you dont have any static data variables in the Java classes, static method as such will not cause concurrency errors, and the methods should not be synchronized.
    If you have any synchronized methods and they take a while to execute, that could become a bottleneck in itself, because different threads waiting for each other,
    so make sure you dont have any synchronized methods where it is not explicitly needed.
    Think of a static method (without static data in the class being manipulated) as a plain function in another programming-language.
    >
    We have some scaleability problems with the EJBs... It seems as if they do not run concurrently. If we do a stress test with several threads calling the EJBs their response time increases by a too large factor to feel comfortable...
    >
    Apparently, you do have a some scaling/concurrency problem, which could have many causes -- transaction locking and clashes in the database, poorly configured database, network congestion, problems in the EJB architecture, etc -- can be many reasons...
    The general idea to debug, is first to find out exactly what calls in your code that take longest time to execute (profiling, logging, System.out.println's are useful) when you put parallel load on your system -- rather than just seeing "the whole application seems slow" -- from there you can move on, "divide&conquer" the problem, etc...

  • Parsing DOM with XSL and output as HTML

    In a servlet I am fetching data from DB into an DOM-tree (using ordinary JDBC and building the XML-DOM while fetching rows). This is done in a servlet, and before I response to the browser i use Oracle XML-parser to join my DOM-tree with an XSL-file. If I try to my DOM-tree out before parsing, it contains data. But the parsed DOM only contains XSL-tags, no data. What do I do wrong?
    Here is the code:
    DOMParser parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    //No problem finding the XSL-file...
    URL xslURL = createURL("employee.xsl");
    parser.parse(xslURL);
    xslDoc = parser.getDocument();
    XSLStylesheet xsl = new XSLStylesheet(xslDoc, xslURL);
    XSLProcessor processor = new XSLProcessor();
    processor.showWarnings(true);
    processor.setErrorStream(System.out);
    //XML doc does contain data!!!
    DocumentFragment result =
    processor.processXSL(xsl, xmlDoc);
    xmlOut = new XMLDocument();
    Element root = xmlOut.createElement("root");
    xmlOut.appendChild(root);
    root.appendChild(result);
    xmlOut.print(out); // Result is only the XSL-file.....
    Regards Frank =:>

    Sorry, but I still can not make it work. Here are the XSL and XML-files. My XML test file (which reflects the DOM I am makings
    is:
    <?xml version="1.0" standalone="no"?>
    <!DOCTYPE employees SYSTEM "employee.dtd">
    <?xml:stylesheet type="text/xsl" href="employee.xsl" ?>
    <employees>
    <employee>
    <id>1</id>
    <firstname>Frank</firstname>
    <lastname>Nilsen</lastname>
    </employee>
    <employee>
    <id>2</id>
    <firstname>Ronald</firstname>
    <lastname>Reagen</lastname>
    </employee>
    </employees>
    XSL-file is:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
    <xsl:template match="/">
    <HTML>
    <BODY>
    <xsl:for-each select="employees/employee">
    <font color="red"><xsl:value-of select="id"/></font>
    <xsl:value-of select="firstname"/>
    <xsl:value-of select="lastname"/>
    </xsl:for-each>
    </BODY>
    </HTML>
    </xsl:template>
    </xsl:stylesheet>
    Regards,
    Frank =:>

  • Parsing ejb-jar.xml using jaxb

    hi all,
    how to parse the ejb-jar.xml using jaxb? can anybody send the information about the API which we have to use to parse the ejb-jar.xml? (ejb2.0)
    i need the details about all ejbs in an application, (like jndi name, Home and Remote name). so, how can i parse the ejb descriptors?
    regards,
    panneer

    Hi Panneer,
    Well, parsing the EJB descriptors is, in principle, a task for the EJB container where they are deployed. From what you wrote I assume that you need to gather that kind of info to visualize in some (monitoring?) tool. Is that correct?
    If so, the question would be whether you have access to the EJB jar on the file system (before it's deployed) or you can only connect to the server with the already deployed EJBs. In the latter case, this information is shown in the [NWA plugins|http://help.sap.com/saphelp_nwce10/helpdata/en/0b/5b5a42ea221153e10000000a155106/frameset.htm]. There are also some [telnet commands|http://help.sap.com/saphelp_nw04/helpdata/en/79/3cf82ade038d45a21fbfdaee349b22/frameset.htm] in NW 04 and 7.0 (04s).
    If you have access to the EJB jar file, you can parse the descriptors using DOM or SAX, but I'm not aware of any pre-defined JAXB API for this purpose. Probably you can also generate the mapped classes yourself and use them, however I'm not sure how that works with DTD (because of EJB 2.0).
    HTH!
    \-- Vladimir

  • Xsl output placing %20 (spaces) in output

    Xsl output placing %20 (spaces) in output when XSL file is
    save by Dreamweaver CS3, I notice a problem in Dreamweaver CS3
    today, when editing XSL files. Here is the xsl code
    Note: I have no problems when using DW 8 for writing my xsl
    style sheets. I suspect a setting in DW CS3 would fix this. My
    current development environment is all hand coded, not using DW
    server behaviors for any thing. Using MSXML2.DomDocument.4.0 for a
    XML Parser.
    Top part of file
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="
    http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:output omit-xml-declaration="yes"/>
    Works good this way (all the code on one line)
    <xsl:value-of disable-output-escaping="yes"
    select="url"/>?n=<xsl:value-of disable-output-escaping="yes"
    select="navigationid"/>&amp;p=<xsl:value-of
    disable-output-escaping="yes" select="parentid"/>
    I decided to make the code readable by placing the xsl calls
    on separate lines using line return on the keyboard.
    <xsl:value-of disable-output-escaping="yes"
    select="url"/>?n=
    <xsl:value-of disable-output-escaping="yes"
    select="navigationid"/>&amp;p=
    <xsl:value-of disable-output-escaping="yes"
    select="parentid"/>
    The code above resulted in my query string having
    %20%20%20%20%20 between the n= and value or p and value. It looks
    like the DW CS3 is placing some character in the file that XSL
    parser is interpreting as spaces (%20)
    Note: Dreamweaver 8 does not have this problem. is there a
    setting in CS3 to fix this, maybe a bug in DW CS3?
    David Pearson

    Hi,
    The xsl:output is not yet implemented. This was specified in the README file.
    Thanks,
    Oracle XML Team
    null

Maybe you are looking for