axis2+spring+hibernate(webservice工程)

使用axis2+spring+hibernate三大框架整合构建webservice工程,一遍遍的修改配置文件,一遍遍的调试,费了好一番功夫终于成功了,可以实现对数据库的操作了,任务还要求使用事务,添加上事务:

@Transactional
public class UserService {
    private UserDAO userDAO;
   
    public void setUserDAO(UserDAO userDAO) {
        this.userDAO = userDAO;
    }
   
    public int addOneUser(String name,int age){
        return userDAO.addUser(name, age);
    }
   
    @Transactional
    public int saveOneUser(String name, int age){
        System.out.println("@@@@@@@@"+name+":"+age);
        User user = new User();
        user.setName(name);
        user.setAge(age);
        return userDAO.saveUser(user);
    }
}


在applicationContext.xml中添加:

        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
       
   

   
   

重新启动tomcat,出现了一系列的错误:

org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: Unable to load bytecode for class service.UserService$$EnhancerByCGLIB$$a88ea6ef


[ERROR] The user.aar service, which is not valid, caused The following error occurred during schema generation: Unable to load bytecode for class service.UserService$$EnhancerByCGLIB$$a88ea6ef


Caused by: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: Unable to load bytecode for class service.UserService$$EnhancerByCGLIB$$a88ea6ef
    at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:394)
    ... 39 more
Caused by: java.io.IOException: Unable to load bytecode for class service.UserService$$EnhancerByCGLIB$$a88ea6ef
    at org.apache.axis2.description.java2wsdl.bytecode.ClassReader.getBytes(ClassReader.java:84)
    at org.apache.axis2.description.java2wsdl.bytecode.ParamReader.(ParamReader.java:57)
    at org.apache.axis2.description.java2wsdl.bytecode.ChainedParamReader.(ChainedParamReader.java:52)
    at org.apache.axis2.description.java2wsdl.bytecode.MethodTable.(MethodTable.java:31)
    at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.(DefaultSchemaGenerator.java:137)
    at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:499)
    at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:386)

看到网上有说是公布的web service不能直接参与事务, 而是需要把事务"代理"给其他的类处理!!!



你可能感兴趣的:(WebService)