geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lin Sun" <linsun....@gmail.com>
Subject RE: unable to run a simple jsp application
Date Thu, 08 Jun 2006 02:15:01 GMT
I can help writing the contents of the wiki page (Using the upgrader tool)
if Hernan can tell me where I should put it.

Lin

-----Original Message-----
From: David Jencks [mailto:david_jencks@yahoo.com] 
Sent: Wednesday, June 07, 2006 3:58 PM
To: user@geronimo.apache.org
Subject: Re: unable to run a simple jsp application


On Jun 7, 2006, at 12:51 PM, Lin Sun wrote:

> Hi David,
>
> Thanks so much - that did solve the prob!
>
> My 1.0 plan has:
>
> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/ 
> connector-1.0"
>   configId="EmployeeDatasource"
>   parentId="geronimo/j2ee-server/1.0/car">
>
>   <dependency>
>     <uri>org.apache.derby/derby/10.1.1.0/jar</uri>
>   </dependency>
>   <dependency>
>     <uri>org.apache.derby/derbynet/10.1.1.0/jar</uri>
>   </dependency>

IIRC correctly that only worked in 1.0 because we put the derby jars  
into the wrong configuration, rmi-naming I think, which was in the  
defaultParentId of everything.  If they had been where they belonged  
in the system-database config you would have had the same problem in  
1.0.

I might be making this up though.

> ...
>
> After I ran the upgrader tool:
> ...
>     <dep:moduleId>
>       <dep:groupId>default</dep:groupId>
>       <dep:artifactId>EmployeeDatasource</dep:artifactId>
>       <dep:version>1-default</dep:version>
>       <dep:type>car</dep:type>
>     </dep:moduleId>
>     <dep:dependencies>
>       <dep:dependency>
>         <dep:groupId>geronimo</dep:groupId>
>         <dep:artifactId>j2ee-server</dep:artifactId>
>         <dep:version>1.0</dep:version>
>         <dep:type>car</dep:type>
>       </dep:dependency>
>       <dep:dependency>
>         <dep:groupId>org.apache.derby</dep:groupId>
>         <dep:artifactId>derby</dep:artifactId>
>         <dep:version>10.1.1.0</dep:version>
>         <dep:type>jar</dep:type>
>       </dep:dependency>
>       <dep:dependency>
>         <dep:groupId>org.apache.derby</dep:groupId>
>         <dep:artifactId>derbynet</dep:artifactId>
>         <dep:version>10.1.1.0</dep:version>
>         <dep:type>jar</dep:type>
>       </dep:dependency>
>     </dep:dependencies>
> ...
>
> I think most of the users will hit the same problem as I did when  
> using the
> upgrader tool to upgrade the server wide datasource.  It would be  
> great if
> the upgrader tool could address this.

