title: Weblogic CGIServlet NoClassDefFoundError
body: <p>I'm trying to configure CGI Servlet in weblogic. I have a simple war to test it. I have nothing special in web.xml, just a simple config:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;CGIServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;weblogic.servlet.CGIServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;cgiDir&lt;/param-name&gt;
          &lt;param-value&gt;/tmp/scripts&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;*.py&lt;/param-name&gt;
          &lt;param-value&gt;/usr/bin/python&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;CGIServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/config/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>and in server.xml</p>
  
  <pre><code>&lt;prefer-web-inf-classes&gt;false&lt;/prefer-web-inf-classes&gt;
  </code></pre>
  
  <p>When I try to access localhost/cgitest/config/test.py
  I'm getting an exception in logs of the server:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: Could not initialize class weblogic.servlet.Env 
  at weblogic.servlet.CGIServlet.init(CGIServlet.java:72)
  </code></pre>
  
  <p>As I see, weblogic.servlet.Env is a part of weblogic.jar and it is present in the lib folder of the server. Maybe the server is somehow misconfigured. (WebLogic Server Version: 12.1.1.0)</p>
  
  <p>I would appreciate any hints on finding the issue behind this. Thanks.</p>