aspose file tools
The moose likes Applets and the fly likes Why does getCodeBase return null? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "Why does getCodeBase return null?" Watch "Why does getCodeBase return null?" New topic
Author

Why does getCodeBase return null?

Baijun Jiang
Greenhorn

Joined: Oct 13, 2005
Posts: 17
Hi. I have an applet invoked by a jsp page.

<APPLET height=500 width=900
code="applet/trend/trendchart">
</APPLET>

I got this this error:

java.lang.NullPointerException
at java.applet.Applet.getCodeBase(Unknown Source)
at applet.trend.trendchart.getServletConnection(trendchart.java:212)
...

in what kind of situation getCodeBase() can return a null value?


SCEA, CISA.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35224
    
    7
The javadocs don't mention that it could or should ever return null.

Are you running this on a web server, via appletviewer or are you opening a local HTML file?


Android appsImageJ pluginsJava web charts
Baijun Jiang
Greenhorn

Joined: Oct 13, 2005
Posts: 17
I am running it on a tomcat server.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35224
    
    7
Loooking at it again I notice that it doesn't actually return null, it has an internal NPE. I'm surprised it works at all with the "applet/trend/trendchart"; that should contain dots, not slashes.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Why does getCodeBase return null?
 
Similar Threads
Icons not visible in applet
getCodeBase() supported in OBJECT tag?
replacement for applets
URL is not a String ???
null pointer