You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by jleonar <jl...@gmail.com> on 2007/12/28 13:40:07 UTC

Geronimo with Liferay library conflict

I have some custom code deployed within Liferay(4.3.x) running on Geronimo
1.1

The custom code uses xercesImpl-2.8.0 or higher.  Geronimo 1.1 uses
xercesImpl-2.6.2.  So my code breaks because it is always using the
xercesImpl-2.6.2 instead of the xercesImpl-2.8.0 jar that I have in the
sharedlib folder.

I don't want to do anything specific to the changes in liferay because I
have this code working on multiple application servers(e.g. Tomcat).

I have tried using hidden-classes to hide the application server's library
for xercesImpl but that doesn't seem to work.  Here is my geronimo-web.xml
in the liferay repository.

<?xml version="1.0"?>

<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1">
	<environment>
		<moduleId>
			<groupId>liferay</groupId>
			<artifactId>liferay-portal-tomcat</artifactId>
			<version>4.3.3</version>
			<type>car</type>
		</moduleId>
    <hidden-classes> 
        <filter>org.apache.xerces</filter> 
    </hidden-classes>
		<dependencies>
			<dependency>
				<groupId>geronimo</groupId>
				<artifactId>j2ee-server</artifactId>
				<type>car</type>
			</dependency>
			<dependency>
				<groupId>geronimo</groupId>
				<artifactId>j2ee-security</artifactId>
				<type>car</type>
			</dependency>
			<dependency>
				<groupId>geronimo</groupId>
				<artifactId>rmi-naming</artifactId>
				<type>car</type>
			</dependency>
			<dependency>
				<groupId>geronimo</groupId>
				<artifactId>geronimo-mail</artifactId>
				<type>jar</type>
				<import>classes</import>
			</dependency>
			<dependency>
				<groupId>org.apache.geronimo.specs</groupId>
				<artifactId>geronimo-javamail_1.3.1_spec</artifactId>
				<type>jar</type>
				<import>classes</import>
			</dependency>
			<dependency>
				<artifactId>sharedlib</artifactId>
			</dependency>
			<dependency>
				<groupId>liferay</groupId>
				<artifactId>liferay-pool</artifactId>
				<type>car</type>
			</dependency>
		</dependencies>

	</environment>
	<context-root>/</context-root>
	<security-realm-name>PortalRealm</security-realm-name>
	<security>
		<default-principal>
			<principal name="anonymous"
class="com.liferay.portal.security.jaas.PortalPrincipal" />
		</default-principal>
		<role-mappings>
			<role role-name="users">
				<principal class="com.liferay.portal.security.jaas.PortalRole"
name="users" />
			</role>
		</role-mappings>
	</security>
	<resource-ref>
		<ref-name>jdbc/LiferayPool</ref-name>
		<resource-link>LiferayPool</resource-link>
	</resource-ref>
	<resource-ref>
		<ref-name>mail/MailSession</ref-name>
		<resource-link>LiferayMailSession</resource-link>
	</resource-ref>
	<gbean name="LiferayMailSession"
class="org.apache.geronimo.mail.MailGBean">
		<attribute name="transportProtocol">smtp</attribute>
		<attribute name="host">localhost</attribute>
	</gbean>
	<gbean name="PortalRealm"
class="org.apache.geronimo.security.realm.GenericSecurityRealm">
		<attribute name="realmName">PortalRealm</attribute>
		<reference name="ServerInfo">
			<name>ServerInfo</name>
		</reference>
		<reference name="LoginService">
			<name>JaasLoginService</name>
		</reference>
		<xml-reference name="LoginModuleConfiguration">
			<log:login-config
xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-1.1">
				<log:login-module control-flag="REQUIRED" server-side="true"
wrap-principals="false">
					<log:login-domain-name>PortalRealm-login</log:login-domain-name>
				
<log:login-module-class>com.liferay.portal.security.jaas.ext.tomcat.PortalLoginModule</log:login-module-class>
				</log:login-module>
			</log:login-config>
		</xml-reference>
	</gbean>
</web-app>

-- 
View this message in context: http://www.nabble.com/Geronimo-with-Liferay-library-conflict-tp14525371s134p14525371.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: question about MySql and Geronimo

Posted by Viet Nguyen <vh...@gmail.com>.
I forgot to mention that you can also generate the XML descriptor for
the DataSource through the admin console.

--Viet

On Jan 2, 2008 4:18 PM, jpmlpool <jp...@hotmail.com> wrote:
> Hi Viet,
>
>     Thanks a lot for your prompt reply.
>
>     Let me read the article and try it.
>
> John Qi
>
>
> ----- Original Message -----
> From: "Viet Nguyen" <vh...@gmail.com>
> To: <us...@geronimo.apache.org>
> Sent: Wednesday, January 02, 2008 12:13 PM
> Subject: Re: question about MySql and Geronimo
>
>
> > On Jan 2, 2008 12:40 PM, jpmlpool <jp...@hotmail.com> wrote:
> > > Happy New Year !
> > >
> > >     What I want to do are
> > > (1) when I start Geronimo, MySql server is started automatically by
> > > Geronimo.
> > > (2) I can access MySql,  just like now I can access Derby.
> > > (3) if possible, for example, there are two Derbys and two MySqls, I can
> > >      access them for different purpose. I do not know if this is
> possible,
> > > if
> > >      possible, HOW TO DO.
> > >
> > >     What I did are
> > > (1) downloaded MySql 5.0.54 and installed it. (OK)
> > > (2) from console I can access the MySql. (OK)
> > >
> > > mysql> show tables;
> > >
> > > +-------------------+
> > >
> > > | Tables_in_hellodb |
> > >
> > > +-------------------+
> > >
> > > | pet            |
> > >
> > > | wishtable      |
> > >
> > > +-------------------+
> > >
> > > 2 rows in set (0.00 sec)
> > >
> > >
> > >
> > > mysql> SELECT * FROM pet;
> > >
> > > +----------+-------+---------+------+------------+------------+
> > >
> > > | name      | owner | species | sex  | birth        | death      |
> > >
> > > +----------+-------+---------+------+------------+------------+
> > >
> > > | Fluffy   |         | Harold  | c    | 0000-00-00 | 1993-02-04 |
> > >
> > > | Claws    |         | Gwen    | c    | 0000-00-00 | 1994-03-17 |
> > >
> > > | Buffy    |         | Harold  | d    | 0000-00-00 | 1989-05-13 |
> > >
> > > | Fang     |         | Benny   | d    | 0000-00-00 | 1990-08-27 |
> > >
> > > | Bowser   |         | Diane   | d    | 0000-00-00 | 1979-08-31 |
> > >
> > > | Chirpy   |         | Gwen    | b    | 0000-00-00 | 1998-09-11 |
> > >
> > > | Whistler | Gwen    | bird    |      | 1997-12-09 | NULL       |
> > >
> > > | Slim     |         | Benny   | s    | 0000-00-00 | 1996-04-29 |
> > >
> > > +----------+-------+---------+------+------------+------------+
> > >
> > > 8 rows in set (0.00 sec)
> > >
> > >
> > >
> > > (3) downloaded the MySql driver mysql-connector-java-3.1.12.jar
> > >
> > >      through Geronimo's console.
> > >
> > >      the driver is placed in
> repository\mysql\mysql-connector-java\3.1.12
> > >
> > >
> > >
> > > (4) From Eclipse I created a Java Application, and I can
> > >
> > >      access the MySql using Java code below. The results are correct.
> > >
> > >
> > >
> > >      Class.forName("com.mysql.jdbc.Driver").newInstance();
> > >
> > >      String url = "jdbc:mysql:///hellodb?user=abc&password=xyz";
> > >      Connection con = DriverManager.getConnection(url);
> > >
> > >
> > >
> > > (5) I created a Dynamic web project and a servlet, and used the
> > >
> > >      same code in the servlet as above, but I got next error message.
> > >
> > >
> > >
> > > java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in classloader
> > > com.sn.web.db.mysql.demo.pet/SqlDemoPetStoreId/1.0/war
> > >  at
> > >
> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(
> > > MultiParentClassLoader.java:428)
> > >  at
> > >
> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiPare
> > > ntClassLoader.java:278)
> > >  at java.lang.ClassLoader.loadClass(Unknown Source)
> > >  at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> > >  at java.lang.Class.forName0(Native Method)
> > >  at java.lang.Class.forName(Unknown Source)
> > >  at com.sn.web.db.mysql.demo.pet.ListPets.getPets(ListPets.java:82)
> > >  at com.sn.web.db.mysql.demo.pet.ListPets.doGet(ListPets.java:43)
> > >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> > >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> > >
> > I think the reason the class is not found is because you did not set a
> > dependency on the MySQL driver in your application. You can do this in
> > your geronimo-web.xml.  However, it is better if you used a DataSource
> > to connect to the respective DBs. This way, you do not have to
> > hardcode the driver classname and the connection url in your
> > application code. For an example of how to do this, visit
> >
> http://cwiki.apache.org/GMOxDOC20/simple-database-access-sample-application.html.
> >
> > Once you write the xml descriptor that defines the datasource, you
> > just need to inject it into your source code through annotations or
> > some more xml configuration.
> >
> > Since each datasource defines a connection to a database, you can have
> > multiple datasources to connect to multiple different types of
> > databases.
> >
> > Hope this helps,
> > Viet
> > > .....
> > >
> > >
> > >
> > > Do you have any ideas ?
> > >
> > >
> > >
> > > Thanks in advance.
> > >
> > >
> > >
> > > John Qi
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
>

Re: question about MySql and Geronimo

Posted by jpmlpool <jp...@hotmail.com>.
Hi Viet,

    Thanks a lot for your prompt reply.

    Let me read the article and try it.

John Qi

----- Original Message ----- 
From: "Viet Nguyen" <vh...@gmail.com>
To: <us...@geronimo.apache.org>
Sent: Wednesday, January 02, 2008 12:13 PM
Subject: Re: question about MySql and Geronimo


> On Jan 2, 2008 12:40 PM, jpmlpool <jp...@hotmail.com> wrote:
> > Happy New Year !
> >
> >     What I want to do are
> > (1) when I start Geronimo, MySql server is started automatically by
> > Geronimo.
> > (2) I can access MySql,  just like now I can access Derby.
> > (3) if possible, for example, there are two Derbys and two MySqls, I can
> >      access them for different purpose. I do not know if this is
possible,
> > if
> >      possible, HOW TO DO.
> >
> >     What I did are
> > (1) downloaded MySql 5.0.54 and installed it. (OK)
> > (2) from console I can access the MySql. (OK)
> >
> > mysql> show tables;
> >
> > +-------------------+
> >
> > | Tables_in_hellodb |
> >
> > +-------------------+
> >
> > | pet            |
> >
> > | wishtable      |
> >
> > +-------------------+
> >
> > 2 rows in set (0.00 sec)
> >
> >
> >
> > mysql> SELECT * FROM pet;
> >
> > +----------+-------+---------+------+------------+------------+
> >
> > | name      | owner | species | sex  | birth        | death      |
> >
> > +----------+-------+---------+------+------------+------------+
> >
> > | Fluffy   |         | Harold  | c    | 0000-00-00 | 1993-02-04 |
> >
> > | Claws    |         | Gwen    | c    | 0000-00-00 | 1994-03-17 |
> >
> > | Buffy    |         | Harold  | d    | 0000-00-00 | 1989-05-13 |
> >
> > | Fang     |         | Benny   | d    | 0000-00-00 | 1990-08-27 |
> >
> > | Bowser   |         | Diane   | d    | 0000-00-00 | 1979-08-31 |
> >
> > | Chirpy   |         | Gwen    | b    | 0000-00-00 | 1998-09-11 |
> >
> > | Whistler | Gwen    | bird    |      | 1997-12-09 | NULL       |
> >
> > | Slim     |         | Benny   | s    | 0000-00-00 | 1996-04-29 |
> >
> > +----------+-------+---------+------+------------+------------+
> >
> > 8 rows in set (0.00 sec)
> >
> >
> >
> > (3) downloaded the MySql driver mysql-connector-java-3.1.12.jar
> >
> >      through Geronimo's console.
> >
> >      the driver is placed in
repository\mysql\mysql-connector-java\3.1.12
> >
> >
> >
> > (4) From Eclipse I created a Java Application, and I can
> >
> >      access the MySql using Java code below. The results are correct.
> >
> >
> >
> >      Class.forName("com.mysql.jdbc.Driver").newInstance();
> >
> >      String url = "jdbc:mysql:///hellodb?user=abc&password=xyz";
> >      Connection con = DriverManager.getConnection(url);
> >
> >
> >
> > (5) I created a Dynamic web project and a servlet, and used the
> >
> >      same code in the servlet as above, but I got next error message.
> >
> >
> >
> > java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in classloader
> > com.sn.web.db.mysql.demo.pet/SqlDemoPetStoreId/1.0/war
> >  at
> >
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(
> > MultiParentClassLoader.java:428)
> >  at
> >
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiPare
> > ntClassLoader.java:278)
> >  at java.lang.ClassLoader.loadClass(Unknown Source)
> >  at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> >  at java.lang.Class.forName0(Native Method)
> >  at java.lang.Class.forName(Unknown Source)
> >  at com.sn.web.db.mysql.demo.pet.ListPets.getPets(ListPets.java:82)
> >  at com.sn.web.db.mysql.demo.pet.ListPets.doGet(ListPets.java:43)
> >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> >
> I think the reason the class is not found is because you did not set a
> dependency on the MySQL driver in your application. You can do this in
> your geronimo-web.xml.  However, it is better if you used a DataSource
> to connect to the respective DBs. This way, you do not have to
> hardcode the driver classname and the connection url in your
> application code. For an example of how to do this, visit
>
http://cwiki.apache.org/GMOxDOC20/simple-database-access-sample-application.html.
>
> Once you write the xml descriptor that defines the datasource, you
> just need to inject it into your source code through annotations or
> some more xml configuration.
>
> Since each datasource defines a connection to a database, you can have
> multiple datasources to connect to multiple different types of
> databases.
>
> Hope this helps,
> Viet
> > .....
> >
> >
> >
> > Do you have any ideas ?
> >
> >
> >
> > Thanks in advance.
> >
> >
> >
> > John Qi
> >
> >
> >
> >
> >
> >
> >
> >
>


