我正在开发一个Spring / CXF-RESTful / MyBatis应用程序。 我总是自己解决了一些错误,但这个错误....我不知道解决它的方法。 所以,请检查此错误并分享我们的知识。 谢谢。 贞植
![Project View][1]
错误日志(JBoss)
11:22:56,614 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.0.Final-redhat-2
11:22:57,379 INFO [org.jboss.msc] (main) JBoss MSC version 1.0.4.GA-redhat-1
11:22:57,657 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: JBoss EAP 6.2.0.GA (AS 7.3.0.Final-redhat-14) starting
11:23:01,219 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found cxfdbsample.war in deployment directory. To trigger deployment create a file called cxfdbsample.war.dodeploy
11:23:01,220 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found blog.war in deployment directory. To trigger deployment create a file called blog.war.dodeploy
11:23:01,280 INFO [org.xnio] (MSC service thread 1-6) XNIO Version 3.0.7.GA-redhat-1
11:23:01,286 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
11:23:01,292 INFO [org.xnio.nio] (MSC service thread 1-6) XNIO NIO Implementation Version 3.0.7.GA-redhat-1
11:23:01,314 INFO [org.jboss.remoting] (MSC service thread 1-6) JBoss Remoting version 3.2.18.GA-redhat-1
11:23:01,368 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 29) JBAS010280: Activating Infinispan subsystem.
11:23:01,370 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 37) JBAS011800: Activating Naming Subsystem
11:23:01,379 INFO [org.jboss.as.security] (ServerService Thread Pool -- 42) JBAS013171: Activating Security Subsystem
11:23:01,408 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.19.SP2-redhat-1
11:23:01,420 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 46) JBAS015537: Activating WebServices Extension
11:23:01,486 INFO [org.jboss.as.naming] (MSC service thread 1-2) JBAS011802: Starting Naming Service
11:23:01,544 INFO [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS015400: Bound mail session [java:jboss/mail/Default]
11:23:01,558 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 35) JBAS012605: Activated the following JSF Implementations: [main, 1.2]
11:23:01,597 INFO [org.jboss.as.connector.logging] (MSC service thread 1-4) JBAS010408: Starting JCA Subsystem (IronJacamar 1.0.23.Final-redhat-1)
11:23:01,691 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 25) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
11:23:02,508 INFO [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final-redhat-1
11:23:02,513 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) JBAS015012: Started FileSystemDeploymentService for directory C:\jboss\jboss-eap-6.2\standalone\deployments
11:23:02,559 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "cxfdbsample.war" (runtime-name: "cxfdbsample.war")
11:23:02,585 INFO [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100: Listening on 127.0.0.1:4447
11:23:02,585 INFO [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on 127.0.0.1:9999
11:23:02,598 INFO [org.apache.coyote.http11] (MSC service thread 1-2) JBWEB003001: Coyote HTTP/1.1 initializing on : http-localhost/127.0.0.1:8080
11:23:02,608 INFO [org.apache.coyote.http11] (MSC service thread 1-2) JBWEB003000: Coyote HTTP/1.1 starting on: http-localhost/127.0.0.1:8080
11:23:02,857 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
11:23:34,418 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry jaxb-api.jar in /C:/jboss/jboss-eap-6.2/standalone/deployments/cxfdbsample.war/WEB-INF/lib/jaxb-impl-2.1.13.jar does not point to a valid jar for a Class-Path reference.
11:23:34,419 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry activation.jar in /C:/jboss/jboss-eap-6.2/standalone/deployments/cxfdbsample.war/WEB-INF/lib/jaxb-impl-2.1.13.jar does not point to a valid jar for a Class-Path reference.
11:23:34,420 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry jsr173_1.0_api.jar in /C:/jboss/jboss-eap-6.2/standalone/deployments/cxfdbsample.war/WEB-INF/lib/jaxb-impl-2.1.13.jar does not point to a valid jar for a Class-Path reference.
11:23:34,420 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry jaxb1-impl.jar in /C:/jboss/jboss-eap-6.2/standalone/deployments/cxfdbsample.war/WEB-INF/lib/jaxb-impl-2.1.13.jar does not point to a valid jar for a Class-Path reference.
11:23:34,422 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry jaxb-api.jar in /C:/jboss/jboss-eap-6.2/standalone/deployments/cxfdbsample.war/WEB-INF/lib/jaxb-xjc-2.1.13.jar does not point to a valid jar for a Class-Path reference.
11:23:34,422 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry jaxb-impl.jar in /C:/jboss/jboss-eap-6.2/standalone/deployments/cxfdbsample.war/WEB-INF/lib/jaxb-xjc-2.1.13.jar does not point to a valid jar for a Class-Path reference.
11:23:34,422 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry jsr173_1.0_api.jar in /C:/jboss/jboss-eap-6.2/standalone/deployments/cxfdbsample.war/WEB-INF/lib/jaxb-xjc-2.1.13.jar does not point to a valid jar for a Class-Path reference.
11:23:34,423 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry activation.jar in /C:/jboss/jboss-eap-6.2/standalone/deployments/cxfdbsample.war/WEB-INF/lib/jaxb-xjc-2.1.13.jar does not point to a valid jar for a Class-Path reference.
11:23:34,451 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry xml-apis.jar in /C:/jboss/jboss-eap-6.2/standalone/deployments/cxfdbsample.war/WEB-INF/lib/serializer-2.7.1.jar does not point to a valid jar for a Class-Path reference.
11:23:39,141 INFO [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016002: Processing weld deployment cxfdbsample.war
11:23:39,443 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
11:23:39,445 INFO [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016005: Starting Services for CDI deployment: cxfdbsample.war
11:23:39,678 INFO [org.jboss.weld.Version] (MSC service thread 1-7) WELD-000900 1.1.16 (redhat)
11:23:39,778 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016008: Starting weld service for deployment cxfdbsample.war
11:23:40,961 INFO [org.jboss.web] (ServerService Thread Pool -- 56) JBAS018210: Register web context: /cxfdbsample
11:23:41,023 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cxfdbsample]] (ServerService Thread Pool -- 56) No Spring WebApplicationInitializer types detected on classpath
11:23:41,073 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cxfdbsample]] (ServerService Thread Pool -- 56) Initializing Spring root WebApplicationContext
11:23:41,073 INFO [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 56) Root WebApplicationContext: initialization started
11:23:41,309 INFO [org.springframework.web.context.support.XmlWebApplicationContext] (ServerService Thread Pool -- 56) Refreshing Root WebApplicationContext: startup date [Tue Mar 11 11:23:41 KST 2014]; root of context hierarchy
11:23:41,482 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ServerService Thread Pool -- 56) Loading XML bean definitions from ServletContext resource [/WEB-INF/beans.xml]
11:23:41,606 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ServerService Thread Pool -- 56) Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
11:23:41,684 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ServerService Thread Pool -- 56) Loading XML bean definitions from class path resource [META-INF/cxf/cxf-servlet.xml]
11:23:42,056 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ServerService Thread Pool -- 56) Loading XML bean definitions from ServletContext resource [/WEB-INF/mybatis/mybatis-context.xml]
11:23:42,552 INFO [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ServerService Thread Pool -- 56) Loading properties file from ServletContext resource [/WEB-INF/mybatis/jdbc.properties]
11:23:42,569 INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (ServerService Thread Pool -- 56) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
11:23:44,707 ERROR [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 56) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restContainer': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(Lorg/apache/cxf/service/model/EndpointInfo;)Lorg/apache/cxf/transport/Destination;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760) [spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) [spring-context-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) [spring-web-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) [spring-web-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3777) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_51]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: java.lang.AbstractMethodError: org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(Lorg/apache/cxf/service/model/EndpointInfo;)Lorg/apache/cxf/transport/Destination;
at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:93) [cxf-api-2.7.8.jar:2.7.8]
at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:72) [cxf-api-2.7.8.jar:2.7.8]
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:160) [cxf-bundle-3.0.0-milestone1.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_51]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1681) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1620) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
... 23 more
的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cxfdbsample</groupId>
<artifactId>cxfdbsample</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>cxfdbsample Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
</dependency>
<!-- mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.0.6</version>
</dependency>
<!-- mybatis spring -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.0.2</version>
</dependency>
<!-- apache commons dbcp-->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<!-- CXF -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>2.7.8</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>3.0.0-milestone1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.0.0-milestone2</version>
</dependency>
<!-- RESTful -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1-ea</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.jra</groupId>
<artifactId>jra</artifactId>
<version>1.0-alpha-4</version>
</dependency>
<!-- JSON -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<classifier>jdk15</classifier>
<version>2.4</version>
</dependency>
</dependencies>
<build>
<finalName>cxfdbsample</finalName>
</build>
</project>
的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>cxfdbsample</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<!-- CXF -->
<servlet>
<servlet-name>cxfdbsample</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxfdbsample</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/beans.xml
/WEB-INF/mybatis/mybatis-context.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
的beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!--
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml" />
-->
<context:component-scan base-package="cxfdbsample.controller" />
<jaxrs:server id="restContainer" address="/">
<jaxrs:serviceBeans>
<ref bean="loginController" />
</jaxrs:serviceBeans>
</jaxrs:server>
<!--
<bean id="loginController" class="cxfdbsample.controller.LoginController" />
-->
</beans>
LoginController.java
package cxfdbsample.controller;
import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces;
import net.sf.json.JSONArray; import net.sf.json.JSONObject;
//@Controller import org.springframework.stereotype.Controller;
//@Service import org.springframework.stereotype.Service;
//@WebService import javax.jws.WebService; //@WebParam import javax.jws.WebParam;
//@HttpResource import org.codehaus.jra.HttpResource;
//@Resource import javax.annotation.Resource;
//import java.util.ArrayList; import java.util.HashMap; import java.util.Map;
import org.slf4j.Logger; import org.slf4j.LoggerFactory;
import cxfdbsample.mybatis.UserDaoImpl; import cxfdbsample.vo.UserVo; import cxfdbsample.util.Util;
//@WebService(targetNamespace = "http://localhost:8080/cxfdbsample/") @Path("user") @Service("loginController") public class LoginController {
private static final Logger logger = LoggerFactory.getLogger(LoginController.class); UserVo userVo;
@Resource(name="userDaoImpl") private UserDaoImpl userDaoImpl;
// @HttpResource(location = "/loginController/{id}/{password}") // public JSONObject UserCheck(@WebParam(name = "id") String id, @WebParam(name = "password") String password){ @GET @Path("user/{id}/{password}") public JSONObject UserCheck(@PathParam("id") String id, @PathParam("password") String password){
Map<String, String> map = new HashMap<String, String>();
String userId = Util.nullCheck(id, ""); String userPassword = Util.nullCheck(password, "");
map.put("id",userId); map.put("password", userPassword);
int loginValue = 0;
try { loginValue = userDaoImpl.getLoginResult(map); } catch (Exception e) { }
if (loginValue == 1) { logger.info("로그인성공"); userVo = userDaoImpl.getUserInfo(id);
JSONObject jsonObject = new JSONObject(); JSONArray cell = new JSONArray();
JSONObject obj = new JSONObject(); obj.put("userId", userVo.getUserId()); obj.put("userPassword", userVo.getUserPassword()); obj.put("userEmail", userVo.getUserEmail()); obj.put("userName", userVo.getUserName()); obj.put("userSeq", userVo.getUserSeq()); cell.add(obj); jsonObject.put("data", cell);
System.out.println(jsonObject); return jsonObject;
// for(int i = 0; i < userVo.size(); i++){ // // JSONObject obj = new JSONObject(); // obj.put("userId", userVo.getUserId()); // obj.put("userPassword", userVo.getUserPassword()); // obj.put("userEmail", userVo.getUserEmail()); // obj.put("userName", userVo.getUserName()); // obj.put("userSeq", userVo.getUserSeq()); // // cell.add(obj); // } // jsonObject.put("data", cell); } else { //수정 필요 부분 logger.info("로그인실패"); JSONObject jsonObject = new JSONObject(); JSONArray cell = new JSONArray(); JSONObject obj = new JSONObject(); obj.put("userId", null); obj.put("userPassword", null); obj.put("userEmail", null); obj.put("userName", null); obj.put("userSeq", null); cell.add(obj); jsonObject.put("data", cell); System.out.println(jsonObject); return jsonObject; } } }
答案 0 :(得分:0)
我遇到了类似的问题,我也收到了错误
Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(Lorg/apache/cxf/service/model/EndpointInfo;)Lorg/apache/cxf/transport/Destination;
对我来说,问题是两个不同版本的CXF在类路径上(大约2.6或2.7和3.0)。确保只使用一个版本后,错误消息消失。我没有检查你的POM,因为2年后你可能已经解决了这个问题:)