Peter, Would you mind integrating it into the CocoonWiki (http://www.outerthought.net)? If no and it's easier for you I can do it for you.
Regards, Reinhard > -----Original Message----- > From: Hunsberger, Peter [mailto:Peter.Hunsberger@;stjude.org] > Sent: Friday, October 25, 2002 4:59 PM > To: '[EMAIL PROTECTED]' > Subject: RE: Cocoon and EJB > > > > > I have a doubt whether it is possible (and easy :) to > > > fetch data from EJB (connected to a DB) and produce > > > HTML pages from both XML/XSL documents and these data. > > > > Despite Michael Homeijer interesting answers, there were not > > many responses, and it seems to me there are never a lot when > > it comes to EJB and Cocoon. As I am also interested, is > > really nobody out there who knows much more about it...? > > > > Are there any resources available focusing on EJB and Cocoon? > > Don't know about resources, but I also don't really see what the issue is? > In our case we use JBoss with Tomcat and Cocoon. We define the EJB > resources through JBoss and don't worry about them in Cocoon. We then > package up the Cocoon WAR with our EJB JAR into a EAR and deploy it under > JBoss. With the proper JNDI definitions in JBoss all is done; your Cocoon > classes see the EJBs and away you go. It took me perhaps a week > of fiddling > to get this going, but the magic trick is to make sure you've got all the > classes in the proper places for the particular combination of Tomcat, > JBoss, JDK and Cocoon. > > Following is a summary of various messages I've found that I used > to create > some basic instructions for our developers on how to get the > whole thing up > and running. Some of this is out of date, since new binaries are now > available that did not exist when I wrote this and life is now a bit > simpler. > > How to deploy Cocoon on JBoss and Tomcat > ---------------------------------------- > > 1. Deploy tomcat/jboss. Versions 4.0/2.4.3 are apparently known > to work. We > use 4.0.4 and 2.4.4. > Note that according to the Cocoon2 homepage certain beta versions of > Tomcat dows not work with Cocoon2. > > To deploy Tomcat 4.0.4 use the integrated 2.4.4/4.0.1 Tomcat/Jboss then > copy a Tomcat 4.0.4 install over the > "catalina" directory structure in the Jboss/Tomcat install. If you do > this, I'd rename the base directory to > help keep things straight as to what is installed. > > 2. Add environment variable CATALINA_OPTS=-Xdebug -Xnoagent > -Djava.compiler=NONE > -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7070. > This is to be able to debug java run in Tomcat. For Netbeans 3.2.1 for > programming/debugging (remember to add port 7070 to debugging > environment). > > 3. Delete in "[your path]/JBoss-2.4.3_Tomcat-4.0/jboss/lib" following: > -crimson.jar > -jaxp.jar > -xml.jar > (xml.jar is not present in latest versions of JBoss.) > > If Tomcat 3.x is used the following files must be also be deleted: from > [your path]/JBoss-xxx_Tomcat-3.x/tomcat/lib: > -parser.jar > -jaxp.jar > > > 4. new run.bat file in [your path]/JBoss-2.4.3_Tomcat-4.0/jboss/bin to: > @echo off > @if not "%ECHO%" == "" echo %ECHO% > @if "%OS%" == "Windows_NT" setlocal > > set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;run.jar > > REM Add all login modules for JAAS-based security > REM and all libraries that are used by them here > > REM need one of the two following lines for xerces support > set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;../lib/xerces.jar > REM set JBOSS_CLASSPATH=$JBOSS_CLASSPATH:../lib/xml-apis.jar > > REM Add the XML parser jars and set the JAXP factory names > REM Crimson parser JAXP setup(default) > REM set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;../lib/crimson.jar > REM set > JAXP=-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson > .jaxp.Docu > men tBuilderFactoryImpl > REM set JAXP=%JAXP% > -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXPa > rserFactor > yIm pl > > echo JBOSS_CLASSPATH=%JBOSS_CLASSPATH% > java %JAXP% -classpath "%JBOSS_CLASSPATH%" org.jboss.Main %1 > %2 %3 %4 %5 > %6 %7 %8 %9 > > pause > > 5. If you want to be able to debug JBoss/Tomcat/Cocoon2 replace the last > line (before pause) with: > > java -Xint -Xdebug -Xnoagent -classpath "%JBOSS_CLASSPATH%" > -Xrunjdwp:transport=dt_socket,server=y,address=12999,suspend=n > org.jboss.Main %1 %2 %3 %4 %5 %6 %7 %8 %9 > > If you use Netbeans 3.2.1 for programming/debugging remember > to add port > 12999 to debugging environment. > > 6. copy xerces.jar to [your > path]/JBoss-2.4.3_Tomcat-4.0/jboss/lib. We used > versions 1.4.3. > Download xerces binary and use .jar file in the downloaded > xerces_xxx.zip > The Apache site suggests that you should copy xml-apis.jar from > cocoon/lib/core/ to jboss/lib. > However, I did not have to do this. If you think you need xml-apis.jar > you may also want to uncomment the > line in run.bat that refers to it and comment the line that > uses xerces. > Only one of these should be needed... > > 7. add environment variable TOMCAT_HOME=[your > path]/JBoss-2.4.3_Tomcat-4.0/catalina/ > (if a Tomcat 3.x version is used "catalina" must be substituted with > "tomcat"). > This is for use with Cocoon ant file: build.bat. > > > 8. Test that JBoss/Tomcat starts up and responds on port 8080/jboss > Contrary to some documentation the test application still works fine. > > > Cocoon and Java 1.4 configuration > --------------------------------- > > Cocoon requires more recent versions of the Xerces and Xalan > libraries than > those shipped with j2se 1.4. > To override bundled libraries, follow these steps: > > 1. Create %JAVA_HOME%\jre\lib\endorsed directory. > > 2. Copy xerces-XXX.jar, xalan-XXX.jar, and the xml-apis.jar from the > .\lib\core\ to the %JAVA_HOME%\jre\lib\endorsed\ directory. > > Due to changes in JDBC between JDK 1.3 and JDK 1.4, it is not possible to > use Cocoon built on JDK 1.3 with JDK 1.4 when it comes to database > connections. > Make sure you have a 1.4 compatible Cocoon build, or if you have > the Cocoon > source build it yourself with 1.4. > > > How to change Tomcat's Server port from 8080 to 80 using the > JBoss-2.4.4-Tomcat-4.0.1 integrated package > ------------------------------------------------------------------ > ---------- > ---------------------------- > > JBoss will NOT read the server.xml of Catalina (tomcat4). > > To change port, edit $JBOSSHOME/conf/Catalina/jboss.jcml and look for the > mbean configuration: > > <mbean code="org.jboss.web.catalina.EmbeddedCatalinaServiceSX" > name="DefaultDo > main:service=EmbeddedTomcat"/> > > then change it as follows: > > <mbean code="org.jboss.web.catalina.EmbeddedCatalinaServiceSX" > name="DefaultDo > main:service=EmbeddedTomcat"> > <attribute name="Port">80</attribute> > </mbean> > > restart JBoss (with Tomcat/Catalina). > > > Instructions for Oracle 8.1.7 and JBoss 2.4.0 > --------------------------------------------- > > Using these instructions, you can use CMP beans or connect to Oracle via: > > InitialContext context = new InitialContext(); > DataSource ds = (DataSource) context.lookup("java:/ctdb"); > > 1. Copy oracle's classes12.zip (this is available from Oracle technet,and > has the jdbc driver) to $JBOSS_DIST/lib/ext. > > 2. Note that jboss.properties does NOT need to be modified (as > indicated in > the jboss.properties file). > > 3. Modify $JBOSS_DIST/conf/tomcat/jboss.jcml: Uncomment the XidClassName > attribute shown below: > > <!-- > ==================================================================== > --> > <!-- Transactions --> > <!-- > ==================================================================== > --> > <mbean code="org.jboss.tm.TransactionManagerService" > name="DefaultDomain:service=TransactionManager"> > <attribute name="TransactionTimeout">300</attribute> > > <!-- Use this attribute if you need to use a specific Xid > implementation --> > <attribute name="XidClassName">oracle.jdbc.xa.OracleXid</attribute> > > </mbean> > > 4. Also in jboss.jcml: add the Oracle driver to the JDBC drivers (this > driver is in classes12.zip): > > <!-- > ==================================================================== > --> > <!-- JDBC --> > <!-- > ==================================================================== > --> > > <mbean code="org.jboss.jdbc.JdbcProvider" > name="DefaultDomain:service=JdbcProvider"> > <attribute > name="Drivers">org.hsql.jdbcDriver,org.enhydra.instantdb.jdbc.idbD > river,orac > le.jdbc.driver.OracleDriver</attribute> > </mbean> > > > 5. Also in jboss.jcml in the JDBC section, define what the oracle > datasource > name is (say OracleDB), and the connection URL. > In the code below, replace > jdbc:oracle:thin:@<host>:<port>:<sid> with the > appropriate string for your installation. > Such as jdbc:oracle:thin:@192.168.1.111:1521:testdb > > <mbean code="org.jboss.jdbc.XADataSourceLoader" > name="DefaultDomain:service=XADataSource,name=datasourcename"> > <attribute name="PoolName">DefaultDS</attribute> > <attribute > name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl</a > ttribute> > <attribute name="URL">jdbc:oracle:thin:@<host>:<port>:<sid></attri > bute> > <attribute name="JDBCUser">username</attribute> <!-- set correct > username here --> > <attribute name="Password">password</attribute> <!-- > set correct > password here --> > </mbean> > > or alternatively, this may be necessary: > > <mbean code="org.jboss.jdbc.XADataSourceLoader" > name="DefaultDomain:service=XADataSource,name=datasourcename"> > <attribute name="PoolName">poolname</attribute> <!-- as needed --> > <attribute > name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSource > Impl</attr > ibute> > <attribute name="Properties"></attribute> > <attribute > name="URL">jdbc:oracle:thin:@sjmemctd2:1521:ctdev2</attribute> > <attribute name="GCMinIdleTime">1200000</attribute> > <attribute name="JDBCUser">username</attribute> <!-- set correct > user name here --> > <attribute name="MaxSize">10</attribute> > <attribute name="Password">password</attribute> <!-- > set correct > password here --> > <attribute name="GCEnabled">false</attribute> > <attribute name="InvalidateOnError">true</attribute> > <attribute name="TimestampUsed">false</attribute> > <attribute name="Blocking">true</attribute> <!-- may cause > exception if set false --> > <attribute name="GCInterval">120000</attribute> > <attribute name="IdleTimeout">1800000</attribute> > <attribute name="IdleTimeoutEnabled">false</attribute> > <attribute name="LoggingEnabled">true</attribute> > <attribute name="MaxIdleTimeoutPercent">1.0</attribute> > <attribute name="MinSize">0</attribute> > </mbean> > > > 6. Modify $JBOSS_DIST/conf/tomcat/standardjaws.xml to use the proper > datasource via the <datasource> element, and to use Oracle8 jdbc-sql type > mappings. > (This is for container managed persistance.) Make sure the datasource > name matches whatever you defined for the datasource name in step 5. > > <jaws> > <datasource>java:/datasourcename</datasource > . > . > . > > --------------------------------------------------------------------- > Please check that your question has not already been answered in the > FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> > --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>