Re: question about MySql and Geronimo

Posted by Viet Nguyen <vh...@gmail.com>.
On Jan 2, 2008 12:40 PM, jpmlpool <jp...@hotmail.com> wrote:
> Happy New Year !
>
>     What I want to do are
> (1) when I start Geronimo, MySql server is started automatically by
> Geronimo.
> (2) I can access MySql,  just like now I can access Derby.
> (3) if possible, for example, there are two Derbys and two MySqls, I can
>      access them for different purpose. I do not know if this is possible,
> if
>      possible, HOW TO DO.
>
>     What I did are
> (1) downloaded MySql 5.0.54 and installed it. (OK)
> (2) from console I can access the MySql. (OK)
>
> mysql> show tables;
>
> +-------------------+
>
> | Tables_in_hellodb |
>
> +-------------------+
>
> | pet            |
>
> | wishtable      |
>
> +-------------------+
>
> 2 rows in set (0.00 sec)
>
>
>
> mysql> SELECT * FROM pet;
>
> +----------+-------+---------+------+------------+------------+
>
> | name      | owner | species | sex  | birth        | death      |
>
> +----------+-------+---------+------+------------+------------+
>
> | Fluffy   |         | Harold  | c    | 0000-00-00 | 1993-02-04 |
>
> | Claws    |         | Gwen    | c    | 0000-00-00 | 1994-03-17 |
>
> | Buffy    |         | Harold  | d    | 0000-00-00 | 1989-05-13 |
>
> | Fang     |         | Benny   | d    | 0000-00-00 | 1990-08-27 |
>
> | Bowser   |         | Diane   | d    | 0000-00-00 | 1979-08-31 |
>
> | Chirpy   |         | Gwen    | b    | 0000-00-00 | 1998-09-11 |
>
> | Whistler | Gwen    | bird    |      | 1997-12-09 | NULL       |
>
> | Slim     |         | Benny   | s    | 0000-00-00 | 1996-04-29 |
>
> +----------+-------+---------+------+------------+------------+
>
> 8 rows in set (0.00 sec)
>
>
>
> (3) downloaded the MySql driver mysql-connector-java-3.1.12.jar
>
>      through Geronimo's console.
>
>      the driver is placed in repository\mysql\mysql-connector-java\3.1.12
>
>
>
> (4) From Eclipse I created a Java Application, and I can
>
>      access the MySql using Java code below. The results are correct.
>
>
>
>      Class.forName("com.mysql.jdbc.Driver").newInstance();
>
>      String url = "jdbc:mysql:///hellodb?user=abc&password=xyz";
>      Connection con = DriverManager.getConnection(url);
>
>
>
> (5) I created a Dynamic web project and a servlet, and used the
>
>      same code in the servlet as above, but I got next error message.
>
>
>
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in classloader
> com.sn.web.db.mysql.demo.pet/SqlDemoPetStoreId/1.0/war
>  at
> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(
> MultiParentClassLoader.java:428)
>  at
> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiPare
> ntClassLoader.java:278)
>  at java.lang.ClassLoader.loadClass(Unknown Source)
>  at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>  at java.lang.Class.forName0(Native Method)
>  at java.lang.Class.forName(Unknown Source)
>  at com.sn.web.db.mysql.demo.pet.ListPets.getPets(ListPets.java:82)
>  at com.sn.web.db.mysql.demo.pet.ListPets.doGet(ListPets.java:43)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>
I think the reason the class is not found is because you did not set a
dependency on the MySQL driver in your application. You can do this in
your geronimo-web.xml.  However, it is better if you used a DataSource
to connect to the respective DBs. This way, you do not have to
hardcode the driver classname and the connection url in your
application code. For an example of how to do this, visit
http://cwiki.apache.org/GMOxDOC20/simple-database-access-sample-application.html.

Once you write the xml descriptor that defines the datasource, you
just need to inject it into your source code through annotations or
some more xml configuration.

Since each datasource defines a connection to a database, you can have
multiple datasources to connect to multiple different types of
databases.

Hope this helps,
Viet
> .....
>
>
>
> Do you have any ideas ?
>
>
>
> Thanks in advance.
>
>
>
> John Qi
>
>
>
>
>
>
>
>

Re: Questions about MySql and Geronimo

Posted by David Jencks <da...@yahoo.com>.
What is the plan for the database pool?  I suspect you should be  
looking up something like "java:comp/env/MyDataSource"

david jencks

On Jan 9, 2008, at 4:32 PM, jpmlpool wrote:

> Hi David,
>
>     Thanks a lot for your help.
>
>     I added the dependency to the geronimo-application.xml,
> and then the next code works fine.
>
>    Class.forName("com.mysql.jdbc.Driver").newInstance();
>    String url = "jdbc:mysql:///hellodb?user=root&password=hello";
>    con = DriverManager.getConnection(url);
>
>    stmt = con.createStatement();
>    String sql = "SELECT * FROM PET";
>    rs = stmt.executeQuery(sql);
>    while (rs.next())
>    {
>     String name = this.getValue(rs, "NAME");
>     }
>
>     But the next code throws exception.
>
>     InitialContext ctx = new InitialContext();
>     ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MyDataSource");
>     con = ds.getConnection("root", "hello");
>
>     stmt = con.createStatement();
>     String sql = "SELECT * FROM PET";
>     rs = stmt.executeQuery(sql);
>
>     I am trying to find out the reasons. Maybe I also need to  
> modify web.xml
> and geronimo-web.xml.
>
>     Now I have two ways to access MySql database. One way is to setup
> the EAR; another way is to setup WAR/web.xml and WAR/geronimo-web.xml.
>
>     Anyway it is great progress that I can access MySql database.
> Thanks a lot.
>
>
> javax.naming.NotContextException: jdbc/MyDataSource
>  at
> org.apache.xbean.naming.context.AbstractContext.lookup 
> (AbstractContext.java:
> 167)
>  at
> org.apache.xbean.naming.context.AbstractContext.lookup 
> (AbstractContext.java:
> 617)
>  at
> org.apache.xbean.naming.context.AbstractContext.lookup 
> (AbstractContext.java:
> 158)
>  at
> org.apache.xbean.naming.context.AbstractContext.lookup 
> (AbstractContext.java:
> 617)
>  at
> org.apache.xbean.naming.context.AbstractContext.lookup 
> (AbstractContext.java:
> 158)
>  at
> org.apache.xbean.naming.context.AbstractContext.lookup 
> (AbstractContext.java:
> 603)
>  at javax.naming.InitialContext.lookup(Unknown Source)
>  at
> com.sn.web.db.mysql.demo.pet.ListPets.getConnectionByDataSource 
> (ListPets.jav
> a:79)
>  at
> com.sn.web.db.mysql.demo.pet.ListPets.LoadTableFromDatabase 
> (ListPets.java:24
> 8)
>  at com.sn.web.db.mysql.demo.pet.ListPets.LoadTable(ListPets.java:230)
>  at com.sn.web.db.mysql.demo.pet.ListPets.doGet(ListPets.java:47)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
> (Application
> FilterChain.java:290)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter 
> (ApplicationFilterCh
> ain.java:206)
>  at
> org.apache.catalina.core.StandardWrapperValve.invoke 
> (StandardWrapperValve.ja
> va:230)
>  at
> org.apache.catalina.core.StandardContextValve.invoke 
> (StandardContextValve.ja
> va:175)
>  at
> org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke 
> (DefaultSubjectVa
> lve.java:56)
>  at
> org.apache.geronimo.tomcat.GeronimoStandardContext 
> $SystemMethodValve.invoke(
> GeronimoStandardContext.java:353)
>  at
> org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke 
> (GeronimoBef
> oreAfterValve.java:47)
>  at
> org.apache.catalina.core.StandardHostValve.invoke 
> (StandardHostValve.java:128
> )
>  at
> org.apache.catalina.valves.ErrorReportValve.invoke 
> (ErrorReportValve.java:104
> )
>  at
> org.apache.catalina.core.StandardEngineValve.invoke 
> (StandardEngineValve.java
> :109)
>  at
> org.apache.catalina.valves.AccessLogValve.invoke 
> (AccessLogValve.java:563)
>  at
> org.apache.catalina.connector.CoyoteAdapter.service 
> (CoyoteAdapter.java:261)
>  at org.apache.jk.server.JkCoyoteHandler.invoke 
> (JkCoyoteHandler.java:190)
>  at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java: 
> 283)
>  at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
>  at
> org.apache.jk.common.ChannelSocket.processConnection 
> (ChannelSocket.java:697)
>  at
> org.apache.jk.common.ChannelSocket$SocketConnection.runIt 
> (ChannelSocket.java
> :889)
>  at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run 
> (ThreadPool.jav
> a:686)
>  at java.lang.Thread.run(Unknown Source)
>
>
>
> ----- Original Message -----
> From: "David Jencks" <da...@yahoo.com>
> To: <us...@geronimo.apache.org>
> Sent: Monday, January 07, 2008 12:04 PM
> Subject: Re: Questions about MySql and Geronimo
>
>
>
> On Jan 7, 2008, at 10:32 AM, jpmlpool wrote:
>
>>
>> Hello
>>
>>     I am still struggling with Geronimo and MySql. I tried to change
>> the deploy plans following some articles, but I still can not access
>> MySql server from Geronimo.
>>     Attached are related files, because I zipped Ear and War projects
>> created on Eclipse, but I cannot send it to this email address.
>>
>>     If you know my errors, please help me. At the bottom is my
>> previous
>> email with more details.
>>
>> Environments or what I did
>> (1)  Geronimo 2.0.2
>> (2)  Database pool created from Geronimo Admin console
>>        Database pool : QiMySql
>>        Database : hellodb
>>        a database Table : pet
>> (3) Eclipse 3.3.1 with WTP
>> (4) OS : Windows 2000
>> (5) SqlPetStoreEar and SqiPetStoreWar projects on Eclipse
>
> Your application needs a dependency on the database pool you have set
> up.  Something like
>
> ====== SqlPetStoreEar/EarContent/METF-INF/geronimo-application.xml
> ======
>
> <?xml version="1.0" encoding="UTF-8"?>
> <application xmlns="http://geronimo.apache.org/xml/ns/j2ee/
> application-1.1"
> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
> application-name="SqlPetStoreEar">
>    <sys:environment>
>      <sys:moduleId>
>        <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
>        <sys:artifactId>MySqlPetStoreEarId</sys:artifactId>
>        <sys:version>1.0</sys:version>
>        <sys:type>ear</sys:type>
>      </sys:moduleId>
>      <sys:dependencies>
>          <sys:dependency>
>              <sys:groupId>console.dbpool</sys:groupId>
>              <sys:artifactId>QiMySql</sys:artifactId>
>              <sys:type>rar</sys:type>
>          </sys:dependency>
>      </sys:dependencies>
>    </sys:environment>
>
> </application>
>
>
> You should check that the dependency matches what the console comes
> up with when it deploys the pool -- in particular I'm unsure of the
> type.
>
> Hope this helps
> david jencks
>
>>
>> John Qi
>>
>> =============================
>>
>>
>> ====== SqlPetStoreEar/EarContent/METF-INF/application.xml ======
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="http://java.sun.com/xml/ns/javaee"
>> xmlns:application="http://java.sun.com/xml/ns/javaee/
>> application_5.xsd"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/application_5.xsd"
>> id="Application_ID"
>> version="5">
>>   <module>
>>     <web>
>>       <web-uri>SqlPetStoreWar.war</web-uri>
>>       <context-root>SqlPetStoreWar</context-root>
>>     </web>
>>   </module>
>> </application>
>>
>> ====== SqlPetStoreEar/EarContent/METF-INF/geronimo-application.xml
>> ======
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <application xmlns="http://geronimo.apache.org/xml/ns/j2ee/
>> application-1.1"
>> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
>> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
>> application-name="SqlPetStoreEar">
>>   <sys:environment>
>>     <sys:moduleId>
>>       <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
>>       <sys:artifactId>MySqlPetStoreEarId</sys:artifactId>
>>       <sys:version>1.0</sys:version>
>>       <sys:type>ear</sys:type>
>>     </sys:moduleId>
>>   </sys:environment>
>>
>> </application>
>>
>> ====== SqlPetStoreWar/WebContent/WEB-INF/geronimo-web.xml ======
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
>> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
>> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
>>   <sys:environment>
>>     <sys:moduleId>
>>       <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
>>       <sys:artifactId>SqlPetStoreWarId</sys:artifactId>
>>       <sys:version>1.0</sys:version>
>>       <sys:type>war</sys:type>
>>     </sys:moduleId>
>>
>>
>>   </sys:environment>
>>
>>   <context-root>/SqlPetStoreWar</context-root>
>>
>> </web-app>
>>
>> ====== SqlPetStoreWar/EarContent/WEB-INF/web.xml ======
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="http://java.sun.com/xml/ns/javaee"
>> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
>> version="2.5">
>>   <display-name>SqlPetStoreWar</display-name>
>>   <welcome-file-list>
>>     <welcome-file>index.html</welcome-file>
>>     <welcome-file>index.jsp</welcome-file>
>>   </welcome-file-list>
>>   <servlet>
>>     <description></description>
>>     <display-name>ListPets</display-name>
>>     <servlet-name>ListPets</servlet-name>
>>     <servlet-class>com.sn.web.db.mysql.demo.pet.ListPets</servlet-
>> class>
>>   </servlet>
>>   <servlet-mapping>
>>     <servlet-name>ListPets</servlet-name>
>>     <url-pattern>/ListPets</url-pattern>
>>   </servlet-mapping>
>>
>> </web-app>
>>
>> ================ ListPets.java ===============
>>
>>  protected void doGet(HttpServletRequest request, HttpServletResponse
>> response) throws ServletException, IOException
>>  {
>>   // TODO Auto-generated method stub
>>   this.getPets(request, response);
>>  }
>>
>>   private void getPets(HttpServletRequest request,  
>> HttpServletResponse
>> response)
>>  {
>>   Statement stmt = null;
>>   ResultSet rs = null;
>>
>>   try
>>   {
>>    InitialContext ctx = new InitialContext();
>>    // error : can not find this data source
>>    DataSource ds = (DataSource)ctx.lookup("java:comp/env/QiMySql");
>>
>>    // error : this line does not work on Geronimo, but works fine
>> in java
>> application.
>>    Class.forName("com.mysql.jdbc.Driver").newInstance();
>>
>>    String url = "jdbc:mysql:///hellodb?user=root&password=hello";
>>    Connection con = DriverManager.getConnection(url);
>>
>>    stmt = con.createStatement();
>>    String sql = "SELECT * FROM PET";
>>    rs = stmt.executeQuery(sql);
>>    while (rs.next())
>>    {
>>     String no = rs.getString("NAME");
>>     String lang = rs.getString("OWNER");
>>     String msg = rs.getString("SEX");
>>     System.out.println(no + " " + lang + " " + msg);
>>    }
>>    stmt.close();
>>    con.close();
>>   }
>>   catch (Exception e)
>>   {
>>    e.printStackTrace();
>>   }
>>   finally
>>   {
>>    if (rs != null)
>>    {
>>     try
>>     {
>>      rs.close();
>>     }
>>     catch (SQLException sqlEx)
>>     {
>>     }
>>    }
>>
>>    if (stmt != null)
>>    {
>>     try
>>     {
>>      stmt.close();
>>     }
>>     catch (SQLException sqlEx)
>>     {
>>     }
>>    }
>>
>>    rs = null;
>>    stmt = null;
>>   }
>>
>>  }
>>
>> =============================
>>
>>
>> ----- Original Message -----
>> From: "jpmlpool" <jp...@hotmail.com>
>> To: <us...@geronimo.apache.org>
>> Sent: Wednesday, January 02, 2008 9:40 AM
>> Subject: question about MySql and Geronimo
>>
>>
>>> Happy New Year !
>>>
>>>     What I want to do are
>>> (1) when I start Geronimo, MySql server is started automatically by
>>> Geronimo.
>>> (2) I can access MySql,  just like now I can access Derby.
>>> (3) if possible, for example, there are two Derbys and two MySqls,
>>> I can
>>>      access them for different purpose. I do not know if this is
>>> possible,
>>> if
>>>      possible, HOW TO DO.
>>>
>>>     What I did are
>>> (1) downloaded MySql 5.0.54 and installed it. (OK)
>>> (2) from console I can access the MySql. (OK)
>>>
>>> mysql> show tables;
>>>
>>> +-------------------+
>>>
>>> | Tables_in_hellodb |
>>>
>>> +-------------------+
>>>
>>> | pet              |
>>>
>>> | wishtable        |
>>>
>>> +-------------------+
>>>
>>> 2 rows in set (0.00 sec)
>>>
>>>
>>>
>>> mysql> SELECT * FROM pet;
>>>
>>> +----------+-------+---------+------+------------+------------+
>>>
>>> | name      | owner | species | sex  | birth        | death      |
>>>
>>> +----------+-------+---------+------+------------+------------+
>>>
>>> | Fluffy   |         | Harold  | c    | 0000-00-00 | 1993-02-04 |
>>>
>>> | Claws    |         | Gwen    | c    | 0000-00-00 | 1994-03-17 |
>>>
>>> | Buffy    |         | Harold  | d    | 0000-00-00 | 1989-05-13 |
>>>
>>> | Fang     |         | Benny   | d    | 0000-00-00 | 1990-08-27 |
>>>
>>> | Bowser   |         | Diane   | d    | 0000-00-00 | 1979-08-31 |
>>>
>>> | Chirpy   |         | Gwen    | b    | 0000-00-00 | 1998-09-11 |
>>>
>>> | Whistler | Gwen    | bird    |      | 1997-12-09 | NULL       |
>>>
>>> | Slim     |         | Benny   | s    | 0000-00-00 | 1996-04-29 |
>>>
>>> +----------+-------+---------+------+------------+------------+
>>>
>>> 8 rows in set (0.00 sec)
>>>
>>>
>>>
>>> (3) downloaded the MySql driver mysql-connector-java-3.1.12.jar
>>>
>>>      through Geronimo's console.
>>>
>>>      the driver is placed in repository\mysql\mysql-connector-java
>>> \3.1.12
>>>
>>>
>>>
>>> (4) From Eclipse I created a Java Application, and I can
>>>
>>>      access the MySql using Java code below. The results are  
>>> correct.
>>>
>>>
>>>
>>>      Class.forName("com.mysql.jdbc.Driver").newInstance();
>>>
>>>      String url = "jdbc:mysql:///hellodb?user=abc&password=xyz";
>>>      Connection con = DriverManager.getConnection(url);
>>>
>>>
>>>
>>> (5) I created a Dynamic web project and a servlet, and used the
>>>
>>>      same code in the servlet as above, but I got next error  
>>> message.
>>>
>>>
>>>
>>> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in
>>> classloader
>>> com.sn.web.db.mysql.demo.pet/SqlDemoPetStoreId/1.0/war
>>>  at
>>>
>> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimize 
>> d
>> Class(
>>> MultiParentClassLoader.java:428)
>>>  at
>>>
>> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass
>> (MultiPare
>>
>>> ntClassLoader.java:278)
>>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>>  at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>>  at java.lang.Class.forName0(Native Method)
>>>  at java.lang.Class.forName(Unknown Source)
>>>  at com.sn.web.db.mysql.demo.pet.ListPets.getPets(ListPets.java:82)
>>>  at com.sn.web.db.mysql.demo.pet.ListPets.doGet(ListPets.java:43)
>>>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>>>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>>>
>>> .....
>>>
>>>
>>>
>>> Do you have any ideas ?
>>>
>>>
>>>
>>> Thanks in advance.
>>>
>>>
>>>
>>> John Qi
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>
>


