troubleshooting Question

creating my first EJB3 and deploying it on JBOSS5

Avatar of alkasser40
alkasser40 asked on
Java EE
1 Comment1 Solution523 ViewsLast Modified:

I am trying to learn and implement EJB 3.0 with JBoss 5.
I have attached my sample code below.
I am using MyEclipse 6 IDE & JDK 6

While running client I am getting this exception :
java.lang.ClassCastException: javax.naming.Reference
      at com.sandy.PrintClient.main(

Waiting for your suggestions..

package com.sandy;
import javax.ejb.Stateless;
public class Print implements PrintRemote {
	public void display() {
		System.out.println("Printing test in EJB");
package com.sandy;
import javax.ejb.Remote;
public interface PrintRemote {
	public void display();
package com.sandy;
import java.util.Properties;
import javax.naming.InitialContext;
public class PrintClient {
	public static void main(String[] args) {
		try {
			Properties prop = new Properties();
			InitialContext ctx = new InitialContext(prop);
			Print print = (Print)ctx.lookup("Print/remote");
		} catch (Exception e) {
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros