Applet and EJB
austinkenny Apr 11, 2005 10:27 AMI have trouble getting applets and EJBs to work?. Regarding the tutorial
http://www.huihoo.com/jboss/online_manual/3.0/ch13s21.html
Thanks to Mr. Sacha Labourey I have managed to solve some of the issues... here are the issues I have encountered to help others.
Finally I finish with the issue which is stopping my progress so far.
Firstly to help others trying to implement this Tutorial?.
I am using jboss 4.0.1
Eclipse to build my code
Running the applet via Firefox or internet explorer
AppletClient.war this contains the code for the applet and the html page.
[EjbModule] Deploying TestApplet
The applet was failing when the below line is executed?.
TestAppletHome home = (TestAppletHome)PortableRemoteObject.narrow( new InitialContext(jndiProps).lookup( "TestApplet" ),TestAppletHome.class) ;
Error message:
javax.naming.NoIntialContextExecption: Cannot instantiate class:org.jnp.interfaces.NamingContextFactory[Root execption is java.lang.ClassNotFoundExeception: org.jnp.interface.nameing ContextFactory]
All other jars associated to the tutorial have been copied to deploy directory along with jbossall-client.jar
Again Thanks to Mr. Sacha Labourey. the answer to this issue was
adding the jnp-client.jar to the AppletClient.war WAR downloaded by the applet.
Second issue:
I was denied access to socket connection because of a security issue.
I have temporarily adjusted the java.policy file in the Java\jre1.5.0_02\lib\security directory on my machine which has the client deployed on it?.giving permission to open socket connection to the server machine (please note the jboss server is a deployed on a separate machine).
permission java.net.SocketPermission "127.0.0.1:1098-", "accept, connect, listen, resolve";
This solved the security issue (TEMPORY) as this will mean every client machine will have to change there java.policy file to run the applet?. users can't be asked to do this.
This is the issue where I am now stuck:
I know that the machine that has JBOSS running and the TestApplet EJB deployed is listening to the 1098 port because I executed the command netstat:
Performing the netstat ?a command returns:
tcp6 0 0 *:1098 *:* LISTEN
yet the return from the applet is as follows:
javax.naming.CommunicationExecption [Root execption is java.rmi.ConnectionExecption: Connection refused to host 127.0.0.1; nested execption is: java.net.ConnectionExecption: Connection refused: connect]
Can any one help?
Regards
Austin Kenny
kennyau@cs.tcd.ie
Trinity College Dublin
Knowledge Data Engineering Group