jakarta-bsf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nils Lastein" <...@bioteknologisk.dk>
Subject Running BSF with jython in Tomcat
Date Fri, 10 Oct 2003 14:16:40 GMT
Hi

I'm aiming at running the JSP-aplications embedded with jython using BSF 
(Bean Scripting Framework) Jakarta Tomcat server with 

- Installed Sun Java SDK 
java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)

- Installled a precompiled version of Jakarta Tomcat 5.0.12

- Installed jython 2.1 and placed jython.jar in 
${CATALINA_HOME}/webapps/jython/WEB-INF/lib/ and modified web.xml 
(PyServlet.)

Now I'm able to execute jython (*.py-files) inside the Jakarta Tomcat 
server nicely. But in order to make web development easier it would be 
nice to execute Jython-code server-side embedded - and this is where BSF 
becomes handy.

So I:
- fetched BSF from: http://cvs.apache.org/dist/jakarta/bsf/v2.3.0rc1/bin/bsf-bin-2.3.0.tar.gz
and placed the bsf.jar in WEB-INF/lib
- fetched BSF Jakarta Taglibs from http://cvs.apache.org/builds/jakarta-taglibs/nightly/projects/bsf/jakarta-taglibs-bsf-20031010.tar.gz
and copied the taglibs-bsf.jar to 
${CATALINA_HOME}/webapps/jython/WEB-INF/lib and the taglibs-bsf.tld to 
${CATALINA_HOME}/webapps/jython/WEB-INF

My web.xml file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app> 
  <taglib>
    <taglib-uri>http://jakarta.apache.org/taglibs/bsf-2.0</taglib-uri>
    <taglib-location>/WEB-INF/taglibs-bsf.tld</taglib-location>
  </taglib>
  <servlet>
    <servlet-name>PyServlet</servlet-name>
    <servlet-class>org.python.util.PyServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <init-param>
      <param-name>python.home</param-name>
      <param-value>/usr/bin/jython-2.1</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>PyServlet</servlet-name>
    <url-pattern>*.py</url-pattern>
  </servlet-mapping>
</web-app>

My foo.jsp-file:
<%@ page language="jython" %>
<% out.print("Hello from Jython")%>

which responds: 
org.apache.jasper.JasperException: /foo.jsp(1,1) Page directive: invalid 
language attribute

and my bar.jsp:
<%@ taglib uri="/WEB-INF/taglibs-bsf.tld" prefix="bsf" %>
<bsf.scriptlet language="jython">
        out.print("hello from jython")
</bsf.scriptlet>

which doesn't becomes parsed and this prints the source code:
<bsf.scriptlet language="jython">
                 out.print("hello from jython")
</bsf.scriptlet>

Jakarta Tomcats starts up with any errors (from catalina.out) and 
processes the jar-files:
*sys-package-mgr*: processing new jar, 
'/home/foo/jakarta2/bin/bootstrap.jar'
*sys-package-mgr*: processing new jar, 
'/home/foo/jakarta2/common/endorsed/xercesImpl.jar'
*sys-package-mgr*: processing new jar, 
'/home/foo/jakarta2/common/endorsed/xmlParserAPIs.jar'
*sys-package-mgr*: processing new jar, 
'/home/foo/jakarta2/webapps/jython/WEB-INF/lib/bsf.jar'
*sys-package-mgr*: processing new jar, 
'/home/foo/jakarta2/webapps/jython/WEB-INF/lib/jython.jar'
*sys-package-mgr*: processing new jar, 
'/home/foo/jakarta2/webapps/jython/WEB-INF/lib/taglibs-bsf.jar'

What prevents my from success?

Nils

---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-user-help@jakarta.apache.org


Mime
View raw message