Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / February 2006

Tip: Looking for answers? Try searching our database.

Client of an EJB deployed in JBoss

Thread view: 
Goom - 08 Feb 2006 19:02 GMT
Hello All,

I hope someone has come across this before and were successfull solving
it or someone has ideas on how to solve it.

Got context
javax.naming.CommunicationException [Root exception is
java.io.InvalidClassException:
org.jboss.invocation.MarshallingInvokerInterceptor; unable to create
instance]

Process finished with exit code 0

The above is the output that I get when I try to run the file below. I
guess IntelliJ runs the following command.

"C:\Program Files\Java\jdk1.5.0_02\bin\java" -Didea.launcher.port=7534
"-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA
5.0\bin" -Dfile.encoding=windows-1252 -classpath "C:\Program
Files\Java\jdk1.5.0_02\jre\lib\charsets.jar;C:\Program
Files\Java\jdk1.5.0_02\jre\lib\deploy.jar;C:\Program
Files\Java\jdk1.5.0_02\jre\lib\javaws.jar;C:\Program
Files\Java\jdk1.5.0_02\jre\lib\jce.jar;C:\Program
Files\Java\jdk1.5.0_02\jre\lib\jsse.jar;C:\Program
Files\Java\jdk1.5.0_02\jre\lib\plugin.jar;C:\Program
Files\Java\jdk1.5.0_02\jre\lib\rt.jar;C:\Program
Files\Java\jdk1.5.0_02\jre\lib\ext\dnsns.jar;C:\Program
Files\Java\jdk1.5.0_02\jre\lib\ext\localedata.jar;C:\Program
Files\Java\jdk1.5.0_02\jre\lib\ext\sunjce_provider.jar;C:\Documents and
Settings\alphjoh\IdeaProjects\EJBProject\classes;C:\Program
Files\jboss-4.0.3SP1\server\default\lib\jboss-j2ee.jar;C:\Program
Files\jboss-4.0.3SP1\server\default\lib\javax.servlet.jsp.jar;C:\Program
Files\jboss-4.0.3SP1\server\default\lib\javax.servlet.jar;C:\Program
Files\jboss-4.0.3SP1\client\jboss-client.jar;C:\Program
Files\jboss-4.0.3SP1\client\jboss-j2ee.jar;C:\Program
Files\jboss-4.0.3SP1\client\log4j.jar;C:\Program
Files\jboss-4.0.3SP1\lib\jboss-common.jar;C:\Program
Files\jboss-4.0.3SP1\client\jnp-client.jar;C:\Program
Files\JetBrains\IntelliJ IDEA 5.0\lib\idea_rt.jar"
com.intellij.rt.execution.application.AppMain Client

/**
* Created by IntelliJ IDEA.
* User: alphjoh
* Date: 08-Feb-2006
* Time: 15:04:10
* To change this template use File | Settings | File Templates.
*/
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import java.util.Properties;

public class Client {

 public static void main(String[] args) {

   // preparing properties for constructing an InitialContext object
   Properties properties = new Properties();
   properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
   properties.put("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");
   properties.put(Context.PROVIDER_URL, "localhost:1099");

   try {
     // Get an initial context
     InitialContext jndiContext = new InitialContext(properties);
     System.out.println("Got context");

     // Get a reference to the Bean
     Object ref  = jndiContext.lookup("MathEJB");
     System.out.println("Got reference");

     // Get a reference from this to the Bean's Home interface
     MathHome home = (MathHome)
       PortableRemoteObject.narrow (ref, MathHome.class);

     // Create an Adder object from the Home interface
     Math m = home.create();
     System.out.println (m.getSquare(5));
   }
   catch(Exception e) {
     System.out.println(e.toString());
   }
 }
}

Thanks very much,

Johny
Goom - 13 Feb 2006 21:04 GMT
I figured this one out. For the client program, I had the files
log4j.jar, jboss-common.jar, jnp-client.jar and jboss-client.jar in my
classpath. Just remove all the jars and only add jbossall-client.jar in
the classpath.

Johny


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.