Re: Questions about MySql and Geronimo

Posted by jpmlpool <jp...@hotmail.com>.
Hi David,

    Thanks a lot for your help.

    I added the dependency to the geronimo-application.xml,
and then the next code works fine.

   Class.forName("com.mysql.jdbc.Driver").newInstance();
   String url = "jdbc:mysql:///hellodb?user=root&password=hello";
   con = DriverManager.getConnection(url);

   stmt = con.createStatement();
   String sql = "SELECT * FROM PET";
   rs = stmt.executeQuery(sql);
   while (rs.next())
   {
    String name = this.getValue(rs, "NAME");
    }

    But the next code throws exception.

    InitialContext ctx = new InitialContext();
    ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MyDataSource");
    con = ds.getConnection("root", "hello");

    stmt = con.createStatement();
    String sql = "SELECT * FROM PET";
    rs = stmt.executeQuery(sql);

    I am trying to find out the reasons. Maybe I also need to modify web.xml
and geronimo-web.xml.

    Now I have two ways to access MySql database. One way is to setup
the EAR; another way is to setup WAR/web.xml and WAR/geronimo-web.xml.

    Anyway it is great progress that I can access MySql database.
Thanks a lot.


javax.naming.NotContextException: jdbc/MyDataSource
 at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:
167)
 at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:
617)
 at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:
158)
 at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:
617)
 at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:
158)
 at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:
603)
 at javax.naming.InitialContext.lookup(Unknown Source)
 at
com.sn.web.db.mysql.demo.pet.ListPets.getConnectionByDataSource(ListPets.jav
a:79)
 at
com.sn.web.db.mysql.demo.pet.ListPets.LoadTableFromDatabase(ListPets.java:24
8)
 at com.sn.web.db.mysql.demo.pet.ListPets.LoadTable(ListPets.java:230)
 at com.sn.web.db.mysql.demo.pet.ListPets.doGet(ListPets.java:47)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:290)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:230)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:175)
 at
org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectVa
lve.java:56)
 at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(
GeronimoStandardContext.java:353)
 at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBef
oreAfterValve.java:47)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128
)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104
)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)
 at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
 at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
 at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
 at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
 at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
 at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
 at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java
:889)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:686)
 at java.lang.Thread.run(Unknown Source)



----- Original Message ----- 
From: "David Jencks" <da...@yahoo.com>
To: <us...@geronimo.apache.org>
Sent: Monday, January 07, 2008 12:04 PM
Subject: Re: Questions about MySql and Geronimo



On Jan 7, 2008, at 10:32 AM, jpmlpool wrote:

>
> Hello
>
>     I am still struggling with Geronimo and MySql. I tried to change
> the deploy plans following some articles, but I still can not access
> MySql server from Geronimo.
>     Attached are related files, because I zipped Ear and War projects
> created on Eclipse, but I cannot send it to this email address.
>
>     If you know my errors, please help me. At the bottom is my
> previous
> email with more details.
>
> Environments or what I did
> (1)  Geronimo 2.0.2
> (2)  Database pool created from Geronimo Admin console
>        Database pool : QiMySql
>        Database : hellodb
>        a database Table : pet
> (3) Eclipse 3.3.1 with WTP
> (4) OS : Windows 2000
> (5) SqlPetStoreEar and SqiPetStoreWar projects on Eclipse

Your application needs a dependency on the database pool you have set
up.  Something like

====== SqlPetStoreEar/EarContent/METF-INF/geronimo-application.xml
======

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/
application-1.1"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
application-name="SqlPetStoreEar">
   <sys:environment>
     <sys:moduleId>
       <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
       <sys:artifactId>MySqlPetStoreEarId</sys:artifactId>
       <sys:version>1.0</sys:version>
       <sys:type>ear</sys:type>
     </sys:moduleId>
     <sys:dependencies>
         <sys:dependency>
             <sys:groupId>console.dbpool</sys:groupId>
             <sys:artifactId>QiMySql</sys:artifactId>
             <sys:type>rar</sys:type>
         </sys:dependency>
     </sys:dependencies>
   </sys:environment>

</application>


You should check that the dependency matches what the console comes
up with when it deploys the pool -- in particular I'm unsure of the
type.

Hope this helps
david jencks

