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 / General / February 2006

Tip: Looking for answers? Try searching our database.

jboss + applet + ejb

Thread view: 
li.fxwolf@gmail.com - 12 Feb 2006 10:15 GMT
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
Roedy Green - 12 Feb 2006 11:55 GMT
On 12 Feb 2006 02:15:59 -0800, "li.fxwolf@gmail.com"
<li.fxwolf@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>java.lang.ClassFormatError: Truncated class file

see
http://mindprod.com/jgloss/runerrormessages.html#CLASSFORMATERROR
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

li.fxwolf@gmail.com - 12 Feb 2006 13:42 GMT
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 .
Roedy Green - 12 Feb 2006 16:39 GMT
On 12 Feb 2006 02:15:59 -0800, "li.fxwolf@gmail.com"
<li.fxwolf@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>"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.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

li.fxwolf@gmail.com - 13 Feb 2006 13:24 GMT
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 ?
Roedy Green - 13 Feb 2006 14:21 GMT
On 13 Feb 2006 05:24:05 -0800, "li.fxwolf@gmail.com"
<li.fxwolf@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>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.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



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.