users@glassfish.java.net

my web service does not deploy on glassfish

From: <forums_at_java.net>
Date: Thu, 15 Dec 2011 07:40:45 -0600 (CST)

i have been trying to develop a web service using netbeans 7.01. there is an
error that is returned whenever i try to deploy the web service. please
suggest a way around the problem.

My code:

package com.afrisoftech.funsoft.hmis.webservices;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
/**
 *
 * @author charles
 */
@WebService(serviceName = "DBConnection")
public class DBConnection {
    /** This is a sample web service operation */
    /* @WebMethod(operationName = "hello")
    public String hello(@WebParam(name = "name") String txt) {
    return "Hello " + txt + " !";
    }
     */
    /**
     * Web service operation
     */
    @WebMethod(operationName = "connect2DB")
    public Connection connect2DB(@WebParam(name = "hostName") String
hostName, @WebParam(name = "dbPort") int dbPort, @WebParam(name = "userName")
String userName, @WebParam(name = "password") String password) {
        java.sql.Connection connDB = null;
        try {
            //TODO write your implementation code here:
            Class.forName("org.postgresql.Driver");
        } catch (ClassNotFoundException ex) {
           
Logger.getLogger(DBConnection.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            connDB =
DriverManager.getConnection("jdbc:postgresql://localhost:5432", userName,
password);
       
            System.out.println("Connection established :
["+connDB.getSchema()+"]");
        } catch (SQLException ex) {
            ex.printStackTrace();
           
Logger.getLogger(DBConnection.class.getName()).log(Level.SEVERE, null, ex);
        }
        return connDB;
    }
}
 

The related error on glassfish debug window:

SEVERE: Exception while loading the app
SEVERE: Exception while loading the app : java.lang.IllegalStateException:
ContainerBase.addChild: start: org.apache.catalina.LifecycleException:
java.lang.RuntimeException: Servlet web service endpoint '' failure
 

Error details:

WARNING: Deployment failed
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)
    at
com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:205)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:513)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:568)
    at
org.glassfish.webservices.WSServletContextListener.registerEndpoint(WSServletContextListener.java:260)
    at
org.glassfish.webservices.WSServletContextListener.contextInitialized(WSServletContextListener.java:99)
    at
org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4750)
    at
com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:550)
    at
org.apache.catalina.core.StandardContext.start(StandardContext.java:5366)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
    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:733)
    at
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2000)
    at
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1651)
    at
com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
    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:294)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:462)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
    at
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
    at
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
    at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
    at
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
    at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
    at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
    at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.security.PrivilegedActionException:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of
IllegalAnnotationExceptions
java.sql.Connection is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at java.sql.Connection
        at private java.sql.Connection
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse._return
        at
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse
java.sql.Connection does not have a no-arg default constructor.
    this problem is related to the following location:
        at java.sql.Connection
        at private java.sql.Connection
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse._return
        at
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse
    at java.security.AccessController.doPrivileged(Native Method)
    at
com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:158)

... 41 more
Caused by: java.security.PrivilegedActionException:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of
IllegalAnnotationExceptions
java.sql.Connection is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at java.sql.Connection
        at private java.sql.Connection
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse._return
        at
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse
java.sql.Connection does not have a no-arg default constructor.
    this problem is related to the following location:
        at java.sql.Connection
        at private java.sql.Connection
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse._return
        at
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse
    at java.security.AccessController.doPrivileged(Native Method)
    at
com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:158)
    ... 49 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts
of IllegalAnnotationExceptions
java.sql.Connection is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at java.sql.Connection
        at private java.sql.Connection
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse._return
        at
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse
java.sql.Connection does not have a no-arg default constructor.
    this problem is related to the following location:
        at java.sql.Connection
        at private java.sql.Connection
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse._return
        at
com.afrisoftech.funsoft.hmis.webservices.jaxws.Connect2DBResponse
    at
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)
    at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:466)
    at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
    at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)
    at
com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1157)
    at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:188)
    at
com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:111)
    at
com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:113)
    at
com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:166)
    at
com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:159)
    ... 51 more

what could be wrong with the code? i really appreciate your support


--
[Message sent by forum member 'cwaweru']
View Post: http://forums.java.net/node/874290