0

我制作了一个简单的 Web 服务,它必须为具有指定 uuid 的用户更新 acrive 字段。

p

ublic  String  UpdateDB(UUID choUUIID ) throws ClassNotFoundException 
    {

        String strDelReturn = "UPDATE_FAIL";

        Class.forName("org.postgresql.Driver");
        try 
        {
            conn = DriverManager.getConnection(
                    "jdbc:postgresql://localhost:5432/plovdivbizloca",
                    "postgres", "tan");

        }

        catch (SQLException ex) 
        {

            ex.printStackTrace();
        }


        PreparedStatement pstmt = null;
        String selectQuery = "update users set active=active+1 WHERE uuid="+ choUUIID ;

        try {

            pstmt = conn.prepareStatement(selectQuery);
            int rowss = pstmt.executeUpdate();
            if (rowss != 0) 
                strDelReturn = "UPDATE_OK";

        } 
        catch (Exception ex) 
        {

        }
        return strDelReturn;
}

我从 postgresql 数据库中获取参数 choUUIID(该字段是 uuid 类型)但是当我测试它时

http://localhost:9091/Hashing_Passwords/services/Hashing_Password/UpdateDB?choUUIID=d99620ae-20a3-46f7-adb1-1afd0e8f3b27

这是我得到的例外:

org.apache.axis2.AxisFault: java.util.UUID
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at org.apache.axis2.engine.DefaultObjectSupplier.getObject(DefaultObjectSupplier.java:47)
        at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:412)
        at org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:818)
        at org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:737)
        at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:646)
        at org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:153)
        at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:206)
        at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
        at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
        at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
        at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:144)
        at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:139)
        at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:837)
        at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:273)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.InstantiationException: java.util.UUID
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at org.apache.axis2.engine.DefaultObjectSupplier.getObject(DefaultObjectSupplier.java:42)
        ... 32 more
4

0 回答 0