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