>
> John Qi
>
> =============================
>
>
> ====== SqlPetStoreEar/EarContent/METF-INF/application.xml ======
>
> <?xml version="1.0" encoding="UTF-8"?>
> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:application="http://java.sun.com/xml/ns/javaee/
> application_5.xsd"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/application_5.xsd"
> id="Application_ID"
> version="5">
>   <module>
>     <web>
>       <web-uri>SqlPetStoreWar.war</web-uri>
>       <context-root>SqlPetStoreWar</context-root>
>     </web>
>   </module>
> </application>
>
> ====== SqlPetStoreEar/EarContent/METF-INF/geronimo-application.xml
> ======
>
> <?xml version="1.0" encoding="UTF-8"?>
> <application xmlns="http://geronimo.apache.org/xml/ns/j2ee/
> application-1.1"
> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
> application-name="SqlPetStoreEar">
>   <sys:environment>
>     <sys:moduleId>
>       <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
>       <sys:artifactId>MySqlPetStoreEarId</sys:artifactId>
>       <sys:version>1.0</sys:version>
>       <sys:type>ear</sys:type>
>     </sys:moduleId>
>   </sys:environment>
>
> </application>
>
> ====== SqlPetStoreWar/WebContent/WEB-INF/geronimo-web.xml ======
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
>   <sys:environment>
>     <sys:moduleId>
>       <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
>       <sys:artifactId>SqlPetStoreWarId</sys:artifactId>
>       <sys:version>1.0</sys:version>
>       <sys:type>war</sys:type>
>     </sys:moduleId>
>
>
>   </sys:environment>
>
>   <context-root>/SqlPetStoreWar</context-root>
>
> </web-app>
>
> ====== SqlPetStoreWar/EarContent/WEB-INF/web.xml ======
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
> version="2.5">
>   <display-name>SqlPetStoreWar</display-name>
>   <welcome-file-list>
>     <welcome-file>index.html</welcome-file>
>     <welcome-file>index.jsp</welcome-file>
>   </welcome-file-list>
>   <servlet>
>     <description></description>
>     <display-name>ListPets</display-name>
>     <servlet-name>ListPets</servlet-name>
>     <servlet-class>com.sn.web.db.mysql.demo.pet.ListPets</servlet-
> class>
>   </servlet>
>   <servlet-mapping>
>     <servlet-name>ListPets</servlet-name>
>     <url-pattern>/ListPets</url-pattern>
>   </servlet-mapping>
>
> </web-app>
>
> ================ ListPets.java ===============
>
>  protected void doGet(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException
>  {
>   // TODO Auto-generated method stub
>   this.getPets(request, response);
>  }
>
>   private void getPets(HttpServletRequest request, HttpServletResponse
> response)
>  {
>   Statement stmt = null;
>   ResultSet rs = null;
>
>   try
>   {
>    InitialContext ctx = new InitialContext();
>    // error : can not find this data source
>    DataSource ds = (DataSource)ctx.lookup("java:comp/env/QiMySql");
>
>    // error : this line does not work on Geronimo, but works fine
> in java
> application.
>    Class.forName("com.mysql.jdbc.Driver").newInstance();
>
>    String url = "jdbc:mysql:///hellodb?user=root&password=hello";
>    Connection con = DriverManager.getConnection(url);
>
>    stmt = con.createStatement();
>    String sql = "SELECT * FROM PET";
>    rs = stmt.executeQuery(sql);
>    while (rs.next())
>    {
>     String no = rs.getString("NAME");
>     String lang = rs.getString("OWNER");
>     String msg = rs.getString("SEX");
>     System.out.println(no + " " + lang + " " + msg);
>    }
>    stmt.close();
>    con.close();
>   }
>   catch (Exception e)
>   {
>    e.printStackTrace();
>   }
>   finally
>   {
>    if (rs != null)
>    {
>     try
>     {
>      rs.close();
>     }
>     catch (SQLException sqlEx)
>     {
>     }
>    }
>
>    if (stmt != null)
>    {
>     try
>     {
>      stmt.close();
>     }
>     catch (SQLException sqlEx)
>     {
>     }
>    }
>
>    rs = null;
>    stmt = null;
>   }
>
>  }
>
> =============================
>
>
> ----- Original Message -----
> From: "jpmlpool" <jp...@hotmail.com>
> To: <us...@geronimo.apache.org>
> Sent: Wednesday, January 02, 2008 9:40 AM
> Subject: question about MySql and Geronimo
>
>
>> Happy New Year !
>>
>>     What I want to do are
>> (1) when I start Geronimo, MySql server is started automatically by
>> Geronimo.
>> (2) I can access MySql,  just like now I can access Derby.
>> (3) if possible, for example, there are two Derbys and two MySqls,
>> I can
>>      access them for different purpose. I do not know if this is
>> possible,
>> if
>>      possible, HOW TO DO.
>>
>>     What I did are
>> (1) downloaded MySql 5.0.54 and installed it. (OK)
>> (2) from console I can access the MySql. (OK)
>>
>> mysql> show tables;
>>
>> +-------------------+
>>
>> | Tables_in_hellodb |
>>
>> +-------------------+
>>
>> | pet              |
>>
>> | wishtable        |
>>
>> +-------------------+
>>
>> 2 rows in set (0.00 sec)
>>
>>
>>
>> mysql> SELECT * FROM pet;
>>
>> +----------+-------+---------+------+------------+------------+
>>
>> | name      | owner | species | sex  | birth        | death      |
>>
>> +----------+-------+---------+------+------------+------------+
>>
>> | Fluffy   |         | Harold  | c    | 0000-00-00 | 1993-02-04 |
>>
>> | Claws    |         | Gwen    | c    | 0000-00-00 | 1994-03-17 |
>>
>> | Buffy    |         | Harold  | d    | 0000-00-00 | 1989-05-13 |
>>
>> | Fang     |         | Benny   | d    | 0000-00-00 | 1990-08-27 |
>>
>> | Bowser   |         | Diane   | d    | 0000-00-00 | 1979-08-31 |
>>
>> | Chirpy   |         | Gwen    | b    | 0000-00-00 | 1998-09-11 |
>>
>> | Whistler | Gwen    | bird    |      | 1997-12-09 | NULL       |
>>
>> | Slim     |         | Benny   | s    | 0000-00-00 | 1996-04-29 |
>>
>> +----------+-------+---------+------+------------+------------+
>>
>> 8 rows in set (0.00 sec)
>>
>>
>>
>> (3) downloaded the MySql driver mysql-connector-java-3.1.12.jar
>>
>>      through Geronimo's console.
>>
>>      the driver is placed in repository\mysql\mysql-connector-java
>> \3.1.12
>>
>>
>>
>> (4) From Eclipse I created a Java Application, and I can
>>
>>      access the MySql using Java code below. The results are correct.
>>
>>
>>
>>      Class.forName("com.mysql.jdbc.Driver").newInstance();
>>
>>      String url = "jdbc:mysql:///hellodb?user=abc&password=xyz";
>>      Connection con = DriverManager.getConnection(url);
>>
>>
>>
>> (5) I created a Dynamic web project and a servlet, and used the
>>
>>      same code in the servlet as above, but I got next error message.
>>
>>
>>
>> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in
>> classloader
>> com.sn.web.db.mysql.demo.pet/SqlDemoPetStoreId/1.0/war
>>  at
>>
> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimized
> Class(
>> MultiParentClassLoader.java:428)
>>  at
>>
> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass
> (MultiPare
>
>> ntClassLoader.java:278)
>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>  at java.lang.Class.forName0(Native Method)
>>  at java.lang.Class.forName(Unknown Source)
>>  at com.sn.web.db.mysql.demo.pet.ListPets.getPets(ListPets.java:82)
>>  at com.sn.web.db.mysql.demo.pet.ListPets.doGet(ListPets.java:43)
>>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>>
>> .....
>>
>>
>>
>> Do you have any ideas ?
>>
>>
>>
>> Thanks in advance.
>>
>>
>>
>> John Qi
>>
>>
>>
>>
>>
>>
>>
>>
>



Re: Questions about MySql and Geronimo

Posted by David Jencks <da...@yahoo.com>.
On Jan 7, 2008, at 10:32 AM, jpmlpool wrote:

>
> Hello
>
>     I am still struggling with Geronimo and MySql. I tried to change
> the deploy plans following some articles, but I still can not access
> MySql server from Geronimo.
>     Attached are related files, because I zipped Ear and War projects
> created on Eclipse, but I cannot send it to this email address.
>
>     If you know my errors, please help me. At the bottom is my  
> previous
> email with more details.
>
> Environments or what I did
> (1)  Geronimo 2.0.2
> (2)  Database pool created from Geronimo Admin console
>        Database pool : QiMySql
>        Database : hellodb
>        a database Table : pet
> (3) Eclipse 3.3.1 with WTP
> (4) OS : Windows 2000
> (5) SqlPetStoreEar and SqiPetStoreWar projects on Eclipse

Your application needs a dependency on the database pool you have set  
up.  Something like

====== SqlPetStoreEar/EarContent/METF-INF/geronimo-application.xml  
======

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/ 
application-1.1"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
application-name="SqlPetStoreEar">
   <sys:environment>
     <sys:moduleId>
       <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
       <sys:artifactId>MySqlPetStoreEarId</sys:artifactId>
       <sys:version>1.0</sys:version>
       <sys:type>ear</sys:type>
     </sys:moduleId>
     <sys:dependencies>
         <sys:dependency>
             <sys:groupId>console.dbpool</sys:groupId>
             <sys:artifactId>QiMySql</sys:artifactId>
             <sys:type>rar</sys:type>
         </sys:dependency>
     </sys:dependencies>
   </sys:environment>

</application>


You should check that the dependency matches what the console comes  
up with when it deploys the pool -- in particular I'm unsure of the  
type.

Hope this helps
david jencks

>
> John Qi
>
> =============================
>
>
> ====== SqlPetStoreEar/EarContent/METF-INF/application.xml ======
>
> <?xml version="1.0" encoding="UTF-8"?>
> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:application="http://java.sun.com/xml/ns/javaee/ 
> application_5.xsd"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/application_5.xsd"  
> id="Application_ID"
> version="5">
>   <module>
>     <web>
>       <web-uri>SqlPetStoreWar.war</web-uri>
>       <context-root>SqlPetStoreWar</context-root>
>     </web>
>   </module>
> </application>
>
> ====== SqlPetStoreEar/EarContent/METF-INF/geronimo-application.xml  
> ======
>
> <?xml version="1.0" encoding="UTF-8"?>
> <application xmlns="http://geronimo.apache.org/xml/ns/j2ee/ 
> application-1.1"
> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
> application-name="SqlPetStoreEar">
>   <sys:environment>
>     <sys:moduleId>
>       <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
>       <sys:artifactId>MySqlPetStoreEarId</sys:artifactId>
>       <sys:version>1.0</sys:version>
>       <sys:type>ear</sys:type>
>     </sys:moduleId>
>   </sys:environment>
>
> </application>
>
> ====== SqlPetStoreWar/WebContent/WEB-INF/geronimo-web.xml ======
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
>   <sys:environment>
>     <sys:moduleId>
>       <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
>       <sys:artifactId>SqlPetStoreWarId</sys:artifactId>
>       <sys:version>1.0</sys:version>
>       <sys:type>war</sys:type>
>     </sys:moduleId>
>
>
>   </sys:environment>
>
>   <context-root>/SqlPetStoreWar</context-root>
>
> </web-app>
>
> ====== SqlPetStoreWar/EarContent/WEB-INF/web.xml ======
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
> version="2.5">
>   <display-name>SqlPetStoreWar</display-name>
>   <welcome-file-list>
>     <welcome-file>index.html</welcome-file>
>     <welcome-file>index.jsp</welcome-file>
>   </welcome-file-list>
>   <servlet>
>     <description></description>
>     <display-name>ListPets</display-name>
>     <servlet-name>ListPets</servlet-name>
>     <servlet-class>com.sn.web.db.mysql.demo.pet.ListPets</servlet- 
> class>
>   </servlet>
>   <servlet-mapping>
>     <servlet-name>ListPets</servlet-name>
>     <url-pattern>/ListPets</url-pattern>
>   </servlet-mapping>
>
> </web-app>
>
> ================ ListPets.java ===============
>
>  protected void doGet(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException
>  {
>   // TODO Auto-generated method stub
>   this.getPets(request, response);
>  }
>
>   private void getPets(HttpServletRequest request, HttpServletResponse
> response)
>  {
>   Statement stmt = null;
>   ResultSet rs = null;
>
>   try
>   {
>    InitialContext ctx = new InitialContext();
>    // error : can not find this data source
>    DataSource ds = (DataSource)ctx.lookup("java:comp/env/QiMySql");
>
>    // error : this line does not work on Geronimo, but works fine  
> in java
> application.
>    Class.forName("com.mysql.jdbc.Driver").newInstance();
>
>    String url = "jdbc:mysql:///hellodb?user=root&password=hello";
>    Connection con = DriverManager.getConnection(url);
>
>    stmt = con.createStatement();
>    String sql = "SELECT * FROM PET";
>    rs = stmt.executeQuery(sql);
>    while (rs.next())
>    {
>     String no = rs.getString("NAME");
>     String lang = rs.getString("OWNER");
>     String msg = rs.getString("SEX");
>     System.out.println(no + " " + lang + " " + msg);
>    }
>    stmt.close();
>    con.close();
>   }
>   catch (Exception e)
>   {
>    e.printStackTrace();
>   }
>   finally
>   {
>    if (rs != null)
>    {
>     try
>     {
>      rs.close();
>     }
>     catch (SQLException sqlEx)
>     {
>     }
>    }
>
>    if (stmt != null)
>    {
>     try
>     {
>      stmt.close();
>     }
>     catch (SQLException sqlEx)
>     {
>     }
>    }
>
>    rs = null;
>    stmt = null;
>   }
>
>  }
>
> =============================
>
>
> ----- Original Message -----
> From: "jpmlpool" <jp...@hotmail.com>
> To: <us...@geronimo.apache.org>
> Sent: Wednesday, January 02, 2008 9:40 AM
> Subject: question about MySql and Geronimo
>
>
>> Happy New Year !
>>
>>     What I want to do are
>> (1) when I start Geronimo, MySql server is started automatically by
>> Geronimo.
>> (2) I can access MySql,  just like now I can access Derby.
>> (3) if possible, for example, there are two Derbys and two MySqls,  
>> I can
>>      access them for different purpose. I do not know if this is  
>> possible,
>> if
>>      possible, HOW TO DO.
>>
>>     What I did are
>> (1) downloaded MySql 5.0.54 and installed it. (OK)
>> (2) from console I can access the MySql. (OK)
>>
>> mysql> show tables;
>>
>> +-------------------+
>>
>> | Tables_in_hellodb |
>>
>> +-------------------+
>>
>> | pet              |
>>
>> | wishtable        |
>>
>> +-------------------+
>>
>> 2 rows in set (0.00 sec)
>>
>>
>>
>> mysql> SELECT * FROM pet;
>>
>> +----------+-------+---------+------+------------+------------+
>>
>> | name      | owner | species | sex  | birth        | death      |
>>
>> +----------+-------+---------+------+------------+------------+
>>
>> | Fluffy   |         | Harold  | c    | 0000-00-00 | 1993-02-04 |
>>
>> | Claws    |         | Gwen    | c    | 0000-00-00 | 1994-03-17 |
>>
>> | Buffy    |         | Harold  | d    | 0000-00-00 | 1989-05-13 |
>>
>> | Fang     |         | Benny   | d    | 0000-00-00 | 1990-08-27 |
>>
>> | Bowser   |         | Diane   | d    | 0000-00-00 | 1979-08-31 |
>>
>> | Chirpy   |         | Gwen    | b    | 0000-00-00 | 1998-09-11 |
>>
>> | Whistler | Gwen    | bird    |      | 1997-12-09 | NULL       |
>>
>> | Slim     |         | Benny   | s    | 0000-00-00 | 1996-04-29 |
>>
>> +----------+-------+---------+------+------------+------------+
>>
>> 8 rows in set (0.00 sec)
>>
>>
>>
>> (3) downloaded the MySql driver mysql-connector-java-3.1.12.jar
>>
>>      through Geronimo's console.
>>
>>      the driver is placed in repository\mysql\mysql-connector-java 
>> \3.1.12
>>
>>
>>
>> (4) From Eclipse I created a Java Application, and I can
>>
>>      access the MySql using Java code below. The results are correct.
>>
>>
>>
>>      Class.forName("com.mysql.jdbc.Driver").newInstance();
>>
>>      String url = "jdbc:mysql:///hellodb?user=abc&password=xyz";
>>      Connection con = DriverManager.getConnection(url);
>>
>>
>>
>> (5) I created a Dynamic web project and a servlet, and used the
>>
>>      same code in the servlet as above, but I got next error message.
>>
>>
>>
>> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in  
>> classloader
>> com.sn.web.db.mysql.demo.pet/SqlDemoPetStoreId/1.0/war
>>  at
>>
> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimized 
> Class(
>> MultiParentClassLoader.java:428)
>>  at
>>
> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass 
> (MultiPare
>
>> ntClassLoader.java:278)
>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>  at java.lang.Class.forName0(Native Method)
>>  at java.lang.Class.forName(Unknown Source)
>>  at com.sn.web.db.mysql.demo.pet.ListPets.getPets(ListPets.java:82)
>>  at com.sn.web.db.mysql.demo.pet.ListPets.doGet(ListPets.java:43)
>>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>>
>> .....
>>
>>
>>
>> Do you have any ideas ?
>>
>>
>>
>> Thanks in advance.
>>
>>
>>
>> John Qi
>>
>>
>>
>>
>>
>>
>>
>>
>


Questions about MySql and Geronimo

Posted by jpmlpool <jp...@hotmail.com>.
Hello

    I am still struggling with Geronimo and MySql. I tried to change
the deploy plans following some articles, but I still can not access
MySql server from Geronimo.
    Attached are related files, because I zipped Ear and War projects
created on Eclipse, but I cannot send it to this email address.

    If you know my errors, please help me. At the bottom is my previous
email with more details.

Environments or what I did
(1)  Geronimo 2.0.2
(2)  Database pool created from Geronimo Admin console
       Database pool : QiMySql
       Database : hellodb
       a database Table : pet
(3) Eclipse 3.3.1 with WTP
(4) OS : Windows 2000
(5) SqlPetStoreEar and SqiPetStoreWar projects on Eclipse

John Qi

=============================


====== SqlPetStoreEar/EarContent/METF-INF/application.xml ======

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_5.xsd" id="Application_ID"
version="5">
  <module>
    <web>
      <web-uri>SqlPetStoreWar.war</web-uri>
      <context-root>SqlPetStoreWar</context-root>
    </web>
  </module>
</application>

====== SqlPetStoreEar/EarContent/METF-INF/geronimo-application.xml ======

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.1"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
application-name="SqlPetStoreEar">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
      <sys:artifactId>MySqlPetStoreEarId</sys:artifactId>
      <sys:version>1.0</sys:version>
      <sys:type>ear</sys:type>
    </sys:moduleId>
  </sys:environment>

</application>

====== SqlPetStoreWar/WebContent/WEB-INF/geronimo-web.xml ======

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>com.sn.web.db.mysql.demo.pet</sys:groupId>
      <sys:artifactId>SqlPetStoreWarId</sys:artifactId>
      <sys:version>1.0</sys:version>
      <sys:type>war</sys:type>
    </sys:moduleId>


  </sys:environment>

  <context-root>/SqlPetStoreWar</context-root>

</web-app>

====== SqlPetStoreWar/EarContent/WEB-INF/web.xml ======

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
  <display-name>SqlPetStoreWar</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>ListPets</display-name>
    <servlet-name>ListPets</servlet-name>
    <servlet-class>com.sn.web.db.mysql.demo.pet.ListPets</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ListPets</servlet-name>
    <url-pattern>/ListPets</url-pattern>
  </servlet-mapping>

</web-app>

================ ListPets.java ===============

 protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
 {
  // TODO Auto-generated method stub
  this.getPets(request, response);
 }

  private void getPets(HttpServletRequest request, HttpServletResponse
response)
 {
  Statement stmt = null;
  ResultSet rs = null;

  try
  {
   InitialContext ctx = new InitialContext();
   // error : can not find this data source
   DataSource ds = (DataSource)ctx.lookup("java:comp/env/QiMySql");

   // error : this line does not work on Geronimo, but works fine in java
application.
   Class.forName("com.mysql.jdbc.Driver").newInstance();

   String url = "jdbc:mysql:///hellodb?user=root&password=hello";
   Connection con = DriverManager.getConnection(url);

   stmt = con.createStatement();
   String sql = "SELECT * FROM PET";
   rs = stmt.executeQuery(sql);
   while (rs.next())
   {
    String no = rs.getString("NAME");
    String lang = rs.getString("OWNER");
    String msg = rs.getString("SEX");
    System.out.println(no + " " + lang + " " + msg);
   }
   stmt.close();
   con.close();
  }
  catch (Exception e)
  {
   e.printStackTrace();
  }
  finally
  {
   if (rs != null)
   {
    try
    {
     rs.close();
    }
    catch (SQLException sqlEx)
    {
    }
   }

   if (stmt != null)
   {
    try
    {
     stmt.close();
    }
    catch (SQLException sqlEx)
    {
    }
   }

   rs = null;
   stmt = null;
  }

 }

=============================


----- Original Message ----- 
From: "jpmlpool" <jp...@hotmail.com>
To: <us...@geronimo.apache.org>
Sent: Wednesday, January 02, 2008 9:40 AM
Subject: question about MySql and Geronimo


> Happy New Year !
>
>     What I want to do are
> (1) when I start Geronimo, MySql server is started automatically by
> Geronimo.
> (2) I can access MySql,  just like now I can access Derby.
> (3) if possible, for example, there are two Derbys and two MySqls, I can
>      access them for different purpose. I do not know if this is possible,
> if
>      possible, HOW TO DO.
>
>     What I did are
> (1) downloaded MySql 5.0.54 and installed it. (OK)
> (2) from console I can access the MySql. (OK)
>
> mysql> show tables;
>
> +-------------------+
>
> | Tables_in_hellodb |
>
> +-------------------+
>
> | pet              |
>
> | wishtable        |
>
> +-------------------+
>
> 2 rows in set (0.00 sec)
>
>
>
> mysql> SELECT * FROM pet;
>
> +----------+-------+---------+------+------------+------------+
>
> | name      | owner | species | sex  | birth        | death      |
>
> +----------+-------+---------+------+------------+------------+
>
> | Fluffy   |         | Harold  | c    | 0000-00-00 | 1993-02-04 |
>
> | Claws    |         | Gwen    | c    | 0000-00-00 | 1994-03-17 |
>
> | Buffy    |         | Harold  | d    | 0000-00-00 | 1989-05-13 |
>
> | Fang     |         | Benny   | d    | 0000-00-00 | 1990-08-27 |
>
> | Bowser   |         | Diane   | d    | 0000-00-00 | 1979-08-31 |
>
> | Chirpy   |         | Gwen    | b    | 0000-00-00 | 1998-09-11 |
>
> | Whistler | Gwen    | bird    |      | 1997-12-09 | NULL       |
>
> | Slim     |         | Benny   | s    | 0000-00-00 | 1996-04-29 |
>
> +----------+-------+---------+------+------------+------------+
>
> 8 rows in set (0.00 sec)
>
>
>
> (3) downloaded the MySql driver mysql-connector-java-3.1.12.jar
>
>      through Geronimo's console.
>
>      the driver is placed in repository\mysql\mysql-connector-java\3.1.12
>
>
>
> (4) From Eclipse I created a Java Application, and I can
>
>      access the MySql using Java code below. The results are correct.
>
>
>
>      Class.forName("com.mysql.jdbc.Driver").newInstance();
>
>      String url = "jdbc:mysql:///hellodb?user=abc&password=xyz";
>      Connection con = DriverManager.getConnection(url);
>
>
>
> (5) I created a Dynamic web project and a servlet, and used the
>
>      same code in the servlet as above, but I got next error message.
>
>
>
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in classloader
> com.sn.web.db.mysql.demo.pet/SqlDemoPetStoreId/1.0/war
>  at
>
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(
> MultiParentClassLoader.java:428)
>  at
>
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiPare

> ntClassLoader.java:278)
>  at java.lang.ClassLoader.loadClass(Unknown Source)
>  at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>  at java.lang.Class.forName0(Native Method)
>  at java.lang.Class.forName(Unknown Source)
>  at com.sn.web.db.mysql.demo.pet.ListPets.getPets(ListPets.java:82)
>  at com.sn.web.db.mysql.demo.pet.ListPets.doGet(ListPets.java:43)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>
> .....
>
>
>
> Do you have any ideas ?
>
>
>
> Thanks in advance.
>
>
>
> John Qi
>
>
>
>
>
>
>
>


question about MySql and Geronimo

Posted by jpmlpool <jp...@hotmail.com>.
Happy New Year !

    What I want to do are
(1) when I start Geronimo, MySql server is started automatically by
Geronimo.
(2) I can access MySql,  just like now I can access Derby.
(3) if possible, for example, there are two Derbys and two MySqls, I can
     access them for different purpose. I do not know if this is possible,
if
     possible, HOW TO DO.

    What I did are
(1) downloaded MySql 5.0.54 and installed it. (OK)
(2) from console I can access the MySql. (OK)

mysql> show tables;

+-------------------+

| Tables_in_hellodb |

+-------------------+

| pet              |

| wishtable        |

+-------------------+

2 rows in set (0.00 sec)



mysql> SELECT * FROM pet;

+----------+-------+---------+------+------------+------------+

| name      | owner | species | sex  | birth        | death      |

+----------+-------+---------+------+------------+------------+

| Fluffy   |         | Harold  | c    | 0000-00-00 | 1993-02-04 |

| Claws    |         | Gwen    | c    | 0000-00-00 | 1994-03-17 |

| Buffy    |         | Harold  | d    | 0000-00-00 | 1989-05-13 |

| Fang     |         | Benny   | d    | 0000-00-00 | 1990-08-27 |

| Bowser   |         | Diane   | d    | 0000-00-00 | 1979-08-31 |

| Chirpy   |         | Gwen    | b    | 0000-00-00 | 1998-09-11 |

| Whistler | Gwen    | bird    |      | 1997-12-09 | NULL       |

| Slim     |         | Benny   | s    | 0000-00-00 | 1996-04-29 |

+----------+-------+---------+------+------------+------------+

8 rows in set (0.00 sec)



(3) downloaded the MySql driver mysql-connector-java-3.1.12.jar

     through Geronimo's console.

     the driver is placed in repository\mysql\mysql-connector-java\3.1.12



(4) From Eclipse I created a Java Application, and I can

     access the MySql using Java code below. The results are correct.



     Class.forName("com.mysql.jdbc.Driver").newInstance();

     String url = "jdbc:mysql:///hellodb?user=abc&password=xyz";
     Connection con = DriverManager.getConnection(url);



(5) I created a Dynamic web project and a servlet, and used the

     same code in the servlet as above, but I got next error message.



java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in classloader
com.sn.web.db.mysql.demo.pet/SqlDemoPetStoreId/1.0/war
 at
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(
MultiParentClassLoader.java:428)
 at
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiPare
ntClassLoader.java:278)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClassInternal(Unknown Source)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Unknown Source)
 at com.sn.web.db.mysql.demo.pet.ListPets.getPets(ListPets.java:82)
 at com.sn.web.db.mysql.demo.pet.ListPets.doGet(ListPets.java:43)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)

