---
title: "Session Bean 中JNDI名称设置"
author: "linhrg"
date: "2011-10-10T15:13:15Z"
tags: ["EJB", "JBoss"]
categories: ["企业架构"]
slug: "session-bean-jndi"
draft: false
lastmod: "2011-10-10T15:13:15Z"
id: 1188720
url: "https://linhrg.iteye.com/blog/1188720"
---

首先在项目中要导入两个jar 包：jboss-ejb3.jar与jboss-annotations-ejb3.jar(jboss安装目录下：\\jboss-4.2\\server\\default\\deploy\\ejb3.deployer),

可以使用@LocalBinding和@RemoteBinding注释，例如：

```
import javax.ejb.Stateful;
import org.jboss.annotation.ejb.RemoteBinding;

@Stateful
@RemoteBinding(jndiBinding = "javaee/RemoteVisitJndi")
public class VisitAccountJndi implements VisitAccountRemote {
	public void addUser() {
		Sysotem.out.println("增加");
	}
}
```