John Topley’s Weblog

JDeveloper, Apache And MIME Types

I've just got to the bottom of a fairly obscure problem that occurs when using Mozilla Firefox to access a web application developed using Oracle JDeveloper. The JSPs in my application link to an external stylesheet, but the pages weren't styled when viewed using a Gecko-based browser, such as Firefox. However, they were fine when using Internet Explorer or Opera.

Changing to an inline stylesheet declaration fixed the problem, which suggested that there might have been something about my external stylesheet declaration that Firefox didn't like:

<link rel="stylesheet" type="text/css" href="../../../../webforum/assets/css/webforum.css.html" />

—There's nothing out of the ordinary there. Using the JavaScript Console in Firefox showed that the error was occurring because the CSS file was being served with a MIME type of application/octet-stream instead of text/css:

Click to enlarge.
A picture of the Mozilla Firefox JavaScript console showing the error

—This opened up another avenue of investigation. JDeveloper includes a cut-down, embedded version of Oracle's OC4J J2EE application server. This enables J2EE components and web applications to be run from within the IDE. I know that OC4J uses Apache as its web server, which led me to suspect that I was dealing with an Apache configuration problem and not a JDeveloper or OC4J problem. I sniffed around in the configuration directory for the embedded container and found a file named mime.types, which seemed a likely candidate for modification. I added the line:

text/css    css

…restarted the application and all was now well. I could admire the results of my beautiful stylesheet in Firefox and marvel at how different it looked from IE.

According to a message on the Oracle Technology Network JDeveloper forum, this quirk is still present in the latest JDeveloper release. For the benefit of other developers with this problem who want to work around it, simply download this mime.types file from my standalone Apache 1.3 installation and overwrite the existing file in:

<JDEVHOME>/jdev/systemX.X.X.X.XXXX/oc4j-config

—for the embedded OC4J server, or:

<JDEVHOME>/j2ee/home/config

—for the standalone server. Job done!

Comments

There is 1 comment on this post. Comments are closed.

  • avatar kathya
    18 March 2005 at 00:14

    Hi John, I was just facing the same problem :). Thanks to you /and google/ I've saved some time.. Thanks!

I could admire the results of my beautiful stylesheet in Firefox and marvel at how different it looked from IE.


Archives

  • Jan
  • Feb
  • Mar
  • Apr
  • May
  • Jun
  • Jul
  • Aug
  • Sep
  • Oct
  • Nov
  • Dec
  • 2019
  • 2018
  • 2017
  • 2016
  • 2015
  • 2014

More Archives


Sign In