This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Web Services and the fly likes database to xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "database to xml" Watch "database to xml" New topic
Author

database to xml

neri jimenez
Greenhorn

Joined: May 10, 2011
Posts: 8
I need help converting an database table into a xml document in a java webservice, I did it this way to get a xml document

DocumentBuilderFactory factoryAdeudo = DocumentBuilderFactory.newInstance();
DocumentBuilder builderAdeudo = factoryAdeudo.newDocumentBuilder();
Document adeudo= builderAdeudo.newDocument()

then y got the resulset, after that i call a function made by myself to generate xml like this way

Element results = doc.createElement("employee");
doc.appendChild(results);


ResultSetMetaData rsmd = dataTable.getMetaData();
int count = rsmd.getColumnCount();

while (dataTable.next()){
for (int i = 1; i <= count; i++){
String columnName = rsmd.getColumnName(i);
Object value = dataTable.getObject(i);

Element node = doc.createElement(columnName);
node.appendChild(doc.createTextNode(value.toString()));
}


it compile but when i deploy it got me next error

Error durante la implementación: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.RuntimeException: Servlet web service endpoint '' failure. Consulte /server.log para obtener más información.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18154
    
    8

Consulte /server.log para obtener más información.


The English translation of this is "Consult /server.log to obtain more information", right? So did you do that? What information did you find?
neri jimenez
Greenhorn

Joined: May 10, 2011
Posts: 8
i check the file and throw me 4 exceptions

javax.xml.ws.WebServiceException: Unable to create JAXBContext
at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:171)
at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:99)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:250)
at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:343)
...

org.apache.catalina.LifecycleException: PWC2769: Manager has not yet been started
at org.apache.catalina.session.StandardManager.stop(StandardManager.java:872)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:5509)
at com.sun.enterprise.web.WebModule.stop(WebModule.java:529)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5323)
at com.sun.enterprise.web.WebModule.start(WebModule.java:500)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:755)
...


java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.RuntimeException: Servlet web service endpoint '' failure
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:921)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:755)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1980)
...

java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.RuntimeException: Servlet web service endpoint '' failure
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:130)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:286)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
...


i can't attach the file :S

neri jimenez
Greenhorn

Joined: May 10, 2011
Posts: 8
i solve it, the exeption was beacuse i throw the sql exception, to solve it i catch it with a try..catch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: database to xml
 
Similar Threads
Java Result Set
loading very large resultset in xml document
return as xml document
Beginning Java Web Services Code Problem
jdbc resultset to xml