.....



Do you have any ideas ?



Thanks in advance.



John Qi








Re: Geronimo with Liferay library conflict

Posted by jleonar <jl...@gmail.com>.
I added:
                       <dependency>
                               <groupId>xerces</groupId>
                               <artifactId>xerces</artifactId>
                               <version>2.8.0</version>
                               <type>jar</type>
                       </dependency>

The jar is in
c:\geronimo\repository\xerces\xercesImpl\2.8.0\xercesImp-2.8.0.jar

So I tried

                       <dependency>
                               <groupId>xerces</groupId>
                               <artifactId>xercesImpl</artifactId>
                               <version>2.8.0</version>
                               <type>jar</type>
                       </dependency>


Same issue, it is still using the xercesImpl2.6.2 in the /lib/endorsed
directory.  the stacktrace I get is:

java.lang.AbstractMethodError:
javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
	org.opensaml.XML$ParserPool.<init>(Unknown Source)
	org.opensaml.XML.<clinit>(Unknown Source)
	org.opensaml.SAMLObject.fromStream(Unknown Source)
	org.opensaml.SAMLResponse.<init>(Unknown Source)

If I replace the xerces in the /lib/endorsed with the correct version it
works but the console won't work.

-Jim


Jacek Laskowski wrote:
> 
> On Dec 28, 2007 5:48 PM, jleonar <jl...@gmail.com> wrote:
> 
>> "You could try putting xerces in the geronimo repo directly and having
>> a dependency to the jar: then the flags in your app's plan's
>> environment will work."
>>
>> I am not clear on what you mean here.  I definitely could put it in the
>> geronimo repository but I am not sure how to setup liferay to then use it
>> in
>> the geronimo-web.xml
> 
> Things are much easier to set up in the latest Geronimo 2.0.2 (or
> better yet Geronimo 2.1-SNAPSHOT), but if you need to stick with
> Geronimo 1.1 just add
> 
>                        <dependency>
>                               
> <groupId>my.dir.name.under.repository</groupId>
>                                <artifactId>xerces</artifactId>
>                                <type>jar</type>
>                        </dependency>
> 
> to your geronimo-web.xml and you're done.
> 
> Jacek
> 
> -- 
> Jacek Laskowski
> http://www.JacekLaskowski.pl
> 
> 

-- 
View this message in context: http://www.nabble.com/Geronimo-with-Liferay-library-conflict-tp14525371s134p14580002.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo with Liferay library conflict

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Dec 28, 2007 5:48 PM, jleonar <jl...@gmail.com> wrote:

> "You could try putting xerces in the geronimo repo directly and having
> a dependency to the jar: then the flags in your app's plan's
> environment will work."
>
> I am not clear on what you mean here.  I definitely could put it in the
> geronimo repository but I am not sure how to setup liferay to then use it in
> the geronimo-web.xml

Things are much easier to set up in the latest Geronimo 2.0.2 (or
better yet Geronimo 2.1-SNAPSHOT), but if you need to stick with
Geronimo 1.1 just add

                       <dependency>
                               <groupId>my.dir.name.under.repository</groupId>
                               <artifactId>xerces</artifactId>
                               <type>jar</type>
                       </dependency>

to your geronimo-web.xml and you're done.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: Geronimo with Liferay library conflict

Posted by jleonar <jl...@gmail.com>.
The geronimo-web.xml is the stock one that liferay bundles geronimo with.  I
am far from a geronimo expert.  Just making small changes to try and get
this to work.

I can put or remove xerces from anyplace I need.  I put it in the sharedlib
in the hopes I could get liferay to use that library instead of the geronimo
one.

"You could try putting xerces in the geronimo repo directly and having  
a dependency to the jar: then the flags in your app's plan's  
environment will work."

I am not clear on what you mean here.  I definitely could put it in the
geronimo repository but I am not sure how to setup liferay to then use it in
the geronimo-web.xml

As for replacing xercesimpl-2.6.2 with 2.8.0, I tried that in the endorsed
directory and the console stops functioning on xml stacetrace errors.  Would
I need to replace it in other places?  This would be the ideal solution to
be honest.



