mace-opensaml-users - javax.xml.parsers.FactoryConfigurationError
Subject: OpenSAML user discussion
List archive
- From:
- To:
- Subject: javax.xml.parsers.FactoryConfigurationError
- Date: Sat, 13 Jan 2007 05:42:01 -0500 (EST)
Hi,
I have same problems with my code. I expose below my problems:
From a servlet i get two strings "nomeutente" AND "password".
The string "nomeutente" is the argument of the Method
"setNameIdentifier.setName(nomeutente)" of SAMLSubject.
The string "password" is converted in a XML element and this new elemet is
the argument of the Method "setConfirmationData" of the SAMLSubject.
When i run my code in Tomcat i have this error:
"javax.xml.parsers.FactoryConfigurationError: OpenSAML requires an xml parser
that supports DOM3 calls. Sun JAXP 1.3 has been included with this release
and is strongly recommended. If you are using Java 1.4, make sure that you
have enabled the Endorsed Standards Override Mechanism for this parser (see
http://java.sun.com/j2se/1.4.2/docs/guide/standards/ for details)."
I have changed the "JDK 1.4.2" and i have installed the "JDK 1.5" that
support "xerces" with "JAXP 1.3", but i have tha same error.
I hope that you can halp me, because i don't understand where is the problem.
Thank you for your attention.
Best Reagards
Silena Leone
Hereinafter there is my code:
package client;
import client.AutenticazioneServiceLocator;
import com.sun.org.apache.bcel.internal.generic.DUP;
import com.sun.org.apache.xerces.internal.dom.DocumentImpl;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.net.*;
import org.apache.axis.*;
import org.opensaml.*;
import org.opensaml.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import com.sun.org.apache.xerces.internal.jaxp.validation.*;
import com.sun.org.apache.xerces.internal.jaxp.validation.xs.*;
import com.sun.org.apache.xerces.internal.xinclude.*;
import com.sun.org.apache.xerces.internal.dom.*;
import javax.xml.validation.Schema;
import com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.*;
import javax.xml.rpc.ServiceException;
import org.w3c.dom.Element;
/**
*
* @author Silena
* @version
*/
public class miaServlet extends HttpServlet {
/** Processes requests for both HTTP <code>GET</code> and
<code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>MiaServlet</title>");
out.println("<head>");
out.println("<body>");
out.println("</th>");
out.println("<b>Inserisci nomeutente e password per
autenticarti.</b><br><br>");
out.println("<form method=\"post\"
action=\"http://localhost:8080/miaServlet\">");
out.println("<table border=\"0\">");
out.println("<tr><td>NomeUtente: </td><td>");
out.println("<input type=\"text\" name=\"nomeutente\">");
out.println("</td></tr>");
out.println("<tr><td>Password: </td><td>");
out.println("<input type=\"password\" name=\"password\">");
out.println("</td></tr> ");
out.println("<tr><td colspan=\"2\" align=\"center\">");
out.println("<input type=\"SUBMIT\" value=\"Invia\"></td></tr> ");
out.println("</table></form>");
out.println("</body> ");
out.println("<html>");
/* TODO output your page here
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet miaServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet miaServlet at " + request.getContextPath ()
+ "</h1>");
out.println("</body>");
out.println("</html>");
*/
out.close();
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click
on the + sign on the left to edit the code.">
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
this.doPost(request,response);
}
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
String nomeutente;
String password;
PrintWriter out = response.getWriter();
String soggetto = null,risp = null,risultato = null;
if(request.getParameter("nomeutente")==null)
{
this.processRequest(response);
}
else
{
nomeutente = (String)request.getParameter("nomeutente");
password = (String)request.getParameter("password");
out.println("<center>Argomenti Passati :"+nomeutente+" :
"+password+"</center>");
//creo un elemento XML a partire da una stringa//
DocumentBuilderFactory factory =
DocumentBuilderFactoryImpl.newInstance();
DocumentBuilder builder;
org.w3c.dom.Document document;
Element confirmationdata;
try {
builder = factory.newDocumentBuilder();
document = builder.newDocument();
Element root = (Element) document.createElement("rootElement");
document.appendChild(root);
confirmationdata = document.createElement("password");
root.appendChild(confirmationdata);
confirmationdata.setNodeValue(password);
SAMLNameIdentifier nameidentifier = new SAMLNameIdentifier();
SAMLSubject subject = new SAMLSubject(nameidentifier,null,null,null);
nameidentifier.setName("nomeutente");
try {
subject.setNameIdentifier(nameidentifier);
} catch (SAMLException ex) {
ex.printStackTrace();
}
subject.setConfirmationData(confirmationdata);
soggetto = subject.toString();
.
.
.
.
- javax.xml.parsers.FactoryConfigurationError, silena . leone, 01/13/2007
- Re: javax.xml.parsers.FactoryConfigurationError, Chad La Joie, 01/13/2007
- <Possible follow-up(s)>
- Re: javax.xml.parsers.FactoryConfigurationError, , 01/13/2007
- RE: javax.xml.parsers.FactoryConfigurationError, Scott Cantor, 01/13/2007
Archive powered by MHonArc 2.6.16.