geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Why naming service is not available when Servlet is initializing?(Tomcat 5.5.9)
Date Fri, 04 Nov 2005 07:43:39 GMT
There are some problems with your plans.  There are several ways to  
solve them, I'm going to recommend this one: it is most appropriate if  
you are planning to eventually include more content in your ear than  
just jetspeed.war.  If all additional content will be in other  
applications, then there is no need for an ear at all; you can have  
both modules as ext-modules and just supply the plan.  I've included  
updates from one of your other replies, which indicate that you had a  
lot fewer errors than I thought at first :-)

A couple of comments first:

1. the tranql connector is already included in geronimo, so you don't  
really need to include it in your ear all over again.
2. It is best to include information for all modules in the ear in the  
application plan.  This is not essential (I think) but a best practice.
3. The only plans included in an ear that are used are in the META-INF  
or WEB-INF of the application or module.  thus the oracle-plan.xml  
would be ignored.
4. if you name the datasource jdbc/jetspeed rather than  
ORACLE_DATASOURCE then you can leave out the resource-link mapping  
completely.

I prefer the j2ee 1.4 style of supplying the plan as a separate file  
from the application.

For you experiments I recommend setting up a project similar to  
sandbox/daytrader/modules/derby.  This will let you refresh your  
geronimo copy, deploy jetspeed, run geronimo, etc etc with a single  
maven command line.


<application
        xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
        configId="org/apache/jetspeed">
     <!-- these dependencies must be kept here so that their classes are  
loaded in the "EARs" classloader. -->
     <dependency>
         <groupId>portlet-api</groupId>
         <artifactId>portlet-api</artifactId>
         <version>1.0</version>
     </dependency>
     <dependency>
         <groupId>org.apache.pluto</groupId>
         <artifactId>pluto</artifactId>
         <version>1.0.1</version>
     </dependency>
     <dependency>
         <groupId>jetspeed2</groupId>
         <artifactId>jetspeed-api</artifactId>
         <version>2.0-M4-SNAPSHOT</version>
     </dependency>
     <dependency>
         <groupId>jetspeed2</groupId>
         <artifactId>jetspeed-commons</artifactId>
         <version>2.0-M4-SNAPSHOT</version>
     </dependency>
     <dependency>
         <groupId>portals-bridges</groupId>
         <artifactId>portals-bridges-common</artifactId>
         <version>0.4-SNAPSHOT</version>
     </dependency>
     <module>
         <web>jetspeed.war</web>
<web-app xmlns="http://geronimo.apache.org/xml/ns/web"  
configId="org/apache/jetspeed/web">
<!-- are you sure about this setting? -->
     <context-priority-classloader>true</context-priority-classloader>
<!--  by changing the name to jdbc/jetspeed you can let geronimo find  
the datasource without a link
     <resource-ref>
         <ref-name>jdbc/jetspeed</ref-name>
         <resource-link>jdbc/jetspeed</resource-link>
     </resource-ref>
-->
</web-app>
     </module>
<!-- by using ext-module you can use the existing copy of the tranql  
connector-->
     <ext-module>
         <connector>org/apache/jetspeed/datasource</connector>
          
<external-path>tranql/rars/tranql-connector-1.0-SNAPSHOT.rar</external- 
path>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector"  
configId="OracleDatabase" parentId="org/apache/geronimo/Server">
     <dependency>
         <uri>oracle/jars/classes12-10gr2.jar</uri>
     </dependency>
     <resourceadapter>
         <outbound-resourceadapter>
             <connection-definition>
                  
<connectionfactory-interface>javax.sql.DataSource</connectionfactory- 
interface>
                 <connectiondefinition-instance>
                     <name>jdbc/jetspeed</name>
                     <config-property-setting  
name="UserName">JETSPEED2_PRODUCTION</config-property-setting>
                     <config-property-setting  
name="Password">PRODUCTION</config-property-setting>
                     <config-property-setting  
name="Driver">oracle.jdbc.driver.OracleDriver</config-property-setting>
                     <config-property-setting  
name="ConnectionURL">jdbc:oracle:thin:@pek-wkst116:1521:orcl</config- 
property-setting>
                     <config-property-setting  
name="CommitBeforeAutocommit">false</config-property-setting>
                     <config-property-setting  