djencks wrote:
> 
> 
> On Dec 28, 2007, at 8:09 AM, Jacek Laskowski wrote:
> 
>> On Dec 28, 2007 1:40 PM, jleonar <jl...@gmail.com> wrote:
>>
>>> I have some custom code deployed within Liferay(4.3.x) running on  
>>> Geronimo
>>> 1.1
>>>
>>> The custom code uses xercesImpl-2.8.0 or higher.  Geronimo 1.1 uses
>>> xercesImpl-2.6.2.  So my code breaks because it is always using the
>>> xercesImpl-2.6.2 instead of the xercesImpl-2.8.0 jar that I have  
>>> in the
>>> sharedlib folder.
>>
>>>     <hidden-classes>
>>>         <filter>org.apache.xerces</filter>
>>>     </hidden-classes>
>>>                 <dependencies>
>> ...
>>>                         <dependency>
>>>                                 <artifactId>sharedlib</artifactId>
>>>                         </dependency>
>>
>> Can you try out <inverse-classloading /> instead? Is xerces in
>> WEB-INF/lib directory of Liferay? What's the stack trace when
>> Geronimo's Xerces hides the proper classes?
> 
> I think there are a couple problems here...
> I would expect the dependency declaration to need groupId and type to  
> work-- certainly type.
> Neither hidden-classes nor inverse-classloading will make any  
> difference if xerces is in shared-lib: the sharedlib classloader  
> would need to have the hidden-classes or inverse-classloading flag.
> 
> You could try putting xerces in the geronimo repo directly and having  
> a dependency to the jar: then the flags in your app's plan's  
> environment will work.
> 
> If this doesn't work (it may not because IIRC xerces is in one of   
> the lib/* directories that get special classloader treatment from the  
> vm) you might try replacing xerces 2.6.2 with xerces 2.8 for all of  
> geronimo.  IIRC we tried this and the only problems were from the  
> tck's misinterpretation of some ambiguous spec language that was  
> later cleared up.
> 
> You could also try geronimo 2.0.2 which does not include xerces, but  
> this would require java  5.
> 
> hope this helps
> david jencks
> 
>>
>> Jacek
>>
>> -- 
>> Jacek Laskowski
>> http://www.JacekLaskowski.pl
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Geronimo-with-Liferay-library-conflict-tp14525371s134p14528043.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo with Liferay library conflict

Posted by David Jencks <da...@yahoo.com>.
On Dec 28, 2007, at 8:09 AM, Jacek Laskowski wrote:

> On Dec 28, 2007 1:40 PM, jleonar <jl...@gmail.com> wrote:
>
>> I have some custom code deployed within Liferay(4.3.x) running on  
>> Geronimo
>> 1.1
>>
>> The custom code uses xercesImpl-2.8.0 or higher.  Geronimo 1.1 uses
>> xercesImpl-2.6.2.  So my code breaks because it is always using the
>> xercesImpl-2.6.2 instead of the xercesImpl-2.8.0 jar that I have  
>> in the
>> sharedlib folder.
>
>>     <hidden-classes>
>>         <filter>org.apache.xerces</filter>
>>     </hidden-classes>
>>                 <dependencies>
> ...
>>                         <dependency>
>>                                 <artifactId>sharedlib</artifactId>
>>                         </dependency>
>
> Can you try out <inverse-classloading /> instead? Is xerces in
> WEB-INF/lib directory of Liferay? What's the stack trace when
> Geronimo's Xerces hides the proper classes?

I think there are a couple problems here...
I would expect the dependency declaration to need groupId and type to  
work-- certainly type.
Neither hidden-classes nor inverse-classloading will make any  
difference if xerces is in shared-lib: the sharedlib classloader  
would need to have the hidden-classes or inverse-classloading flag.

You could try putting xerces in the geronimo repo directly and having  
a dependency to the jar: then the flags in your app's plan's  
environment will work.

If this doesn't work (it may not because IIRC xerces is in one of   
the lib/* directories that get special classloader treatment from the  
vm) you might try replacing xerces 2.6.2 with xerces 2.8 for all of  
geronimo.  IIRC we tried this and the only problems were from the  
tck's misinterpretation of some ambiguous spec language that was  
later cleared up.

You could also try geronimo 2.0.2 which does not include xerces, but  
this would require java  5.

hope this helps
david jencks

>
> Jacek
>
> -- 
> Jacek Laskowski
> http://www.JacekLaskowski.pl


Re: Geronimo with Liferay library conflict

Posted by jleonar <jl...@gmail.com>.
I appreciate all the help.

That got it working.



Jarek Gawor-2 wrote:
> 
> The <hidden-classes/> element must be specified after the
> <dependencies/> element.
> 
> Jarek
> 
> On Jan 7, 2008 9:51 AM, jleonar <jl...@gmail.com> wrote:
>>
>> Thanks for that little tidbit.  That solved my dependency problems.
>>
>> Now I am getting a stacktrace when trying to deploy the application using
>> the <hidden-classes> tag to hide xerces.  This is the stacktrace I get.
>>
>> 14:46:41,000 ERROR [Hot Deployer] Unable to deploy: xml problem for web
>> app
>> .
>> org.apache.geronimo.common.DeploymentException: xml problem for web app .
>>         at
>> org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.getTomcatWe
>> bApp(TomcatModuleBuilder.java:234)
>>         at
>> org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.createModul
>> e(TomcatModuleBuilder.java:158)
>>         at
>> org.apache.geronimo.web.deployment.AbstractWebModuleBuilder.createMod
>> ule(AbstractWebModuleBuilder.java:121)
>>
>>
>>
>> Caused by: org.apache.xmlbeans.XmlException: Invalid deployment
>> descriptor:
>> [err
>> or: cvc-complex-type.2.4a: Expected elements
>> 'non-overridable-classes@http://ger
>> onimo.apache.org/xml/ns/deployment-1.1
>> inverse-classloading@http://geronimo.apac
>> he.org/xml/ns/deployment-1.1
>> suppress-default-environment@http://geronimo.apache
>> .org/xml/ns/deployment-1.1' instead of
>> 'dependencies@http://geronimo.apache.org/
>> xml/ns/deployment-1.1' here in element
>> environment@http://geronimo.apache.org/xm
>> l/ns/deployment-1.1]
>> Descriptor: <xml-fragment
>> xmlns:dep="http://geronimo.apache.org/xml/ns/deploymen
>> t-1.1" xmlns:tom="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1"
>> xmlns:n
>> am="http://geronimo.apache.org/xml/ns/naming-1.1"
>> xmlns:sec="http://geronimo.apa
>> che.org/xml/ns/security-1.1">
>>   <dep:environment>
>>     <dep:moduleId>
>>       <dep:groupId>liferay</dep:groupId>
>>       <dep:artifactId>liferay-portal-tomcat</dep:artifactId>
>>       <dep:version>4.3.5</dep:version>
>>       <dep:type>car</dep:type>
>>     </dep:moduleId>
>>     <dep:hidden-classes>
>>       <dep:filter>org.apache.xerces</dep:filter>
>>     </dep:hidden-classes>
>>     <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>j2ee-security</dep:artifactId>
>>         <dep:type>car</dep:type>
>>       </dep:dependency>
>>       <dep:dependency>
>>         <dep:groupId>geronimo</dep:groupId>
>>         <dep:artifactId>rmi-naming</dep:artifactId>
>>         <dep:type>car</dep:type>
>>       </dep:dependency>
>>       <dep:dependency>
>>         <dep:groupId>geronimo</dep:groupId>
>>         <dep:artifactId>geronimo-mail</dep:artifactId>
>>         <dep:type>jar</dep:type>
>>         <dep:import>classes</dep:import>
>>       </dep:dependency>
>>       <dep:dependency>
>>         <dep:groupId>org.apache.geronimo.specs</dep:groupId>
>>         <dep:artifactId>geronimo-javamail_1.3.1_spec</dep:artifactId>
>>         <dep:type>jar</dep:type>
>>         <dep:import>classes</dep:import>
>>       </dep:dependency>
>>       <dep:dependency>
>>         <dep:artifactId>sharedlib</dep:artifactId>
>>       </dep:dependency>
>>       <dep:dependency>
>>         <dep:groupId>liferay</dep:groupId>
>>         <dep:artifactId>liferay-pool</dep:artifactId>
>>         <dep:type>car</dep:type>
>>       </dep:dependency>
>>     </dep:dependencies>
>>   </dep:environment>
>>   <tom:context-root>/</tom:context-root>
>>   <nam:resource-ref>
>>     <nam:ref-name>jdbc/LiferayPool</nam:ref-name>
>>     <nam:resource-link>LiferayPool</nam:resource-link>
>>   </nam:resource-ref>
>>   <nam:resource-ref>
>>     <nam:ref-name>mail/MailSession</nam:ref-name>
>>     <nam:resource-link>LiferayMailSession</nam:resource-link>
>>   </nam:resource-ref>
>>   <tom:security-realm-name>PortalRealm</tom:security-realm-name>
>>   <sec:security>
>>     <sec:default-principal>
>>       <sec:principal name="anonymous"
>> class="com.liferay.portal.security.jaas.Po
>> rtalPrincipal"/>
>>     </sec:default-principal>
>>     <sec:role-mappings>
>>       <sec:role role-name="users">
>>         <sec:principal
>> class="com.liferay.portal.security.jaas.PortalRole"
>> name=
>> "users"/>
>>       </sec:role>
>>     </sec:role-mappings>
>>   </sec:security>
>>   <dep:gbean name="LiferayMailSession"
>> class="org.apache.geronimo.mail.MailGBean
>> ">
>>     <dep:attribute name="transportProtocol">smtp</dep:attribute>
>>     <dep:attribute name="host">localhost</dep:attribute>
>>   </dep:gbean>
>>   <dep:gbean name="PortalRealm"
>> class="org.apache.geronimo.security.realm.Generi
>> cSecurityRealm">
>>     <dep:attribute name="realmName">PortalRealm</dep:attribute>
>>     <dep:reference name="ServerInfo">
>>       <dep:name>ServerInfo</dep:name>
>>     </dep:reference>
>>     <dep:reference name="LoginService">
>>       <dep:name>JaasLoginService</dep:name>
>>     </dep:reference>
>>     <dep:xml-reference name="LoginModuleConfiguration">
>>       <log:login-config
>> xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig
>> -1.1">
>>         <log:login-module control-flag="REQUIRED" server-side="true"
>> wrap-princi
>> pals="false">
>>          
>> <log:login-domain-name>PortalRealm-login</log:login-domain-name>
>>
>> <log:login-module-class>com.liferay.portal.security.jaas.ext.tomcat.Po
>> rtalLoginModule</log:login-module-class>
>>         </log:login-module>
>>       </log:login-config>
>>     </dep:xml-reference>
>>   </dep:gbean>
>> </xml-fragment>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> djencks wrote:
>> >
>> > When geronimo deploys a web app we find all the jars in WEB-INF/lib
>> > and include paths to them in the classloader for the web app.  Adding
>> > more jars later doesn't affect the already-constructed classloader.
>> >
>> > In other words, you would have to redeploy liferay with your jars
>> > included to get them into the web app classloader.
>> >
>> > Hope this helps
>> > david jencks
>> >
>> > On Jan 3, 2008, at 7:13 AM, jleonar wrote:
>> >
>> >>
>> >> Ok I think I will take a step back and fix my earlier issues that
>> >> lead me
>> >> down the path where I am today.
>> >>
>> >> Step one took the liferay geronimo bundle and installed.
>> >>
>> >> Let liferay deploy.  Stopped liferay.
>> >> Now I take my custom liferay code and I put it in the liferay
>> >> repository
>> >> inside the WEB-INF folder including required libraries in the WEB-
>> >> INF/lib
>> >> folder.
>> >>
>> >> Start liferay and I get:
>> >> java.lang.NoClassDefFoundError: org/opensaml/SAMLSOAPHTTPBinding
>> >> $HTTPHook
>> >>      at java.lang.Class.getDeclaredConstructors0(Native Method)
>> >>      at
>> java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
>> >>      at java.lang.Class.getConstructor0(Class.java:2671)
>> >>      at java.lang.Class.newInstance0(Class.java:321)
>> >>      at java.lang.Class.newInstance(Class.java:303)
>> >>      at
>> >> org.apache.catalina.core.ApplicationFilterConfig.getFilter
>> >> (ApplicationFilterConfig.java:210)
>> >>      at
>> >> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef
>> >> (ApplicationFilterConfig.java:304)
>> >>      at
>> >> org.apache.catalina.core.ApplicationFilterConfig.<init>
>> >> (ApplicationFilterConfig.java:77)
>> >>      at
>> >> org.apache.catalina.core.StandardContext.filterStart
>> >> (StandardContext.java:3598)
>> >>      at
>> >> org.apache.catalina.core.StandardContext.start(StandardContext.java:
>> >> 4168)
>> >>
>> >> The opensaml jar is in the WEB-INF/lib folder.  The only way I got
>> >> this
>> >> error to go away was by moving all the dependencies for my custom
>> >> code to
>> >> the sharedlib folder.
>> >>
>> >> I think once I get geronimo to load the WEB-INF/lib dependencies
>> >> correctly,
>> >> I will be able to use the inverse-classloading to resolve my other
>> >> issue.
>> >>
>> >> So why isn't the classloader loading the jars in the WEB-INF/lib
>> >> folder
>> >> inside the liferay repository?
>> >>
>> >>
>> >>
>> >>
>> >> Jacek Laskowski wrote:
>> >>>
>> >>> On Dec 28, 2007 1:40 PM, jleonar <jl...@gmail.com> wrote:
>> >>>
>> >>>> I have some custom code deployed within Liferay(4.3.x) running on
>> >>>> Geronimo
>> >>>> 1.1
>> >>>>
>> >>>> The custom code uses xercesImpl-2.8.0 or higher.  Geronimo 1.1 uses
>> >>>> xercesImpl-2.6.2.  So my code breaks because it is always using the
>> >>>> xercesImpl-2.6.2 instead of the xercesImpl-2.8.0 jar that I have
>> >>>> in the
>> >>>> sharedlib folder.
>> >>>
>> >>>>     <hidden-classes>
>> >>>>         <filter>org.apache.xerces</filter>
>> >>>>     </hidden-classes>
>> >>>>                 <dependencies>
>> >>> ...
>> >>>>                         <dependency>
>> >>>>                                 <artifactId>sharedlib</artifactId>
>> >>>>                         </dependency>
>> >>>
>> >>> Can you try out <inverse-classloading /> instead? Is xerces in
>> >>> WEB-INF/lib directory of Liferay? What's the stack trace when
>> >>> Geronimo's Xerces hides the proper classes?
>> >>>
>> >>> Jacek
>> >>>
>> >>> --
>> >>> Jacek Laskowski
>> >>> http://www.JacekLaskowski.pl
>> >>>
>> >>>
>> >>
>> >> --
>> >> View this message in context: http://www.nabble.com/Geronimo-with-
>> >> Liferay-library-conflict-tp14525371s134p14598562.html
>> >> Sent from the Apache Geronimo - Users mailing list archive at
>> >> Nabble.com.
>> >>
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Geronimo-with-Liferay-library-conflict-tp14525371s134p14667577.html
>> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Geronimo-with-Liferay-library-conflict-tp14525371s134p14669083.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo with Liferay library conflict

Posted by Jarek Gawor <jg...@gmail.com>.
The <hidden-classes/> element must be specified after the
<dependencies/> element.

Jarek

On Jan 7, 2008 9:51 AM, jleonar <jl...@gmail.com> wrote:
>
> Thanks for that little tidbit.  That solved my dependency problems.
>
> Now I am getting a stacktrace when trying to deploy the application using
> the <hidden-classes> tag to hide xerces.  This is the stacktrace I get.
>
> 14:46:41,000 ERROR [Hot Deployer] Unable to deploy: xml problem for web app
> .
> org.apache.geronimo.common.DeploymentException: xml problem for web app .
>         at
> org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.getTomcatWe
> bApp(TomcatModuleBuilder.java:234)
>         at
> org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.createModul
> e(TomcatModuleBuilder.java:158)
>         at
> org.apache.geronimo.web.deployment.AbstractWebModuleBuilder.createMod
> ule(AbstractWebModuleBuilder.java:121)
>
>
>
> Caused by: org.apache.xmlbeans.XmlException: Invalid deployment descriptor:
> [err
> or: cvc-complex-type.2.4a: Expected elements
> 'non-overridable-classes@http://ger
> onimo.apache.org/xml/ns/deployment-1.1
> inverse-classloading@http://geronimo.apac
> he.org/xml/ns/deployment-1.1
> suppress-default-environment@http://geronimo.apache
> .org/xml/ns/deployment-1.1' instead of
> 'dependencies@http://geronimo.apache.org/
> xml/ns/deployment-1.1' here in element
> environment@http://geronimo.apache.org/xm
> l/ns/deployment-1.1]
> Descriptor: <xml-fragment
> xmlns:dep="http://geronimo.apache.org/xml/ns/deploymen
> t-1.1" xmlns:tom="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1"
> xmlns:n
> am="http://geronimo.apache.org/xml/ns/naming-1.1"
> xmlns:sec="http://geronimo.apa
> che.org/xml/ns/security-1.1">
>   <dep:environment>
>     <dep:moduleId>
>       <dep:groupId>liferay</dep:groupId>
>       <dep:artifactId>liferay-portal-tomcat</dep:artifactId>
>       <dep:version>4.3.5</dep:version>
>       <dep:type>car</dep:type>
>     </dep:moduleId>
>     <dep:hidden-classes>
>       <dep:filter>org.apache.xerces</dep:filter>
>     </dep:hidden-classes>
>     <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>j2ee-security</dep:artifactId>
>         <dep:type>car</dep:type>
>       </dep:dependency>
>       <dep:dependency>
>         <dep:groupId>geronimo</dep:groupId>
>         <dep:artifactId>rmi-naming</dep:artifactId>
>         <dep:type>car</dep:type>
>       </dep:dependency>
>       <dep:dependency>
>         <dep:groupId>geronimo</dep:groupId>
>         <dep:artifactId>geronimo-mail</dep:artifactId>
>         <dep:type>jar</dep:type>
>         <dep:import>classes</dep:import>
>       </dep:dependency>
>       <dep:dependency>
>         <dep:groupId>org.apache.geronimo.specs</dep:groupId>
>         <dep:artifactId>geronimo-javamail_1.3.1_spec</dep:artifactId>
>         <dep:type>jar</dep:type>
>         <dep:import>classes</dep:import>
>       </dep:dependency>
>       <dep:dependency>
>         <dep:artifactId>sharedlib</dep:artifactId>
>       </dep:dependency>
>       <dep:dependency>
>         <dep:groupId>liferay</dep:groupId>
>         <dep:artifactId>liferay-pool</dep:artifactId>
>         <dep:type>car</dep:type>
>       </dep:dependency>
>     </dep:dependencies>
>   </dep:environment>
>   <tom:context-root>/</tom:context-root>
>   <nam:resource-ref>
>     <nam:ref-name>jdbc/LiferayPool</nam:ref-name>
>     <nam:resource-link>LiferayPool</nam:resource-link>
>   </nam:resource-ref>
>   <nam:resource-ref>
>     <nam:ref-name>mail/MailSession</nam:ref-name>
>     <nam:resource-link>LiferayMailSession</nam:resource-link>
>   </nam:resource-ref>
>   <tom:security-realm-name>PortalRealm</tom:security-realm-name>
>   <sec:security>
>     <sec:default-principal>
>       <sec:principal name="anonymous"
> class="com.liferay.portal.security.jaas.Po
> rtalPrincipal"/>
>     </sec:default-principal>
>     <sec:role-mappings>
>       <sec:role role-name="users">
>         <sec:principal class="com.liferay.portal.security.jaas.PortalRole"
> name=
> "users"/>
>       </sec:role>
>     </sec:role-mappings>
>   </sec:security>
>   <dep:gbean name="LiferayMailSession"
> class="org.apache.geronimo.mail.MailGBean
> ">
>     <dep:attribute name="transportProtocol">smtp</dep:attribute>
>     <dep:attribute name="host">localhost</dep:attribute>
>   </dep:gbean>
>   <dep:gbean name="PortalRealm"
> class="org.apache.geronimo.security.realm.Generi
> cSecurityRealm">
>     <dep:attribute name="realmName">PortalRealm</dep:attribute>
>     <dep:reference name="ServerInfo">
>       <dep:name>ServerInfo</dep:name>
>     </dep:reference>
>     <dep:reference name="LoginService">
>       <dep:name>JaasLoginService</dep:name>
>     </dep:reference>
>     <dep:xml-reference name="LoginModuleConfiguration">
>       <log:login-config
> xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig
> -1.1">
>         <log:login-module control-flag="REQUIRED" server-side="true"
> wrap-princi
> pals="false">
>           <log:login-domain-name>PortalRealm-login</log:login-domain-name>
>
> <log:login-module-class>com.liferay.portal.security.jaas.ext.tomcat.Po
> rtalLoginModule</log:login-module-class>
>         </log:login-module>
>       </log:login-config>
>     </dep:xml-reference>
>   </dep:gbean>
> </xml-fragment>
>
>
>
>
>
>
>
>
>
>
>
>
> djencks wrote:
> >
> > When geronimo deploys a web app we find all the jars in WEB-INF/lib
> > and include paths to them in the classloader for the web app.  Adding
> > more jars later doesn't affect the already-constructed classloader.
> >
> > In other words, you would have to redeploy liferay with your jars
> > included to get them into the web app classloader.
> >
> > Hope this helps
> > david jencks
> >
> > On Jan 3, 2008, at 7:13 AM, jleonar wrote:
> >
> >>
> >> Ok I think I will take a step back and fix my earlier issues that
> >> lead me
> >> down the path where I am today.
> >>
> >> Step one took the liferay geronimo bundle and installed.
> >>
> >> Let liferay deploy.  Stopped liferay.
> >> Now I take my custom liferay code and I put it in the liferay
> >> repository
> >> inside the WEB-INF folder including required libraries in the WEB-
> >> INF/lib
> >> folder.
> >>
> >> Start liferay and I get:
> >> java.lang.NoClassDefFoundError: org/opensaml/SAMLSOAPHTTPBinding
> >> $HTTPHook
> >>      at java.lang.Class.getDeclaredConstructors0(Native Method)
> >>      at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
> >>      at java.lang.Class.getConstructor0(Class.java:2671)
> >>      at java.lang.Class.newInstance0(Class.java:321)
> >>      at java.lang.Class.newInstance(Class.java:303)
> >>      at
> >> org.apache.catalina.core.ApplicationFilterConfig.getFilter
> >> (ApplicationFilterConfig.java:210)
> >>      at
> >> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef
> >> (ApplicationFilterConfig.java:304)
> >>      at
> >> org.apache.catalina.core.ApplicationFilterConfig.<init>
> >> (ApplicationFilterConfig.java:77)
> >>      at
> >> org.apache.catalina.core.StandardContext.filterStart
> >> (StandardContext.java:3598)
> >>      at
> >> org.apache.catalina.core.StandardContext.start(StandardContext.java:
> >> 4168)
> >>
> >> The opensaml jar is in the WEB-INF/lib folder.  The only way I got
> >> this
> >> error to go away was by moving all the dependencies for my custom
> >> code to
> >> the sharedlib folder.
> >>
> >> I think once I get geronimo to load the WEB-INF/lib dependencies
> >> correctly,
> >> I will be able to use the inverse-classloading to resolve my other
> >> issue.
> >>
> >> So why isn't the classloader loading the jars in the WEB-INF/lib
> >> folder
> >> inside the liferay repository?
> >>
> >>
> >>
> >>
> >> Jacek Laskowski wrote:
> >>>
> >>> On Dec 28, 2007 1:40 PM, jleonar <jl...@gmail.com> wrote:
> >>>
> >>>> I have some custom code deployed within Liferay(4.3.x) running on
> >>>> Geronimo
> >>>> 1.1
> >>>>
> >>>> The custom code uses xercesImpl-2.8.0 or higher.  Geronimo 1.1 uses
> >>>> xercesImpl-2.6.2.  So my code breaks because it is always using the
> >>>> xercesImpl-2.6.2 instead of the xercesImpl-2.8.0 jar that I have
> >>>> in the
> >>>> sharedlib folder.
> >>>
> >>>>     <hidden-classes>
> >>>>         <filter>org.apache.xerces</filter>
> >>>>     </hidden-classes>
> >>>>                 <dependencies>
> >>> ...
> >>>>                         <dependency>
> >>>>                                 <artifactId>sharedlib</artifactId>
> >>>>                         </dependency>
> >>>
> >>> Can you try out <inverse-classloading /> instead? Is xerces in
> >>> WEB-INF/lib directory of Liferay? What's the stack trace when
> >>> Geronimo's Xerces hides the proper classes?
> >>>
> >>> Jacek
> >>>
> >>> --
> >>> Jacek Laskowski
> >>> http://www.JacekLaskowski.pl
> >>>
> >>>
> >>
> >> --
> >> View this message in context: http://www.nabble.com/Geronimo-with-
> >> Liferay-library-conflict-tp14525371s134p14598562.html
> >> Sent from the Apache Geronimo - Users mailing list archive at
> >> Nabble.com.
> >>
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Geronimo-with-Liferay-library-conflict-tp14525371s134p14667577.html
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>
>

Re: Geronimo with Liferay library conflict

Posted by jleonar <jl...@gmail.com>.
Thanks for that little tidbit.  That solved my dependency problems.

Now I am getting a stacktrace when trying to deploy the application using
the <hidden-classes> tag to hide xerces.  This is the stacktrace I get.

14:46:41,000 ERROR [Hot Deployer] Unable to deploy: xml problem for web app
.
org.apache.geronimo.common.DeploymentException: xml problem for web app .
        at
org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.getTomcatWe
bApp(TomcatModuleBuilder.java:234)
        at
org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.createModul
e(TomcatModuleBuilder.java:158)
        at
org.apache.geronimo.web.deployment.AbstractWebModuleBuilder.createMod
ule(AbstractWebModuleBuilder.java:121)



Caused by: org.apache.xmlbeans.XmlException: Invalid deployment descriptor:
[err
or: cvc-complex-type.2.4a: Expected elements
'non-overridable-classes@http://ger
onimo.apache.org/xml/ns/deployment-1.1
inverse-classloading@http://geronimo.apac
he.org/xml/ns/deployment-1.1
suppress-default-environment@http://geronimo.apache
.org/xml/ns/deployment-1.1' instead of
'dependencies@http://geronimo.apache.org/
xml/ns/deployment-1.1' here in element
environment@http://geronimo.apache.org/xm
l/ns/deployment-1.1]
Descriptor: <xml-fragment
xmlns:dep="http://geronimo.apache.org/xml/ns/deploymen
t-1.1" xmlns:tom="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1"
xmlns:n
am="http://geronimo.apache.org/xml/ns/naming-1.1"
xmlns:sec="http://geronimo.apa
che.org/xml/ns/security-1.1">
  <dep:environment>
    <dep:moduleId>
      <dep:groupId>liferay</dep:groupId>
      <dep:artifactId>liferay-portal-tomcat</dep:artifactId>
      <dep:version>4.3.5</dep:version>
      <dep:type>car</dep:type>
    </dep:moduleId>
    <dep:hidden-classes>
      <dep:filter>org.apache.xerces</dep:filter>
    </dep:hidden-classes>
    <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>j2ee-security</dep:artifactId>
        <dep:type>car</dep:type>
      </dep:dependency>
      <dep:dependency>
        <dep:groupId>geronimo</dep:groupId>
        <dep:artifactId>rmi-naming</dep:artifactId>
        <dep:type>car</dep:type>
      </dep:dependency>
      <dep:dependency>
        <dep:groupId>geronimo</dep:groupId>
        <dep:artifactId>geronimo-mail</dep:artifactId>
        <dep:type>jar</dep:type>
        <dep:import>classes</dep:import>
      </dep:dependency>
      <dep:dependency>
        <dep:groupId>org.apache.geronimo.specs</dep:groupId>
        <dep:artifactId>geronimo-javamail_1.3.1_spec</dep:artifactId>
        <dep:type>jar</dep:type>
        <dep:import>classes</dep:import>
      </dep:dependency>
      <dep:dependency>
        <dep:artifactId>sharedlib</dep:artifactId>
      </dep:dependency>
      <dep:dependency>
        <dep:groupId>liferay</dep:groupId>
        <dep:artifactId>liferay-pool</dep:artifactId>
        <dep:type>car</dep:type>
      </dep:dependency>
    </dep:dependencies>
  </dep:environment>
  <tom:context-root>/</tom:context-root>
  <nam:resource-ref>
    <nam:ref-name>jdbc/LiferayPool</nam:ref-name>
    <nam:resource-link>LiferayPool</nam:resource-link>
  </nam:resource-ref>
  <nam:resource-ref>
    <nam:ref-name>mail/MailSession</nam:ref-name>
    <nam:resource-link>LiferayMailSession</nam:resource-link>
  </nam:resource-ref>
  <tom:security-realm-name>PortalRealm</tom:security-realm-name>
  <sec:security>
    <sec:default-principal>
      <sec:principal name="anonymous"
class="com.liferay.portal.security.jaas.Po
rtalPrincipal"/>
    </sec:default-principal>
    <sec:role-mappings>
      <sec:role role-name="users">
        <sec:principal class="com.liferay.portal.security.jaas.PortalRole"
name=
"users"/>
      </sec:role>
    </sec:role-mappings>
  </sec:security>
  <dep:gbean name="LiferayMailSession"
class="org.apache.geronimo.mail.MailGBean
">
    <dep:attribute name="transportProtocol">smtp</dep:attribute>
    <dep:attribute name="host">localhost</dep:attribute>
  </dep:gbean>
  <dep:gbean name="PortalRealm"
class="org.apache.geronimo.security.realm.Generi
cSecurityRealm">
    <dep:attribute name="realmName">PortalRealm</dep:attribute>
    <dep:reference name="ServerInfo">
      <dep:name>ServerInfo</dep:name>
    </dep:reference>
    <dep:reference name="LoginService">
      <dep:name>JaasLoginService</dep:name>
    </dep:reference>
    <dep:xml-reference name="LoginModuleConfiguration">
      <log:login-config
xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig
-1.1">
        <log:login-module control-flag="REQUIRED" server-side="true"
wrap-princi
pals="false">
          <log:login-domain-name>PortalRealm-login</log:login-domain-name>
         
<log:login-module-class>com.liferay.portal.security.jaas.ext.tomcat.Po
rtalLoginModule</log:login-module-class>
        </log:login-module>
      </log:login-config>
    </dep:xml-reference>
  </dep:gbean>
</xml-fragment>












djencks wrote:
> 
> When geronimo deploys a web app we find all the jars in WEB-INF/lib  
> and include paths to them in the classloader for the web app.  Adding  
> more jars later doesn't affect the already-constructed classloader.
> 
> In other words, you would have to redeploy liferay with your jars  
> included to get them into the web app classloader.
> 
> Hope this helps
> david jencks
> 
> On Jan 3, 2008, at 7:13 AM, jleonar wrote:
> 
>>
>> Ok I think I will take a step back and fix my earlier issues that  
>> lead me
>> down the path where I am today.
>>
>> Step one took the liferay geronimo bundle and installed.
>>
>> Let liferay deploy.  Stopped liferay.
>> Now I take my custom liferay code and I put it in the liferay  
>> repository
>> inside the WEB-INF folder including required libraries in the WEB- 
>> INF/lib
>> folder.
>>
>> Start liferay and I get:
>> java.lang.NoClassDefFoundError: org/opensaml/SAMLSOAPHTTPBinding 
>> $HTTPHook
>> 	at java.lang.Class.getDeclaredConstructors0(Native Method)
>> 	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
>> 	at java.lang.Class.getConstructor0(Class.java:2671)
>> 	at java.lang.Class.newInstance0(Class.java:321)
>> 	at java.lang.Class.newInstance(Class.java:303)
>> 	at
>> org.apache.catalina.core.ApplicationFilterConfig.getFilter 
>> (ApplicationFilterConfig.java:210)
>> 	at
>> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef 
>> (ApplicationFilterConfig.java:304)
>> 	at
>> org.apache.catalina.core.ApplicationFilterConfig.<init> 
>> (ApplicationFilterConfig.java:77)
>> 	at
>> org.apache.catalina.core.StandardContext.filterStart 
>> (StandardContext.java:3598)
>> 	at
>> org.apache.catalina.core.StandardContext.start(StandardContext.java: 
>> 4168)
>>
>> The opensaml jar is in the WEB-INF/lib folder.  The only way I got  
>> this
>> error to go away was by moving all the dependencies for my custom  
>> code to
>> the sharedlib folder.
>>
>> I think once I get geronimo to load the WEB-INF/lib dependencies  
>> correctly,
>> I will be able to use the inverse-classloading to resolve my other  
>> issue.
>>
>> So why isn't the classloader loading the jars in the WEB-INF/lib  
>> folder
>> inside the liferay repository?
>>
>>
>>
>>
>> Jacek Laskowski wrote:
>>>
>>> On Dec 28, 2007 1:40 PM, jleonar <jl...@gmail.com> wrote:
>>>
>>>> I have some custom code deployed within Liferay(4.3.x) running on
>>>> Geronimo
>>>> 1.1
>>>>
>>>> The custom code uses xercesImpl-2.8.0 or higher.  Geronimo 1.1 uses
>>>> xercesImpl-2.6.2.  So my code breaks because it is always using the
>>>> xercesImpl-2.6.2 instead of the xercesImpl-2.8.0 jar that I have  
>>>> in the
>>>> sharedlib folder.
>>>
>>>>     <hidden-classes>
>>>>         <filter>org.apache.xerces</filter>
>>>>     </hidden-classes>
>>>>                 <dependencies>
>>> ...
>>>>                         <dependency>
>>>>                                 <artifactId>sharedlib</artifactId>
>>>>                         </dependency>
>>>
>>> Can you try out <inverse-classloading /> instead? Is xerces in
>>> WEB-INF/lib directory of Liferay? What's the stack trace when
>>> Geronimo's Xerces hides the proper classes?
>>>
>>> Jacek
>>>
>>> -- 
>>> Jacek Laskowski
>>> http://www.JacekLaskowski.pl
>>>
>>>
>>
>> -- 
>> View this message in context: http://www.nabble.com/Geronimo-with- 
>> Liferay-library-conflict-tp14525371s134p14598562.html
>> Sent from the Apache Geronimo - Users mailing list archive at  
>> Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Geronimo-with-Liferay-library-conflict-tp14525371s134p14667577.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo with Liferay library conflict

Posted by David Jencks <da...@yahoo.com>.
When geronimo deploys a web app we find all the jars in WEB-INF/lib  
and include paths to them in the classloader for the web app.  Adding  
more jars later doesn't affect the already-constructed classloader.

In other words, you would have to redeploy liferay with your jars  
included to get them into the web app classloader.

Hope this helps
david jencks

On Jan 3, 2008, at 7:13 AM, jleonar wrote:

>
> Ok I think I will take a step back and fix my earlier issues that  
> lead me
> down the path where I am today.
>
> Step one took the liferay geronimo bundle and installed.
>
> Let liferay deploy.  Stopped liferay.
> Now I take my custom liferay code and I put it in the liferay  
> repository
> inside the WEB-INF folder including required libraries in the WEB- 
> INF/lib
> folder.
>
> Start liferay and I get:
> java.lang.NoClassDefFoundError: org/opensaml/SAMLSOAPHTTPBinding 
> $HTTPHook
> 	at java.lang.Class.getDeclaredConstructors0(Native Method)
> 	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
> 	at java.lang.Class.getConstructor0(Class.java:2671)
> 	at java.lang.Class.newInstance0(Class.java:321)
> 	at java.lang.Class.newInstance(Class.java:303)
> 	at
> org.apache.catalina.core.ApplicationFilterConfig.getFilter 
> (ApplicationFilterConfig.java:210)
> 	at
> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef 
> (ApplicationFilterConfig.java:304)
> 	at
> org.apache.catalina.core.ApplicationFilterConfig.<init> 
> (ApplicationFilterConfig.java:77)
> 	at
> org.apache.catalina.core.StandardContext.filterStart 
> (StandardContext.java:3598)
> 	at
> org.apache.catalina.core.StandardContext.start(StandardContext.java: 
> 4168)
>
> The opensaml jar is in the WEB-INF/lib folder.  The only way I got  
> this
> error to go away was by moving all the dependencies for my custom  
> code to
> the sharedlib folder.
>
> I think once I get geronimo to load the WEB-INF/lib dependencies  
> correctly,
> I will be able to use the inverse-classloading to resolve my other  
> issue.
>
> So why isn't the classloader loading the jars in the WEB-INF/lib  
> folder
> inside the liferay repository?
>
>
>
>
> Jacek Laskowski wrote:
>>
>> On Dec 28, 2007 1:40 PM, jleonar <jl...@gmail.com> wrote:
>>
>>> I have some custom code deployed within Liferay(4.3.x) running on
>>> Geronimo
>>> 1.1
>>>
>>> The custom code uses xercesImpl-2.8.0 or higher.  Geronimo 1.1 uses
>>> xercesImpl-2.6.2.  So my code breaks because it is always using the
>>> xercesImpl-2.6.2 instead of the xercesImpl-2.8.0 jar that I have  
>>> in the
>>> sharedlib folder.
>>
>>>     <hidden-classes>
>>>         <filter>org.apache.xerces</filter>
>>>     </hidden-classes>
>>>                 <dependencies>
>> ...
>>>                         <dependency>
>>>                                 <artifactId>sharedlib</artifactId>
>>>                         </dependency>
>>
>> Can you try out <inverse-classloading /> instead? Is xerces in
>> WEB-INF/lib directory of Liferay? What's the stack trace when
>> Geronimo's Xerces hides the proper classes?
>>
>> Jacek
>>
>> -- 
>> Jacek Laskowski
>> http://www.JacekLaskowski.pl
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Geronimo-with- 
> Liferay-library-conflict-tp14525371s134p14598562.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Re: Geronimo with Liferay library conflict

Posted by jleonar <jl...@gmail.com>.
Ok I think I will take a step back and fix my earlier issues that lead me
down the path where I am today.

Step one took the liferay geronimo bundle and installed.

Let liferay deploy.  Stopped liferay.
Now I take my custom liferay code and I put it in the liferay repository
inside the WEB-INF folder including required libraries in the WEB-INF/lib
folder.

Start liferay and I get:
java.lang.NoClassDefFoundError: org/opensaml/SAMLSOAPHTTPBinding$HTTPHook
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
	at java.lang.Class.getConstructor0(Class.java:2671)
	at java.lang.Class.newInstance0(Class.java:321)
	at java.lang.Class.newInstance(Class.java:303)
	at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:210)
	at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
	at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77)
	at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3598)
	at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4168)

The opensaml jar is in the WEB-INF/lib folder.  The only way I got this
error to go away was by moving all the dependencies for my custom code to
the sharedlib folder.

I think once I get geronimo to load the WEB-INF/lib dependencies correctly,
I will be able to use the inverse-classloading to resolve my other issue.

So why isn't the classloader loading the jars in the WEB-INF/lib folder
inside the liferay repository?




Jacek Laskowski wrote:
> 
> On Dec 28, 2007 1:40 PM, jleonar <jl...@gmail.com> wrote:
> 
>> I have some custom code deployed within Liferay(4.3.x) running on
>> Geronimo
>> 1.1
>>
>> The custom code uses xercesImpl-2.8.0 or higher.  Geronimo 1.1 uses
>> xercesImpl-2.6.2.  So my code breaks because it is always using the
>> xercesImpl-2.6.2 instead of the xercesImpl-2.8.0 jar that I have in the
>> sharedlib folder.
> 
>>     <hidden-classes>
>>         <filter>org.apache.xerces</filter>
>>     </hidden-classes>
>>                 <dependencies>
> ...
>>                         <dependency>
>>                                 <artifactId>sharedlib</artifactId>
>>                         </dependency>
> 
> Can you try out <inverse-classloading /> instead? Is xerces in
> WEB-INF/lib directory of Liferay? What's the stack trace when
> Geronimo's Xerces hides the proper classes?
> 
> Jacek
> 
> -- 
> Jacek Laskowski
> http://www.JacekLaskowski.pl
> 
> 

-- 
View this message in context: http://www.nabble.com/Geronimo-with-Liferay-library-conflict-tp14525371s134p14598562.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo with Liferay library conflict

Posted by jleonar <jl...@gmail.com>.
Xerces is in the WEB-INF/lib folder under liferay.

I get the same stacktrace whether i use the hide classes or the inverse
classloading or both.

This is what I get.

java.lang.AbstractMethodError:
javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
	org.opensaml.XML$ParserPool.<init>(Unknown Source)
	org.opensaml.XML.<clinit>(Unknown Source)
	org.opensaml.SAMLObject.fromStream(Unknown Source)
	org.opensaml.SAMLResponse.<init>(Unknown Source)

The error is resolved by replacing the xercesImpl jar in the "geronimo
home"/lib/endorsed/ directory.

I just can't seem to get liferay to use the correct version of xerces with
geronimo.




Jacek Laskowski wrote:
> 
> On Dec 28, 2007 1:40 PM, jleonar <jl...@gmail.com> wrote:
> 
>> I have some custom code deployed within Liferay(4.3.x) running on
>> Geronimo
>> 1.1
>>
>> The custom code uses xercesImpl-2.8.0 or higher.  Geronimo 1.1 uses
>> xercesImpl-2.6.2.  So my code breaks because it is always using the
>> xercesImpl-2.6.2 instead of the xercesImpl-2.8.0 jar that I have in the
>> sharedlib folder.
> 
>>     <hidden-classes>
>>         <filter>org.apache.xerces</filter>
>>     </hidden-classes>
>>                 <dependencies>
> ...
>>                         <dependency>
>>                                 <artifactId>sharedlib</artifactId>
>>                         </dependency>
> 
> Can you try out <inverse-classloading /> instead? Is xerces in
> WEB-INF/lib directory of Liferay? What's the stack trace when
> Geronimo's Xerces hides the proper classes?
> 
> Jacek
> 
> -- 
> Jacek Laskowski
> http://www.JacekLaskowski.pl
> 
> 

-- 
View this message in context: http://www.nabble.com/Geronimo-with-Liferay-library-conflict-tp14525371s134p14528039.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo with Liferay library conflict

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Dec 28, 2007 1:40 PM, jleonar <jl...@gmail.com> wrote:

> I have some custom code deployed within Liferay(4.3.x) running on Geronimo
> 1.1
>
> The custom code uses xercesImpl-2.8.0 or higher.  Geronimo 1.1 uses
> xercesImpl-2.6.2.  So my code breaks because it is always using the
> xercesImpl-2.6.2 instead of the xercesImpl-2.8.0 jar that I have in the
> sharedlib folder.

>     <hidden-classes>
>         <filter>org.apache.xerces</filter>
>     </hidden-classes>
>                 <dependencies>
...
>                         <dependency>
>                                 <artifactId>sharedlib</artifactId>
>                         </dependency>

Can you try out <inverse-classloading /> instead? Is xerces in
WEB-INF/lib directory of Liferay? What's the stack trace when
Geronimo's Xerces hides the proper classes?

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl