geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Zink <jochenl...@web.de>
Subject Re: ClassCastException while using the gloabl JNDI Context
Date Mon, 26 Nov 2007 15:23:30 GMT
Thank you for your answer.

Sure, the classloaders must be different. The first Webapp is a standalone Webapplication
and the second (the one which makes the lookup) is inside an ear.

I added the System.outs. you want and I get the following output:

>>> RolleDTO's classloader [org.apache.geronimo.kernel.classloader.JarFileClassLoader
id=com.accumio.ae/ear/1.0/ear]
>>> RolleDTO's from JNDI classloader [org.apache.geronimo.kernel.classloader.JarFileClassLoader
id=com.accumio.ae.LieferantenVerwaltung/Webapp/1.0/car]

Here is the geronimo-web.xml from the Webapplication which puts the RolleDTO to JNDI:
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
	xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1">
	<dep:environment
		xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
		<dep:moduleId>
			<dep:groupId>com.accumio.ae.LieferantenVerwaltung</dep:groupId>
			<dep:artifactId>Webapp</dep:artifactId>
			<dep:version>1.0</dep:version>
			<dep:type>car</dep:type>
		</dep:moduleId>
		<dep:dependencies>
			<dep:dependency>
				<dep:groupId>com.accumio.ae</dep:groupId>
                                <dep:artifactId>AE-Base</dep:artifactId>
                                <dep:version>1.0</dep:version>
                                <dep:type>jar</dep:type>
			</dep:dependency>	
			<dep:dependency>
				<dep:groupId>com.accumio.ae</dep:groupId>
                <dep:artifactId>pushAEConnectionPool</dep:artifactId>
			</dep:dependency>			
			<dep:dependency>
				<dep:groupId>com.accumio.ae</dep:groupId>
                <dep:artifactId>bev2DataSource</dep:artifactId>
			</dep:dependency>
		</dep:dependencies>
		<dep:hidden-classes>
		</dep:hidden-classes>		
		<dep:non-overridable-classes />
	</dep:environment>
	<context-root>/lieferantenverwaltung</context-root>
	<resource-ref>
		<ref-name>jdbc/pushAEConnectionPool</ref-name>
		<resource-link>pushAEConnectionPool</resource-link>
	</resource-ref>	
	<resource-ref>
		<ref-name>jdbc/BEVPooledDS</ref-name>
		<resource-link>bev2DataSource</resource-link>
	</resource-ref>
</web-app>

The relevant dependency is
<dep:dependency>
      <dep:groupId>com.accumio.ae</dep:groupId>
      <dep:artifactId>AE-Base</dep:artifactId>
      <dep:version>1.0</dep:version>
      <dep:type>jar</dep:type>
</dep:dependency>	


And the deployment plan of the Webapplication which trys to lookup the RolleDTO Object:
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
	xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1">
	<dep:environment
		xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
		<dep:moduleId>
			<dep:groupId>com.accumio.ae.JobTrigger</dep:groupId>
			<dep:artifactId>Webapp</dep:artifactId>
			<dep:version>1.0</dep:version>
			<dep:type>car</dep:type>
		</dep:moduleId>
		<dep:dependencies>
			<dep:dependency>
				<dep:groupId>com.accumio.ae</dep:groupId>
            <dep:artifactId>AE-Base</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>jar</dep:type>
			</dep:dependency>	
			<dep:dependency>
				<dep:groupId>com.accumio.ae</dep:groupId>
                <dep:artifactId>pushAEConnectionPool</dep:artifactId>
			</dep:dependency>
		</dep:dependencies>
		<dep:hidden-classes>
		</dep:hidden-classes>		
		<dep:non-overridable-classes />
	</dep:environment>
	<context-root>/pushaetrigger</context-root>
	<resource-ref>
		<ref-name>jdbc/pushAEConnectionPool</ref-name>
		<resource-link>pushAEConnectionPool</resource-link>
	</resource-ref>
</web-app>


Thanks a lot!

Regards!
Jochen

> -----Urspr√ľngliche Nachricht-----
> Von: user@geronimo.apache.org
> Gesendet: 26.11.07 15:54:28
> An: user@geronimo.apache.org
> Betreff: Re: ClassCastException while using the gloabl JNDI Context


> 
> On Nov 26, 2007 3:33 PM, Jochen Zink <jochenlist@web.de> wrote:
> 
> > InitialContext ic = new InitialContext();
> > Context context = (Context) ic.lookup("ger:");
> > RolleDTO rolle = (RolleDTO) context.lookup("myObject ");
> >
> > The Result is the follwoing ClassCastException.
> 
> Could you do the following in your code so it gets easier to track it
> down (writting it from the top off my head - sorry for typos):
> 
> InitialContext ic = new InitialContext();
> Context context = (Context) ic.lookup("ger:");
> System.out.println(">>> RolleDTO's classloader" +
> RolleDTO.class.getClassLoader());
> Object myObj = context.lookup("myObject ");
> System.out.println(">>> RolleDTO from JNDI's classloader" +
> myObj.getClass().getClassLoader());
> 
> They're surely different. Could you attach geronimo plans for the
> webapp and the ear?
> 
> Jacek
> 
> -- 
> Jacek Laskowski
> http://www.JacekLaskowski.pl
> 


_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066


Mime
View raw message