name="ExceptionSorterClass">org.tranql.connector.NoExceptionsAreFatalSor 
ter</config-property-setting>
                     <connectionmanager>
                         <local-transaction/>
                         <single-pool>
                             <max-size>100</max-size>
                             <min-size>0</min-size>
                              
<blocking-timeout-milliseconds>10000</blocking-timeout-milliseconds>
                              
<idle-timeout-minutes>30</idle-timeout-minutes>
                             <match-one/>
                         </single-pool>
                     </connectionmanager>
                 </connectiondefinition-instance>
             </connection-definition>
         </outbound-resourceadapter>
     </resourceadapter>
</connector>
     </ext-module>
</application>

Hope this helps,
david jencks



On Nov 3, 2005, at 11:14 PM, Jian Liao wrote:

> Thanks for respond.
>  The directory structural:
>
>  jetspeed.ear
>  |
>  |------META-INF
>  |            |-----------geronimo-application.xml
>  |            |-----------application.xml
>  |
>  |------tranql-connector-1.0-SNAPSHOT.rar
>  |------oracle-plan.xml
>  |------jetspeed.war
>               
>  jetspeed.war
>  |
>  |
>  |------WEB-INF
>               |----------web.xml
>               |----------geronimo-web.xml
>  (.......)   
>
>  I've replaced config.xml with config.tomcat.xml.
>
>  The following are all of my  plans:
>   
>  =====================oracle-plan.xml=============================
>  <?xml version="1.0"?>
>  <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector"  
> configId="OracleDatabase" parentId="org/apache/geronimo/Server">
>      <dependency>
>          <uri>oracle/jars/classes12-10gr2.jar</uri>
>      </dependency>
>      <resourceadapter>
>          <outbound-resourceadapter>
>              <connection-definition>
>                   
> <connectionfactory-interface>javax.sql.DataSource</connectionfactory- 
> interface>
>                  <connectiondefinition-instance>
>                      <name>OracleDataSource</name>
>                      <config-property-setting  
> name="UserName">JETSPEED2_PRODUCTION</config-property-setting>
>                      <config-property-setting  
> name="Password">PRODUCTION</config-property-setting>
>                      <config-property-setting  
> name="Driver">oracle.jdbc.driver.OracleDriver</config-property- 
> setting>
>                      <config-property-setting  
> name="ConnectionURL">jdbc:oracle:thin:@pek-wkst116:1521:orcl</config- 
> property-setting>
>                      <config-property-setting  
> name="CommitBeforeAutocommit">false</config-property-setting>
>                      <config-property-setting  
> name="ExceptionSorterClass">org.tranql.connector.NoExceptionsAreFatalSo 
> rter</config-property-setting>
>                      <connectionmanager>
>                          <local-transaction/>
>                          <single-pool>
>                              <max-size>100</max-size>
>                              <min-size>0</min-size>
>                               
> <blocking-timeout-milliseconds>10000</blocking-timeout-milliseconds>
>                               
> <idle-timeout-minutes>30</idle-timeout-minutes>
>                              <match-one/>
>                          </single-pool>
>                      </connectionmanager>               
   
>                  </connectiondefinition-instance>
>              </connection-definition>
>          </outbound-resourceadapter>
>      </resourceadapter>
>  </connector>
>
>  =================geronimo-application.xml========================
>  <?xml version="1.0"?>
>  <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector"  
> configId="OracleDatabase" parentId="org/apache/geronimo/Server">
>      <dependency>
>          <uri>oracle/jars/classes12-10gr2.jar</uri>
>      </dependency>
>      <resourceadapter>
>          <outbound-resourceadapter>
>              <connection-definition>
>                   
> <connectionfactory-interface>javax.sql.DataSource</connectionfactory- 
> interface>
>                  <connectiondefinition-instance>
>                      <name>OracleDataSource</name>
>                      <config-property-setting  
> name="UserName">JETSPEED2_PRODUCTION</config-property-setting>
>                      <config-property-setting  
> name="Password">PRODUCTION</config-property-setting>
>                      <config-property-setting  
> name="Driver">oracle.jdbc.driver.OracleDriver</config-property- 
> setting>
>                      <config-property-setting  
> name="ConnectionURL">jdbc:oracle:thin:@pek-wkst116:1521:orcl</config- 
> property-setting>
>                      <config-property-setting  
> name="CommitBeforeAutocommit">false</config-property-setting>
>                      <config-property-setting  
> name="ExceptionSorterClass">org.tranql.connector.NoExceptionsAreFatalSo 
> rter</config-property-setting>
>                      <connectionmanager>
>                          <local-transaction/>
>                          <single-pool>
>                              <max-size>100</max-size>
>                              <min-size>0</min-size>
>                               
> <blocking-timeout-milliseconds>10000</blocking-timeout-milliseconds>
>                               
> <idle-timeout-minutes>30</idle-timeout-minutes>
>                              <match-one/>
>                          </single-pool>
>                      </connectionmanager>               
   
