jboss + applet + ejb

L

li.fxwolf

hi experts .

When I access remote session bean from applet ,client side system
report error:


java.lang.ClassFormatError: Truncated class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveClass(Unknown
Source)
at java.io_ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io_ObjectInputStream.readClassDesc(Unknown Source)
at java.io_ObjectInputStream.readOrdinaryObject(Unknown Source)

at java.io_ObjectInputStream.readObject0(Unknown Source)
at java.io_ObjectInputStream.defaultReadFields(Unknown Source)
at java.io_ObjectInputStream.readSerialData(Unknown Source)
at java.io_ObjectInputStream.readOrdinaryObject(Unknown Source)

at java.io_ObjectInputStream.readObject0(Unknown Source)
at java.io_ObjectInputStream.readObject(Unknown Source)
at java.rmi.MarshalledObject.get(Unknown Source)
at
org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:57)

at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:637)
at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(Unknown Source)
at finance.gcontroller.LogonApplet.getDBEJBean(Unknown Source)
at finance.gcontroller.LogonApplet.init(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


following is fragment applet code:


Properties prop = new Properties();
prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
prop.setProperty(Context.PROVIDER_URL, getCodeBase().getHost());
try {


home = (testHome) PortableRemoteObject.narrow(
new
InitialContext(prop).lookup("ejb/testBean"),
testHome.class);//this row report error.
bean = home.create();


} catch (NamingException e) {


e.printStackTrace();

} catch (ClassCastException e) {


e.printStackTrace();

} catch (RemoteException e) {


e.printStackTrace();

} catch (CreateException e) {


e.printStackTrace();


}


Have anybody solved this issue .Could you help me ,or give me a
fragment code which is success access remote session bean .

thanks advance .


james.li
 
L

li.fxwolf

hi Roedy Green

thank you help me.

ClassFormatError ClassFormatError
You mangled the class file FTP upload by doing it as ASCII instead of
binary.

Further your web server must be configured to send *.class files as
binary rather than ASCII. It needs a MIME configuration entry to define
*.class files. See MIME for details.

Sometimes it is actually a CLASSPATH problem. It can't find the class.

ClassFormatError: class already loaded. You have a class file twice on
the classpath. It has nothing to do with the DLL already being loaded.
Thankfully, having a DLL still loaded from the last time you ran is not
considered an error.

ClassFormatError: bad major version. Your ancient 1.1 Java runtime does
not know what to do with a program compiled under JDK 1.4..


I don't know where find jar package about error information "at
sun.rmi.server.LoaderHandler.loadClass(Unknown Source) " in applet
archive param .

there have rt.jar in jre ,but it has 30M.It maybe not download client
side,I thank .
 
R

Roedy Green

"org.jnp.interfaces.NamingContextFactory");

hazarding a guess this file is missing or corrupt. Check the jars on
your classpath to see if it there and intact. Use Winzip Test.
 
L

li.fxwolf

Hi Roedy thank you very much .

I have solved this problem.

but I don't know how access jboss datasource from applet .

I have code which can access jboss datasource from server,but It cann't
run in applet of client side .

would you help me ?
 
R

Roedy Green

but I don't know how access jboss datasource from applet .

I have code which can access jboss datasource from server,but It cann't
run in applet of client side .

would you help me ?

You mean via JDBC?

This is not considered wise to expose your JDBC API to the universe.
Most recommend that you send messages to the server from the applet
who does the JDBC stuff for you.

I suggest you temporarily convert your Applet to an application. See
http://mindprod.com/jgloss/applet.html for now to get the security
manager off your back temporarily.

The trick is getting the correct URL to get in..

Your other problem is tunneling the proprietary protocol used by the
JDBC driver though all the firewalls and unfriendly ISPs worrying that
you are up to no good.

See if you can find out the port used, and telnet in from the client
to see if you can at least get a packet through. You won't get any
further.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,105
Latest member
sheetaldubay7750ync
Top