I think it would be more time effective to have a wiki page outlining  
the most common problems and their likely solutions.  I doubt I'm  
even going to get to setting that up :-(

thanks
david jencks

>
> Regarding the daytrader plan, I did look at the plan in the target
> directory.   I was searching for org.apache.derby and it didn't return
> anything.:-(  The dependencies were inside of the embedded  
> datasource plan
> in 1.0 but now it is moved up to the top of the plan so I missed  
> them too:-(
>
> Lin
>
> -----Original Message-----
> From: David Jencks [mailto:david_jencks@yahoo.com]
> Sent: Wednesday, June 07, 2006 3:14 AM
> To: user@geronimo.apache.org
> Subject: Re: unable to run a simple jsp application
>
>
> On Jun 6, 2006, at 8:13 PM, Lin Sun wrote:
>
>> Hi Stan,
>>
>> You are right, the classloader in 1.1 seems to change a lot.   So I
>> went
>> back to the datasource plan, and I had the following as dependencies:
>>
>>             <dep:dependency>
>>                 <dep:groupId>org.apache.derby</dep:groupId>
>>                 <dep:artifactId>derby</dep:artifactId>
>>                 <dep:version>10.1.1.0</dep:version>
>>                 <dep:type>jar</dep:type>
>>             </dep:dependency>
>
> This is your problem, this loads a second copy of derby in a second
> classloader: as Stanley reminded me this causes problems.  Instead
> you need a car dependency on system-datasource so you are sharing
> it's copy of derby.
>
>
>              <dep:dependency>
>                  <dep:groupId>geronimo</dep:groupId>
>                  <dep:artifactId>system-database</dep:artifactId>
>                 <dep:type>car</dep:type>
>              </dep:dependency>
>
>>             <dep:dependency>
>>                 <dep:groupId>org.apache.derby</dep:groupId>
>>                 <dep:artifactId>derbynet</dep:artifactId>
>>                 <dep:version>10.1.1.0</dep:version>
>>                 <dep:type>jar</dep:type>
>>             </dep:dependency>
>
> This is in the system-database classloader also so you can omit it.
> In general you should leave out versions so they can be resolved by
> geronimo and upgraded later.
>>
>> First I tried to comment out both of them, but I got a "
>> java.lang.NoClassDefFoundError: org/apache/derby/jdbc/
>> EmbeddedXADataSource"
>> from tranql.  Then I only commented out the derbynet jar and
>> redeployed
>> everything.   Still got the same exception.
>>
>> I looked over the derby datasource section of the daytrader plan,
>> and it
>> didn't have any org.apache.derby dependencies.  I don't understand
>> that even
>> though the daytrader uses an application scoped datasource.   But I
>> haven't
>> been able to get daytrader running yet.
>
> Where are you looking?  You need to look in the target directory of
> the config, or the project.xml of the config subproject.  The
> geronimo packaging plugin inserts the dependencies into the plan
> based on marked dependencies in the project.xml.  So, for instance,
> the daytrader jetty plan starts like this, including a dependency on
> system-datasource such as I recommend above:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <application xmlns="http://geronimo.apache.org/xml/ns/j2ee/
> application-1.1">
>    <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/
> deployment-1.1">
>      <dep:moduleId>
>        <dep:groupId>geronimo</dep:groupId>
>        <dep:artifactId>daytrader-derby-jetty</dep:artifactId>
>        <dep:version>1.1-SNAPSHOT</dep:version>
>        <dep:type>car</dep:type>
>      </dep:moduleId>
>      <dep:dependencies>
>        <dep:dependency>
>          <dep:groupId>geronimo</dep:groupId>
>          <dep:artifactId>j2ee-server</dep:artifactId>
>          <dep:type>car</dep:type>
>        </dep:dependency>
>        <dep:dependency>
>          <dep:groupId>geronimo</dep:groupId>
>          <dep:artifactId>system-database</dep:artifactId>
>          <dep:type>car</dep:type>
>        </dep:dependency>
>        <dep:dependency>
>          <dep:groupId>geronimo</dep:groupId>
>          <dep:artifactId>geronimo-daytrader-derby-db</dep:artifactId>
>          <dep:type>jar</dep:type>
>          <dep:import>classes</dep:import>
>        </dep:dependency>
>      </dep:dependencies>
>      <dep:hidden-classes/>
>      <dep:non-overridable-classes/>
>    </dep:environment>
>
>
> thanks
> david jencks
>
>>
>> P.S. the jsp is doing basic stuff...it was failing when attempting
>> to get
>> the connection from the pool.
>>
>> Context initContext = new InitialContext();
>> Context envContext  = (Context)initContext.lookup("java:/comp/env");
>> DataSource ds = (DataSource)envContext.lookup("jdbc/DataSource");
>> System.out.println("Got DataSource: " +ds.toString() );
>> con = ds.getConnection();   //failed here.
>>
>> Lin
>>
>>
>> -----Original Message-----
>> From: Stanley Bradbury [mailto:Stan.Bradbury@gmail.com]
>> Sent: Tuesday, June 06, 2006 6:50 PM
>> To: user@geronimo.apache.org
>> Subject: Re: unable to run a simple jsp application
>>
>> Lin Sun wrote:
>>> Hi there,
>>>
>>> I have a simple jsp application that worked on 1.0.   It displays  
>>> the
>>> contents of the EMP table of the Employee database.
>>> I am using the embedded derby database and the
>>> tranql-connector-derby-embed-xa-1.1 rar file in Geronimo 1.1 build
>>> (geronimo-tomcat-j2ee-1.1-410806).
>>>
>>> The server wide datasource and application war file deployed fine.
>>>
>>> However, when I access the jsp from my firefox browser, I got the
>> following
>>> exception
>>> in the console when the server is trying to get the database
>>> connection:
>>>
>> ==  SNIP ===
>>
>> Hi Lin -
>>
>> The few times I have seen a NullPointerException while trying to
>> start a
>> Derby database have been caused by the Derby embedded driver being
>> loaded by multiple classloaders in a JVM.  Could it be that your
>> JSP is
>> causing the embedded driver to loaded?  Isn't it true that the server
>> wide datasource should be starting the database when Geronimo starts
>> rather than this happening when the JSP is called?
>>
>> The fact that this fails with version 1.1 and not 1.0 might be  
>> because
>> of classloader changes that were implemented since 1.0.
>>
>> Any thoughts on this theory from people knowledgeable about the the
>> Geronimo 1.1 JSP classloader hierarchy?
>>
>>>>>  Derby Start exception:
>>
>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
>> ool.java:684)
>>         at java.lang.Thread.run(Thread.java:568)
>> org.apache.derby.impl.jdbc.EmbedSQLExceptionFailed to start database
>> 'Employee',
>>  see the next exception for details.
>> java.lang.NullPointerException
>>         at
>> org.apache.jsp.jsp.EMPdemo_jsp._jspService(org.apache.jsp.jsp.EMPdemo
>> _jsp:70)
>>
>>
>>
>


Mime
View raw message