>                  </connectiondefinition-instance>
>              </connection-definition>
>          </outbound-resourceadapter>
>      </resourceadapter>
>  </connector>
>
>  ==================geronimo-web.xml========================
>  <?xml version="1.0"?>
>  <web-app xmlns="http://geronimo.apache.org/xml/ns/web"  
> configId="org/apache/jetspeed" parentId="OracleDatabase">   
>      <context-priority-classloader>true</context-priority-classloader>
>      <resource-ref>
>          <ref-name>jdbc/jetspeed</ref-name>
>          <resource-link>OracleDataSource</resource-link>
>      </resource-ref>   
>  </web-app>
>
>  ====================application.xml========================
>  <application
>         xmlns="http://java.sun.com/xml/ns/j2ee"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>         http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
>         version="1.4">   
>      <module>
>          <web>
>              <web-uri>jetspeed.war</web-uri>
>              <context-root>/jetspeed</context-root>
>          </web>
>      </module>
>      <module>
>          <connector>tranql-connector-1.0-SNAPSHOT.rar</connector>
>      </module>
>  </application>
>
>
>  -James Liao
>
>
> On 11/4/05, David Jencks <david_jencks@yahoo.com> wrote:
>> up something like java:comp/env/jdbc/jetspeed and either deploy a
>> datasource "named" jdbc/jetspeed or map it to whatever the datasource
>> is named.
>>
>> If you are deploying the datasource in the same plan as j2 (I  
>> recommend
>> doing this) you need to use geronimo head because the appropriate
>> dependencies to force the correct start order were only added last
>> week.
>>
>> If you are still having problems please show us your geronimo plan.
>>
>> thanks
>> david jencks
>>
>> On Nov 3, 2005, at 10:35 PM, Jian Liao wrote:
>>
>> > Sorry, I forgot to tell Jetspeed 2 work perfectly with tomcat 5.5.9
>> > standalone. Because Tomcat5.5.9 use its own naming services with
>> > useNaming = true by default. I saw that Geronimo disable it in
>> > TomcatContainer.doStart() with embedded.setUseNaming(false).
>>  >
>> >  - James Liao
>> >
>> > On 11/4/05, Jian Liao <norwaywoods@gmail.com> wrote:
>> >>
>> >>  - James Liao
>> >>
>> >>
>> >> On 11/4/05, Bruce Snyder < bruce.snyder@gmail.com>
>> >> wrote:norwaywoods@gmail.com> wrote:
>> >>> > All,
>> >>> >I'm trying to integrate jetspeed 2 with geronimo(svn head) and
>> >>> tomcat-5.5.9
>> >>> > as web container.
>> >>> >The deployment is successful. But Jetspeed will initialize OJB in
>> >>> > JetspeedServlet.init() method which needs to obtain resource
>> >>> jdbc/jetspeed
>> >>> > through JNDI. It just can not get it cause the context is never
>> >>> bind to the
>> >>> > thread.
>> >>> >
>> >>> >I try it with Jetty and it works because
>> >>> ComponentContextBeforeAfter is
>> >>> > called.
>> >>> >
>> >>> >I am wondering if I am not allowed to do any JNDI operation in
>> >>> > Servlet.init ()?
>>  >>>
>> >>> Have you tried this in Tomcat running standalone? When you tried  
>> it
>> >>> with Jetty, was Jetty running standalone or within Geronimo?
>> >>>
>> >>> Bruce
>> >>> --
>> >>> perl -e 'print
>> >>>  
>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >>> );'
>> >>>
>> >>> The Castor Project
>> >>> http://www.castor.org/
>> >>>
>> >>> Apache Geronimo
>> >>>  http://geronimo.apache.org/
>> >>
>>


Mime
View raw message