2016-11-30 1 views
1

私はエンドポイントは、URLCommandLineRunnerとSpringbootの問題 - プロキシセッションを初期化できませんでした - いいえセッション

@Override 
public void run(String... arg0) throws Exception { 
    // TODO Auto-generated method stub  Endpoint.p 
    Endpoint.publish("http://localhost:9000" +"/service/serve", new ServeWeb()); 

} 

公開次のブログ https://www.javacodegeeks.com/2016/07/writing-consuming-soap-webservice-spring.html

を使用して春ブートでSOAPサービスを作成しました私は

を使用していますXyzServiceで

@WebService 
public class ServeWeb { 

    @Autowired 
    XyzService xyzService; 


    @WebMethod(operationName="LOGIN") 
    public List<String> userLogin(
      @WebParam(name = "uid")String uid, 
      @WebParam(name = "pwd")String pwd){ 

      System.out.println("uid == "+uid+"::::: pwd == "+pwd); 
      List<String> userDetaillist =xyzService.userLogin(uid, pwd); 
     return userDetaillist; 
    } 
} 

を次のようにWebServiceクラスがあります

@PersistenceContext 
private EntityManager em; 

私は、コンソール上で次の例外を取得しています

org.hibernate.LazyInitializationException: could not initialize proxy - no Session 

問題がCommandLinerRunnerと春ブートエンティティマネージャです。誰も私に、私たちがコマンドラインランナーを通して同じエンティティマネージャを使う方法を教えてもらえますか?

答えて

0

私はXyzServiceにSpringアノテーション@Transactionalを使用してくれました。