-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: working with ejb3 in eclipse
PostPosted: Wed Jun 28, 2006 3:31 am 
Beginner
Beginner

Joined: Tue Jan 17, 2006 6:16 am
Posts: 31
fierst of all sorry for my english :).
1.Eclipse Version: 3.1.0
2.jboss-4.0.4.GA
3.Ejb 3.0

there is my simple example :
1.Remote Interface
Code:
package org.jboss.tutorial.stateless.bean;

import javax.ejb.Remote;

@Remote
public interface CalculatorRemote {
   public int add(int x, int y);
   public int subtract(int x, int y);
}

2.Local Interface
Code:
package org.jboss.tutorial.stateless.bean;
import javax.ejb.Local;

@Local
public interface CalculatorLocal extends CalculatorRemote
{
   public int add(int x, int y);
   public int subtract(int x, int y);
}

3.Bean
Code:
package org.jboss.tutorial.stateless.bean;
import javax.ejb.Stateless;
import org.jboss.tutorial.stateless.bean.CalculatorRemote;

public @Stateless
class CalculatorBean implements CalculatorRemote {
   public int add(int x, int y) {
      return x + y;
   }
   public int subtract(int x, int y) {
      return x - y;
   }
}

4. and Client
Code:
package org.jboss.tutorial.stateless.client;

import org.jboss.tutorial.stateless.bean.CalculatorRemote;
import javax.naming.InitialContext;

public class Client
{
   public static void main(String[] args) throws Exception
   {
      InitialContext ctx = new InitialContext();
      CalculatorRemote calculator = (CalculatorRemote) ctx.lookup("CalculatorBean/remote");
      System.out.println("1 + 1 = " + calculator.add(1, 1));
      System.out.println("1 - 1 = " + calculator.subtract(1, 1));
   }
}



then in eclipse ide i did project jar file using export and copy it in the
jboss_home/server/all/deploy folder
then start jboss from eclipse
when i'm running client a get an error like that :

Code:
Exception in thread "main" javax.naming.NameNotFoundException: CalculatorBean not bound



is there enything wrong ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 03, 2006 2:23 pm 
Regular
Regular

Joined: Wed Jan 11, 2006 12:49 pm
Posts: 64
Location: Campinas, Brazil
This is not really a Hibernate question, but since I am not such a bastard I'll give you a hint anyway. JBoss prepends the EAR file name to the session's JNDI; so if your EAR file is named YourEar.ear, the JNDI name is "YourEar/CalculatorBean/remote".
Try checking the stack trace next time so you will know where you can get a better or quickier answer ;-)

_________________
Henrique Sousa
Don't forget to rate useful responses


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.