Servlets, XML and websphere?

I am working on a project that is using websphere 3.5 as the application server, from a login page I call a servlet (SiteController) what I want to do is read in system specific values (such as jsp file address, database connectivity info, etc) from an XML file. Can anyone tell me what I should be doing to achieve this, please!!!!!

I think you'll find that a standard XML reading package is included in the websphere libraries. Look for jaxp. (For documentation search www.java.sun.com).
The approach I'd take would be to create a class to hold the information with a static single-instance pointer and a "getInstance"
static method which would load the data the first time it was called, keeping the existing info so long as the class was loaded.
There are two approaches to reading XML, you can either get the package to load the entire file as a heirachical tree of nodes, or you can read the file on an event basis dealing with each node as it's read.

Similar Messages

  • Toplink xml binding session.xml and servlet

    I made a project with toplink-jaxb mapping
    with simple pojo object it works fine.
    I made another project with servlet
    and the same session.xml and java classes
    but when my process start it throw an exception :
    jaxbexception : Provider oracle.toplink.ox.jaxb.JAXBContextFactory could not be instantiated:
    It is like the process could not read the session.xml files, but this file and two xml file for the mapping are in the classpath (in WEB-INF/classes).
    Have i to put these files in another place ?
    Thanks.

    Hi,
    thank you for your response but
    here is the code :
    javax.xml.bind.JAXBContext jaxbContext = javax.xml.bind.JAXBContext.newInstance(
    "fr.cnav.cramse.pgpe.contactsnationaux"),this.getClass().getClassLoader());
    but i still got the same exception :
    05/03/01 08:24:33 exceptionProvider oracle.toplink.ox.jaxb.JAXBContextFactory could not be instantiated: java.lang.NoSuchMethodError: oracle.toplink.publicinterface.Session oracle.toplink.tools.sessionmanagement.SessionManager.getSession(oracle.toplink.tools.sessionconfiguration.XMLSessionConfigLoader, java.lang.String, java.lang.ClassLoader, boolean, boolean)
    I have also a stange message in the log window in jdev :
    Cutting log (size: 101767, max: 100000)Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Cutting log (size: 101866, max: 100000)Error cleaning up log: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISeekableStream.seek]
    Thank you for your help.

  • Package javax.servlet.* and javax.xml.rpc.*

    Which jar file(s) in Oracle WebLogic Server 10.3 contain these two packages: package javax.servlet.* and javax.xml.rpc.*? Where are they located? Thanks

    I don't have access to my WLS installation right now, but normally I use a class finder utility like this one to answer questions like this:
    http://www.inetfeedback.com/jarscan/

  • Agent filter location in web.xml for websphere v7.0

    In the document:
    Sun OpenSSO Enterprise Policy Agent 3.0 Guide for IBM WebSphere Application Server 6.1/7.0 and WebSphere Portal Server 6.1
    I'm and tying to do this part:
    Installing the Agent Filter for the WebSphere Application Server 6.1/7.0 Administration Console
    for my WebSphere 7.0 installation.
    My issue is the placement of the second filter.
    <filter-mapping>
    <filter-name>Agent</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    the doc says to put it under:
    <filter-mapping>
    <filter-name>WSCUrlFilter</filter-name>
    <servlet-name>action</servlet-name>
    </filter-mapping>
    <filter-mapping>
         <filter-name>WSCUrlFilter</filter-name>
    <url-pattern>/federatedlogoff</url-pattern>
    </filter-mapping>
    however, my Websphere 7.0 web.xml does not have this section in the file.
    Can some one assist me with proper placement?
    here is the first few lines of my xml:
    <?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="WebApp_1" version="2.4" xsi:schemaLocation="http://java.sun.co
    m/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>isclite</display-name>
    <filter>
    <filter-name>WSCUrlFilter</filter-name>
    <filter-class>com.ibm.ws.console.core.servlet.WSCUrlFilter</filter-class>
    </filter>
    <filter>
    <filter-name>Trace_Tree_Cache_Init_Filter</filter-name>
    <filter-class>com.ibm.ws.console.probdetermination.trace.tree.TraceTreeCacheInit</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>WSCUrlFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>Trace_Tree_Cache_Init_Filter</filter-name>
    <servlet-name>Trace Tree Servlet</servlet-name>
    </filter-mapping>
    <listener>
    <listener-class>com.ibm.isclite.SessionListener</listener-class>
    </listener>
    <listener>
    <listener-class>com.ibm.ws.console.appmanagement.SessionListener</listener-class>
    </listener>
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/config/struts-config.xml</param-value>
    </init-param>
    </servlet>
    <servlet>
    <servlet-name>SecureCleanup</servlet-name>
    <servlet-class>com.ibm.ws.console.core.servlet.SecureCleanupServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>FederationServlet</servlet-name>
    <servlet-class>com.ibm.ws.console.core.servlet.FederationServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>ProfileSelectionServlet</servlet-name>
    <servlet-class>com.ibm.ws.console.core.servlet.ProfileSelectionServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>ConsoleCSS</servlet-name>
    <jsp-file>secure/layouts/console_css.jsp</jsp-file>
    </servlet>
    <servlet>
    <servlet-name>EventInitializer</servlet-name>
    <servlet-class>com.ibm.ws.console.events.EventListenerServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>downloadFile</servlet-name>
    <servlet-class>com.ibm.ws.console.core.servlet.DownloadFileServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>StatusServlet</servlet-name>
    <servlet-class>com.ibm.ws.console.core.servlet.StatusServlet</servlet-class>
    </servlet>
    <servlet>

    See below. You just have additional probe filters.
    862059 wrote:
    In the document:
    Sun OpenSSO Enterprise Policy Agent 3.0 Guide for IBM WebSphere Application Server 6.1/7.0 and WebSphere Portal Server 6.1
    I'm and tying to do this part:
    Installing the Agent Filter for the WebSphere Application Server 6.1/7.0 Administration Console
    for my WebSphere 7.0 installation.
    My issue is the placement of the second filter.
    <filter-mapping>
    <filter-name>Agent</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    the doc says to put it under:
    <filter-mapping>
    <filter-name>WSCUrlFilter</filter-name>
    <servlet-name>action</servlet-name>
    </filter-mapping>
    <filter-mapping>
         <filter-name>WSCUrlFilter</filter-name>
    <url-pattern>/federatedlogoff</url-pattern>
    </filter-mapping>
    however, my Websphere 7.0 web.xml does not have this section in the file.
    Can some one assist me with proper placement?
    here is the first few lines of my xml:
    <?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="WebApp_1" version="2.4" xsi:schemaLocation="http://java.sun.co
    m/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>isclite</display-name>
    <filter>
    <filter-name>WSCUrlFilter</filter-name>
    <filter-class>com.ibm.ws.console.core.servlet.WSCUrlFilter</filter-class>
    </filter>
    <filter>
    <filter-name>Trace_Tree_Cache_Init_Filter</filter-name>
    <filter-class>com.ibm.ws.console.probdetermination.trace.tree.TraceTreeCacheInit</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>WSCUrlFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>Trace_Tree_Cache_Init_Filter</filter-name>
    <servlet-name>Trace Tree Servlet</servlet-name>
    </filter-mapping><filter-mapping>
    <filter-name>Agent</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <listener>
    <listener-class>com.ibm.isclite.SessionListener</listener-class>
    </listener>
    <listener>
    <listener-class>com.ibm.ws.console.appmanagement.SessionListener</listener-class>
    </listener>
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/config/struts-config.xml</param-value>
    </init-param>
    </servlet>
    <servlet>
    <servlet-name>SecureCleanup</servlet-name>
    <servlet-class>com.ibm.ws.console.core.servlet.SecureCleanupServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>FederationServlet</servlet-name>
    <servlet-class>com.ibm.ws.console.core.servlet.FederationServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>ProfileSelectionServlet</servlet-name>
    <servlet-class>com.ibm.ws.console.core.servlet.ProfileSelectionServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>ConsoleCSS</servlet-name>
    <jsp-file>secure/layouts/console_css.jsp</jsp-file>
    </servlet>
    <servlet>
    <servlet-name>EventInitializer</servlet-name>
    <servlet-class>com.ibm.ws.console.events.EventListenerServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>downloadFile</servlet-name>
    <servlet-class>com.ibm.ws.console.core.servlet.DownloadFileServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>StatusServlet</servlet-name>
    <servlet-class>com.ibm.ws.console.core.servlet.StatusServlet</servlet-class>
    </servlet>
    <servlet>

  • Crystal Report 9.0 and Websphere

    hi can any body give me some steps regarding
    integration of crystal report and websphere
    i have already search this forum and i got lot many topics
    regarding this but all were using cyrstal report version 8 and 8.5
    which requires mandatory using IIS server which i dont wont to use
    i want a pure websphere and 9.0 version communication
    i had read the docs whihc states that 9.0 supports but i dont know how?
    can any bosy help regarding this

    here's the report code
    <%@ page contentType="text/html; charset=utf-8" %>
    <%@ page session="true"%>
    <%@ page import="javax.servlet.jsp.*"%>
    <%@ page import="java.util.Locale"%>
    <%@ page import="java.net.*" %>
    <%@ page import="java.text.DateFormat" %>
    <%@ page import="javax.servlet.jsp.JspWriter"%>
    <%@ page import="javax.servlet.http.HttpServletRequest" %>
    <%@ page import="javax.servlet.http.HttpSession" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.application.*" %>
    <%@ page import="com.crystaldecisions.report.web.viewer.*" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.*" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.definition.*" %>
    <!--Code Starts here ........... -->
    <%
    System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$");
    String reportName=(String)request.getAttribute("ReportName");
    String requestNumber=(String)request.getAttribute("RequestNumber");
    String requestNumber="RPT_112";
    System.out.println("********************");
    ParameterField newParameter = new ParameterField();
    ParameterField newField = null;
    System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@");
    ParameterFieldDiscreteValue newValue = null;
    System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^");
    try{
    ReportClientDocument rptClientDoc = new ReportClientDocument();
    //System.out.println("11111111111111111111111111");
    /* Change DCWKS0241AB to the name of Machine where RAS is installed for ex like DCWKS0237 */
    rptClientDoc.setReportAppServer("DCWKS0241AB");
    System.out.println("22222222222222222222222222");
    /* Change this E:\\Crystal\\Reports\\ to the path where your reports are kept */
    String reportPath="E:\\RAS\\Reports\\Percentages.rpt";
    rptClientDoc.open (reportPath, 0);
    rptClientDoc.getDatabaseController().logon("bbva","bbva");
    System.out.println("After Creating the Client Document on the Report");
    /* folowing Code remove any default value to the report and append the request number in the input parameter*/
    newField = (ParameterField)rptClientDoc.getDataDefinition().getParameterFields().getField(0);
    newField.copyTo(newParameter,true);
    newParameter.getCurrentValues().removeAllElements();
    newValue=new ParameterFieldDiscreteValue();
    newValue.setValue(requestNumber);
    newParameter.getCurrentValues().add(newValue);
    /* Just for Testing Purpose
    Values v=newParameter.getCurrentValues();
    IValue iv=v.getValue(0);
    System.out.println("---> "+iv.computeText());
    rptClientDoc.getDataDefController().getParameterFieldController().modify(newField, newParameter);
    /* Specifying the Format */
    PDFExportFormatOptions PDFExpOpts = new PDFExportFormatOptions();
    //Create the ExportOptions object, set the PDF export options, and set the format type to PDF.
    ExportOptions exOpts = new ExportOptions();
    exOpts.setFormatOptions(PDFExpOpts);
    exOpts.setExportFormatType(ReportExportFormat.from_int(ReportExportFormat._PDF));
    System.out.println("After Setting the format");
    System.out.println("Before getting source");
    //Create the ReportExportControl object and set the report source to the report that will be exported to PDF.
    ReportExportControl expViewer = new ReportExportControl();
    System.out.println("Before getting source");
    expViewer.setReportSource (rptClientDoc.getReportSource());
    System.out.println("3");
    //Set the export options to the ReportExportControl object.
    expViewer.setExportOptions(exOpts);
    System.out.println("After Setting the Export Options to the ReportExportControl object.");
    //Set the exported report to display in the browser.
    //The setExportAsAttachment method is set to false by default. If it is set to true the user will be presented with the File Download dialog box to save the exported report to disk.
    expViewer.setExportAsAttachment(false);
    //Export and view the report.
    expViewer.processHttpRequest(request, response, (getServletConfig()).getServletContext(),null);
    System.out.println("After Exporting and viewing the report back in the Browser.");
    //Destroy the control.
    expViewer.dispose();
    catch (Exception e)
    out.write("Error: Open" + e.toString() + "\n");
    %>

  • Cannot view PDF created by passing xml and XSL-FO using UTL_HTTP

    Hi,
    Using UTL_HTTP Iam trying to contact a servlet which uses the input XML and XSL/FO to produce a PDF.However, when I run the procedure , I get the following error 'File does not begin with -%PDF' ? I checked the output on the console and the blob values does not start with %PDF . Below is the sample from my code , please let me know if Iam commiting a mistake somewhere. I confirmed that the servlet itself is working fine by confirming with test webpage that takes xml and stylesheet input and generates a PDF when 'submitted' to servlet on the click of a button.
    INSERT INTO TESTPDF ( PDF_REPORT ) VALUES ( Empty_Blob() ) RETURNING PDF_REPORT INTO vBlobRef;
    vReportURL :='/rufop/fop?xml='||xmldoc||'&xsltRPath=../../test/PAXSL.xsl';
    req := UTL_HTTP.BEGIN_REQUEST (url=>vReportURL, method=>'POST');
    resp := utl_http.get_response(req);
    loop
    begin
    Utl_Http.read_raw(resp, vData);
    Dbms_Lob.writeAppend ( lob_loc => vBlobRef , amount => Utl_Raw.length(vData) , buffer => vData );
    exception
    when utl_http.end_of_body then
    exit;
    end;
    end loop;
    Utl_Http.end_response(resp);
    owa_util.mime_header('application/pdf',false);
    htp.p('Content-Disposition: inline; filename="test.pdf"');
    htp.p('Content-Length: '|| dbms_lob.getlength(vBlobRef));
    owa_util.http_header_close;
    wpg_docload.download_file(vBlobRef);
    Thanks in advance,
    Jen

    Hello guys! I have been assigned the same task,i.e to generate pdf through xml using xsl stylesheet.
    I have a procedure which is creating the xml and the stylesheet. But I have no idea how to write the procedure which passes this xml to fo engine. I am very new to this. Can anyone please share your thoughts with me so as how to accomplish this? By reading blogs on internet I figured I would have to use UTIL_HTTP but don't know how.
    Sunny
    Edited by: 887252 on May 29, 2012 1:24 AM

  • Question about servlet.xml setting

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Example Server Configuration File -->
    <Server port="8025" shutdown="TEARSDOWN">
    <!-- Comment these entries out to disable JMX MBeans support used for the
    administration web application -->
    <Listener className="org.apache.catalina.core.AprLifecycleListener"/>
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
    <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
    <!-- Global JNDI resources -->
    <GlobalNamingResources>
    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <!-- Editable user database that can also be used by
    UserDatabaseRealm to authenticate users -->
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
    <Resource name="jdbc/mp" auth="Container"
    type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@172.25.43.224:1521:mp"
    username="mpuser" password="mp" maxActive="20" maxIdle="10"
    maxWait="-1"/>
    <Resource name="jdbc/passport" auth="Container"
    type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://218.1.14.134:3306/xmnext_passport?autoReconnect=true"
    username="zhouzhijun" password="zhouzhijun*1234567" maxActive="20" maxIdle="10"
    maxWait="-1"/>
    </GlobalNamingResources>
    <!-- Define the Tomcat Stand-Alone Service -->
    <Service name="Catalina">
    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector URIEncoding="utf-8" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxSpareThreads="75" maxThreads="150" minSpareThreads="25" port="8084" redirectPort="8443"/>
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector enableLookups="false" port="8009" protocol="AJP/1.3" redirectPort="8443"/>
    <!-- Define the top level container in our container hierarchy -->
    <Engine defaultHost="localhost" name="Catalina">
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" />
    <!-- a Realm is setUp for JOSSO -->
    <Realm className="org.josso.tc55.agent.jaas.CatalinaJAASRealm"
    appName="app1"
    userClassNames="org.josso.gateway.identity.service.BaseUserImpl"
    roleClassNames="org.josso.gateway.identity.service.BaseRoleImpl"
    debug="1" /> // I am not sure realm can set twice like this?
    <Host appBase="webapps" autoDeploy="false" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
    <!-- a Valve for JOSSO -->
    <Valve className="org.josso.tc55.agent.SSOAgentValve" debug="9" /> when I set this valve, the tomcat seems running abnormal...
    </Host>
    </Engine>
    </Service>
    </Server>
    Could you help me to check this file setting? Just check this "servlet.xml". Thank you very much!

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Example Server Configuration File -->
    <Server port="8025" shutdown="TEARSDOWN">
    <!-- Comment these entries out to disable JMX MBeans support used for the
    administration web application -->
    <Listener className="org.apache.catalina.core.AprLifecycleListener"/>
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
    <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
    <!-- Global JNDI resources -->
    <GlobalNamingResources>
    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <!-- Editable user database that can also be used by
    UserDatabaseRealm to authenticate users -->
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
    <Resource name="jdbc/mp" auth="Container"
    type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@172.25.43.224:1521:mp"
    username="mpuser" password="mp" maxActive="20" maxIdle="10"
    maxWait="-1"/>
    <Resource name="jdbc/passport" auth="Container"
    type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://218.1.14.134:3306/xmnext_passport?autoReconnect=true"
    username="zhouzhijun" password="zhouzhijun*1234567" maxActive="20" maxIdle="10"
    maxWait="-1"/>
    </GlobalNamingResources>
    <!-- Define the Tomcat Stand-Alone Service -->
    <Service name="Catalina">
    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector URIEncoding="utf-8" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxSpareThreads="75" maxThreads="150" minSpareThreads="25" port="8084" redirectPort="8443"/>
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector enableLookups="false" port="8009" protocol="AJP/1.3" redirectPort="8443"/>
    <!-- Define the top level container in our container hierarchy -->
    <Engine defaultHost="localhost" name="Catalina">
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" />
    <!-- a Realm is setUp for JOSSO -->
    <Realm className="org.josso.tc55.agent.jaas.CatalinaJAASRealm"
    appName="app1"
    userClassNames="org.josso.gateway.identity.service.BaseUserImpl"
    roleClassNames="org.josso.gateway.identity.service.BaseRoleImpl"
    debug="1" /> // I am not sure realm can set twice like this?
    <Host appBase="webapps" autoDeploy="false" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
    <!-- a Valve for JOSSO -->
    <Valve className="org.josso.tc55.agent.SSOAgentValve" debug="9" /> when I set this valve, the tomcat seems running abnormal...
    </Host>
    </Engine>
    </Service>
    </Server>
    Could you help me to check this file setting? Just check this "servlet.xml". Thank you very much!

  • Mime-type tag in web.xml and attachment download

    i have set a mime-type in web.xml as below:
    <mime-mapping>
         <extension>xls</extension>
         <mime-type>application/vnd.ms-excel</mime-type>
    </mime-mapping>
    And i have a simple jsp that only shows a table and i am making this jsp to get downloaded as an excel attachment. To make it possible i have written the following line in the JSP:
    response.setHeader( "content-disposition", "attachment; filename=myexcel.xls" );
    But i am not setting the content type first by writing:
    response.setContentType( "application/vnd.ms-excel" );
    since i have already mentioned the appropriate mime-type for excel files in web.xml.
    I am using both mozilla and IE. Both are showing file download dialog. But IE is able to correctly identify the type of the attachment and opens it up with Microsoft Excel whereas mozilla fails to identify the type, assumes it to be an HTML document and opens it up in a new window of IE.
    mozilla works fine only when i set the content type in the JSP itself. But IE works in all conditions even without having the mime-type tag in web.xml.
    If i have already specified the mime-type for particular type of file in web.xml, is there any requirement to set the content type again in the JSP/servlet?
    Please help. I even changed the mime-type for .xls (excel) files in web.xml and made it text/plain, but still the same thing is happening. IE is always showing the correct file type where as mozilla is taking it as an HTML document.
    i am using weblogic server 8.1.

    the web xml mime type setting are for static files served by the server...
    if you print a file directly to the output of the servlet, you must set the mime type, so DO write :
    response.setContentType( "application/vnd.ms-excel" );
    IE "works fine" because it also uses the file extension to decide the mime type... but in the absolute, it's a wrong behaviour

  • Converting XML and XSL into HTML

    Hello!
    I'm designing a servlet class that merges an xml file and xsl file into html that will be sent to the client. But I don't understand how the (sparsely documented) javax.xml.transform.dom package works. An exception is generated for a missing "version" tag, when I've included one that has worked on client-side xml/xsl pages before. If it matters, I'm using Apache Tomcat/JDK 1.4.
    Here's the code:package mypackage.servlet.xml;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class XML2HTMLServlet extends HttpServlet {
         public void doGet(HttpServletRequest request, HttpServletResponse response)
          throws IOException, ServletException {
              response.setContentType("text/html");
              PrintWriter writer = response.getWriter();
              try {
                   openFile("D:/Webdev/xml2html/data.xml", "D:/Webdev/xml2html/style.xsl", writer);
              } catch (Exception e) {
                   e.printStackTrace(writer);
         private void openFile(String xmlPath, String xslPath, PrintWriter writer)
          throws IOException, ParserConfigurationException, SAXException,
          TransformerConfigurationException, TransformerException {
              File xmlFile = new File(xmlPath);
              File xslFile = new File(xslPath);
              TransformerFactory tFact = TransformerFactory.newInstance();
              DocumentBuilderFactory dbFact = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = dbFact.newDocumentBuilder();
              Document xmlDoc = builder.parse(xmlFile);
              Document xslDoc = builder.parse(xslFile);
              Node xmlDocNode = (Node)xmlDoc;
              Node xslDocNode = (Node)xslDoc;
              DOMSource xmlSrc = new DOMSource(xmlDocNode);
              DOMSource xslSrc = new DOMSource(xslDocNode);
              DOMResult htmlResult = new DOMResult();
              Transformer transformer = tFact.newTransformer(xslSrc);  // the exception occurs here!
    When it runs, it complains:
    javax.xml.transform.TransformerConfigurationException:
    javax.xml.transform.TransformerConfigurationException:
    javax.xml.transform.TransformerException:
    javax.xml.transform.TransformerException: stylesheet requires attribute: version at
    org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:767) at
    mypackage.servlet.xml.XML2HTMLServlet.openFile(XML2HTMLServlet.java:49) at
    ...etc...etc...
    data.xml contains:
    <?xml version="1.0"?>
    <document type="lecture">
         <title>Test Data</title>
         <section>
              <name>A New Section</name>
         </section>
    </document>
    style.xsl contains:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
         <html>
              <head>
                   <title><xsl:value-of select="document/title"/></title>
              </head>
              <body>
                   <xsl:apply-templates select="document/section"/>
              </body>
         </html>
    </xsl:template>
    <xsl:template match="section">
         <div><i>Section</i><br/><xsl:value-of select="name"/></div>
    </xsl:template>
    </xsl:stylesheet>I'm not sure the method calls above are what I want, so here's the client-side equivalent in Internet Explorer 5.0:
    function createStyledXMLDocument(xmlUrl, xslUrl) {
         var xmlDocument = new ActiveXObject("Microsoft.XMLDOM");
         xmlDocument.load(xmlUrl);
         var xslDocument = new ActiveXObject("Microsoft.XMLDOM");
         xslDocument.load(xslUrl);
         return xmlDocument.transformNode(xslDocument);
    }Any help would be greatly appreciated.

    Hi!
    I found the immediate answer with
    dbFact.setNamespaceAware(true);As for parser, I'm just using the default JDK install. But I'd like to hear more on Xalan. Is it independent open source? How does Xalan compare to whatever is default in JDK?
    Thanks

  • Ejb-jar.xml and orion-ejb-jar.xml configuration issue

    Chris,
    We have an application that uses the Oracle 10g Application Server and WebSphere MQ v5.3 w/ fixpack 9.
    Our application is a J2EE messaging system which essentially consists of Message Driven Beans, the EJB
    realization of the J2EE Java Message Service (JMS) API. Our application has Message Driven Beans which
    listen to queues and send messages to queues -- a simple messaging system. Currently we can listen to queues, but
    cannot send messages to queues in the Oracle 10g Application Server environment.
    Any J2EE application server has its own implementation of Java Naming Directory Interface (JNDI) API that
    deployed J2EE applications utilize to lookup resources such as Data Sources, JMS Destinations (i.e. MQ Queue),
    JMS QueueConnectionFactories (i.e. MQ QManagers).
    Our application uses the 3rd party JMS Provider, WebSphere MQ.
    MQ ships with a JMSAdmin tool which allows one to create JMS administered objects (i.e. objects a java
    application searches for in some JNDI directory) that reside in some JNDI context. We create a JNDI context for
    MQ resources, queues and QManagers. We configure the MQ provided
    JMSAdmin tool with two property name/value pairs:
    PROVIDER_URL=file:/opt/mqm/JNDI-Directory
    INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
    A resultant .bindings file is created in /opt/mqm/JNDI-Directory which represents our JDNI context
    containing our JMS administered objects. A standalone java application that needs to directly access this
    JNDI context can simply conduct a JNDI lookup on the following context: "java:comp/resource/MQSeries/". An
    example of how a standalone application would lookup a JMS administered object named "qNumber1" would be to
    lookup "java:comp/resource/MQSeries/qNumber1". This lookup would result in the standalone java application
    having a JMS reference to an MQ Queue.
    There is a major difference in how an enterprise EJB application deployed into a J2EE Container (Oracle 10g App Server)
    conducts a JNDI lookup on a 3rd party resource such as MQ as a JMS Provider. A typical EJB application deployed
    into a J2EE container as an .ear (enterprise archive) file has implicit access to the application server's own
    JNDI context. This JNDI context is usually "java:comp/env/". Looking up the Application Server's own Data Source or
    it's own JMS Resources is easy. An application that needs references to these Application Server provided resources
    simply conducts a lookup for "java:comp/env/jms/someQ" or "java:comp/env/jdbc/myDataSource".
    The problem we face is mapping our MQ JNDI context to the Oracle App Server's own JNDI context. We believe this is
    accomplished through mappings defined in both the ejb-jar.xml (EJB Descriptor) and the application server specific
    counterpart, orion-ejb-jar.xml. Note that Oracle 10g Application Server uses the popular orion J2EE container for
    hosting J2EE enterpise applications.
    Our Message Driven Beans (MDBs)currently listen to the Queue at the JNDI location "prodQ". Our problem is that we cannot
    get our MDB to send messages to any queues. Note that the MQ implementation of the queues and Queue Managers work
    flawlessly with standalone java applications. It's safe to say that the MQ objects are working.
    We are looking for a solid example of how the ejb-jar.xml and the orion-ejb-jar.xml map 3rd party JMS provider
    JNDI locations to the App Server's JNDI context.
    Below is how we have attempted to configure our own ejb-jar.xml and orion-ejb-jar.xml:
    ejb-jar.xml begin >>>>>>>>>>>>>>><?xml version = '1.0' encoding = 'UTF-8'?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <display-name>Production Message Driven Bean</display-name>
    <enterprise-beans>
    <message-driven>
    <display-name>prodMdb</display-name>
    <ejb-name>prodMdb</ejb-name>
    <ejb-class>message.handler.AIDMSMessageConsumerBean</ejb-class>
    <transaction-type>Bean</transaction-type>
    <message-driven-destination>
    <destination-type>javax.jms.Queue</destination-type>
    </message-driven-destination>
         <resource-ref>
    <res-ref-name>prodQCF</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Application</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
         <resource-ref>
    <res-ref-name>prodQ</res-ref-name>
    <res-type>javax.jms.Queue</res-type>
    <res-auth>Application</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
                   <resource-ref>
    <res-ref-name>prodR</res-ref-name>
    <res-type>javax.jms.Queue</res-type>
    <res-auth>Application</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    </message-driven>
    </enterprise-beans>
    </ejb-jar>
    <<<<<<<< ejb-jar.xml end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    begin orion-ejb-jar.xml >>>>>>>>>>>>>>>>>>>>>>>>>>><orion-ejb-jar>
    <enterprise-beans>
    <message-driven-deployment name="prodMdb" connection-factory-location="java:comp/resource/MQSeries/prodQCF" destination-location="java:comp/resource/MQSeries/prodR">
              <resource-ref-mapping location="prodQ" name="prodQ">     
                   <lookup-context location="java:comp/resource/MQSeries/" >
                        <!-- <context-attribute name="java.naming.factory.initial"
                             value="com.sun.jndi.fscontext.RefFSContextFactory" /> -->
                   </lookup-context>
              </resource-ref-mapping>
              <resource-ref-mapping location="prodR" name="prodR">     
                   <lookup-context location="java:comp/resource/MQSeries/" >
                        <!-- <context-attribute name="java.naming.factory.initial"
                             value="com.sun.jndi.fscontext.RefFSContextFactory" /> -->
                   </lookup-context>
              </resource-ref-mapping>
         </message-driven-deployment>
    </enterprise-beans>
    </orion-ejb-jar>
    <<<<<<<<< end orion-ejb-jar.xml <<<<<<<<<<<<<<<<<<<<<<<<

    If you look at the contents of a deployment plan (Plan.xml) when you have it generated
    <deployment-plan ...>
      <module-override>
        <module-name>ejb.jar</module-name>
        <module-type>ejb</module-type>
        <module-descriptor external="true">
          <root-element>weblogic-ejb-jar</root-element>
          <uri>META-INF/weblogic-ejb-jar.xml</uri>
        </module-descriptor>
        <module-descriptor external="false">
          <root-element>ejb-jar</root-element>
          <uri>META-INF/ejb-jar.xml</uri>
        </module-descriptor>
        <module-descriptor external="true">
          <root-element>persistence-configuration</root-element>
          <uri>META-INF/persistence-configuration.xml</uri>
        </module-descriptor>
        <module-descriptor external="false">
          <root-element>persistence</root-element>
          <uri>META-INF/persistence.xml</uri>
        </module-descriptor>
      </module-override>
    </deployment-plan>You can see which files can be external and which can be not. The weblogic-ejb-jar.xml can be external
    but in this case you need a deployment plan to point weblogic to the file. The ejb-jar.xml cannot be
    external (see external=false)
    The benefit of storing the weblogic-ejb-jar.xml is that your administrator can fine tune certain
    configurations by using a deployment plan, instead of having to extract the contents from the jar file
    and then repackage it again.
    No need to worry about a clustered environment, you can place the jar and the deployment plan
    on the server where the admin server is located, when you deploy an application you deploy it to
    the cluster and everything is taken care off.
    More information on deployment plans can be found here: http://download.oracle.com/docs/cd/E11035_01/wls100/deployment/config.html

  • Database updation using XML and stored Procedure?

    Hello,
    I want to perform updation in multiple tables using XML files.Please suggest can I do updation using xml and stored procedure.
    If yes then which is more efficient and takes less time.
    1.Updation using xml files only
    2.Updation using xml files with stored procedure.
    3.Stored procedure alone.
    If direct xml and stored procedure communication is possible.then please write how.
    Thanks in advance for any help.

    Here's a sample. The next code drop of the XSQL Servlet will make the easy-to-do from within XSQL Pages:
    package package1;
    import org.w3c.dom.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    public class Class1 extends Object {
    public static void main( String[] arg ) throws Exception {
    Connection conn = getConnection();
    CallableStatement ocs = conn.prepareCall("begin ? := App.HotItems('PAUL'); end;");
    ocs.registerOutParameter(1,OracleTypes.CURSOR);
    ocs.execute();
    ResultSet rs = ((OracleCallableStatement)ocs).getCursor(1);
    OracleXMLQuery oxq = new OracleXMLQuery(conn,rs);
    System.out.println(oxq.getXMLString());
    oxq.close();
    rs.close();
    ocs.close();
    conn.close();
    public static Connection getConnection() throws Exception {
    String username = "scott";
    String password = "tiger";
    String dburl = "jdbc:oracle:thin:@localhost:1521:xml";
    String driverClass = "oracle.jdbc.driver.OracleDriver";
    Driver d = (Driver)Class.forName(driverClass).newInstance();
    return DriverManager.getConnection(dburl,username,password);
    null

  • Oracle-servlet-xml

    Hello,
    i've just installed Oracle database on my pc. I am rather new to web server softwares, so i 'd like to ask you about the ones provided with this installation.
    Is oracle's servletrunner engine embedded in apache coming along with this version of oracle?I mean i am properly running servlet.exe as my webserver in order to then execute certain servlet code and obtain xml as a result. The fact is that i have not fully understood the architecture beeing used. Am i using just a seperate servletrunner engine thta oracle database encorporates or Oracle's Apache's servletrunner engine???
    Thanx in advance
    Manolis

    Forgive me for not having put this properly.
    Through oracle database 9.2.0.1 installation enterprise edition, an apache folder was also created inside oracle/ora92 folder on my hard disk.Is this apache a full apache websever software or not?And is it indeed provided along with oracle installation or have i picked the wrong type of installation??
    I also noticed a servletrunner.exe file contained in oracle/ora92/Apache/jsdk/bin folder, which i am running in order to execute servlet code.Is this part of Apache or independently provided with oracle?
    Can you please clear these issues for me??
    Thank you very much!!

  • Servlets & XML-RPC Example

    Since I am not having any luck on the Java & XML forum (http://forum.java.sun.com/thread.jsp?forum=34&thread=512728&tstart=0&trange=15)
    I thought I would try here. Does anyone know of a good example on the web they can point me to that shows XML-RPC with servlets as I cannot find any and the examples dir from the Apache distribution of XML-RPC (which is supposed to have such an example) is MIA. Thanks.

    hello,
    I am looking for the same servlet xml-rpc example, Have you found it ?
    nojkan

  • [svn] 1705: 1) Add a security constrain for MBeanObjectNameResolver destination in remoting-config .xml for WebSphere deployment

    Revision: 1705
    Author: [email protected]
    Date: 2008-05-14 08:58:31 -0700 (Wed, 14 May 2008)
    Log Message:
    1) Add a security constrain for MBeanObjectNameResolver destination in remoting-config.xml for WebSphere deployment
    2) Update the MBean tests accordingly and correct a typo
    3) Also make some additional ProxyServiceMBeanTest to solve a timing issue when getting MBean attributes on WAS
    4) update the jgroups-udp.xml and set bind_to_all_interfaces to fall since it prevents server from startup when IPv6 is enabled on Windows
    Modified Paths:
    blazeds/trunk/qa/apps/qa-regress/WEB-INF/flex/jgroups-udp.xml
    blazeds/trunk/qa/apps/qa-regress/WEB-INF/flex/remoting-config.mods.xml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/MBean/proxyservice/HTTPDestinati onTest.mxml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/MBean/proxyservice/ProxyServiceM BeanTest.mxml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/MBean/proxyservice/SOAPDestinati onTest.mxml

    I guess the reason was that I wrote
    <login-config>
    <auth-method>Basic</auth-method>
    </login-config>
    instead of required
    <login-config>
    <auth-method>BASIC</auth-method>
    </login-config>
    At deploy time, I got no error message. At usage time, I just got this AccessLocalException. That's not really nice ...
    Merten

  • Weblogic and websphere colocated?

    Has anyone ever had any experience running weblogic and websphere on the same machine? If so, what were your issues?
    Thanks in advance.

    Web sphere has a wide robust features which weblogic lacks some. Like the load balancing and admin console, clustering .
    In Weblogic In many cases, code for applications deployed on WebLogic Server is arbitrarily structured and depends on the build process to make sense of it all. The implication of this is that existing code organization will very likely have to be changed as part of the migration effort. This may be very difficult (or even impossible) to accomplish while maintaining links to your code's history. Some organizations choose simply to archive their history and start fresh.
    In WebSphere, Packaged with each module is an XML deployment descriptor that describes the organization of the components in the module and how they are configured at run time. hence applications can be migrated easily.

Maybe you are looking for

  • Premiere Elements 3 Freezes on startup in Windows 7

    I just loaded Premiere Elements 3 on a laptop with Windows 7 and it freezes on startup. I can't find any reference to drivers for Windows 7. I've used PE3 satisfactorily with Windows XP and want to continue to use it. Does anyone have a solution that

  • HT204022 How do you remove all the photos in photostream in one go i.e reset?

    I have a new Mac and iphone and when I turn on photostream it downloads thousands of pics that have been taken since photostream started. I don't want it to do that, I just want to reset the photo stream and start with zero pics as its being download

  • Artist order in itunes

    I just installed the new Itunes 7.3. After it successfully installed and Itunes automatically started, i noticed that order of artists is now completely messed up. the list now starts with a-z, then to numbers, where before it went numbers-english ch

  • A/V output setup for MacBook question

    Bought the A/V cable and have used it to hook my MacBook to my stereo system while my guitar is hooked up to the MacBook. Tried it on my iPod to TV to stereo system, wanted to see my vids on tv and hear through stereo. Figuered out in "video setup" o

  • Log data for infotypes

    Hi folks, I have an task that I am trying to resolve, related to log data for the infotypes. I had posed this question earlier too. I did some research to find out an answer for this, but invain. Any help is really appreciated. The task is: The infot