[jboss-user] [JNDI and Naming] - JBoss6 - JNDI - Remoting

Michael Müller do-not-reply at jboss.com
Thu Apr 28 03:15:16 EDT 2011


Michael Müller [http://community.jboss.org/people/sirwayne] created the discussion

"JBoss6 - JNDI - Remoting"

To view the discussion, visit: http://community.jboss.org/message/602445#602445

--------------------------------------------------------------
Hello community,

i have some question how i can use RMI and JNDI with SessionScopes?
I get always a error on the client side the weld context is no active: I use JBoss6.

Here my example on Serverside:

Interfaces:
{code} 
@Remote
public interface ContractRemoteService{

     Set<String> getContracts();

}

{code}

{code}
@Remote
public interface LoginRemoteService{
     public void login(String name)
}
{code}

Impl
{code}

@Stateful
public class ContractRemoteServiceImpl implements ContractRemoteService{

@Inject
private UserBean userBean;

@Overide
public Set<String> getContracts(){
     Set<String> contracts = new HashSet<String>();
     contracts.add(&quot;contract1&quot;);
     contracts.add(&quot;contract2&quot;);

     if(userBean.getName().equals(&quot;test&quot;)){
     contracts.add(&quot;contract3&quot;);
     }
     return contracts;
}

}
{code}

{code}
@Stateful
public class LoginRemoteServiceImpl implements LoginRemoteService{

@Inject
private UserBean user;

     @Override
     public void login(String name){
         user.setName(name);
     }
}
{code}

Bean
{code}
@Stateful
@SessionScoped
public class UserBean{

private String name;

public setName(String name){
     this.name = name;
}

public String getName(){
     return name;
}

}
{code}

The client side:
{code}
public class Client{

public static void main(String [] args) throws Exceptions{
     Context context = new InitialContext();
     LoginRemoteService loginService = (LoginRemoteService) context.lookup(&quot;LoginRemoteServiceImpl/remote&quot;);
     ContractRemoteService contractService = (ContractRemoteService) context.lookup(&quot;ContractRemoteServiceImpl&quot;);
     loginService.login(&quot;Mhm?&quot;);
     contractSerive.getContracts();// autsch
}
}
{code}
Error Message:

WELD-001303 no active contexts for scope javax.enterprise.context.SessionScoped

How can i activate the Context?

Thanks =)
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/602445#602445]

Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110428/e7829611/attachment-0001.html 


More information about the jboss-user mailing list