You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by ptriller <pt...@soapwars.de> on 2007/05/27 21:09:11 UTC

Resource Refs in an ejb-jar inside an EAR on Geronimo 2-0-M5

Hi !

Ok, my Problem.

I try to have some EE5 MDBs inside an EAR for geronimo-2.0-M5.

I managed to add the resource-adapter to my EAR, and it seems to work.
Becaue I can inject
the resources from the Resource Adapter  into a Listener class in my Webapp
(also included in
my EAR) and if I voluntarily add some typos to the resource adapter or the
resource-ref or
resource-env-res in my geronimo-web, I get deployment errors.

So far so good.

Now I want to add an ejb-jar with an MDB. ok.... 

I write an EJB .. annotate it. and put it in a jar ... add it to the
application.xml .. all is well.

That works no problem with stateless session beans .. but now I have some
JNDI  and env
resources to map ..
so I add an openejb-jar.xml to the jar .

It seems they changed the xsd for this file substantially in the 2.0
release.. I had to
get the xsd from the geronimo server to know what I should do.

The new format seems to be very simplistic compared to the old ones....

my current openejb-jar.xml is

<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
	<ejb-deployment ejb-name="ScheduledTestEJB">
		<resource-link res-ref-name="jms/QueueConnectionFactory"
			res-id="ConnectionFactory" />
		<resource-link res-ref-name="jms/ScheduleManagerQueue"
			res-id="ScheduleManagerQueue" />
		<resource-link res-ref-name="jms/ScheduledTopic"
			res-id="ScheduledTopic" />
	</ejb-deployment>
</openejb-jar>

If I try to use the old format, I only get parse errors...


so ... My question is.

How do I map env-resources (in my case JMX Topics and Queues)  and normal
resources correctly with this new openejb format ?


Thanks


Peter
-- 
View this message in context: http://www.nabble.com/Resource-Refs-in-an-ejb-jar-inside-an-EAR-on-Geronimo-2-0-M5-tf3824624s134.html#a10827459
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Resource Refs in an ejb-jar inside an EAR on Geronimo 2-0-M5

Posted by jklcom99 <je...@yahoo.com>.
Hi David,

I'm not sure if the problem I'm having is related to openejb or something
I'm missing in migrating from 1.1.1 to 2.1.2.
Can you take a look at this thread
http://www.nabble.com/javax.jms.JMSException%3A-Failed-to-build-body-from-bytes-td18404327s134.html
to see if you can spot something?

Thank you


djencks wrote:
> 
> 
> On May 27, 2007, at 12:09 PM, ptriller wrote:
> 
>>
>> Hi !
>>
>> Ok, my Problem.
>>
>> I try to have some EE5 MDBs inside an EAR for geronimo-2.0-M5.
>>
>> I managed to add the resource-adapter to my EAR, and it seems to work.
>> Becaue I can inject
>> the resources from the Resource Adapter  into a Listener class in  
>> my Webapp
>> (also included in
>> my EAR) and if I voluntarily add some typos to the resource adapter  
>> or the
>> resource-ref or
>> resource-env-res in my geronimo-web, I get deployment errors.
>>
>> So far so good.
>>
>> Now I want to add an ejb-jar with an MDB. ok....
>>
>> I write an EJB .. annotate it. and put it in a jar ... add it to the
>> application.xml .. all is well.
>>
>> That works no problem with stateless session beans .. but now I  
>> have some
>> JNDI  and env
>> resources to map ..
>> so I add an openejb-jar.xml to the jar .
>>
>> It seems they changed the xsd for this file substantially in the 2.0
>> release.. I had to
>> get the xsd from the geronimo server to know what I should do.
>>
>> The new format seems to be very simplistic compared to the old  
>> ones....
>>
>> my current openejb-jar.xml is
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
>> 	<ejb-deployment ejb-name="ScheduledTestEJB">
>> 		<resource-link res-ref-name="jms/QueueConnectionFactory"
>> 			res-id="ConnectionFactory" />
>> 		<resource-link res-ref-name="jms/ScheduleManagerQueue"
>> 			res-id="ScheduleManagerQueue" />
>> 		<resource-link res-ref-name="jms/ScheduledTopic"
>> 			res-id="ScheduledTopic" />
>> 	</ejb-deployment>
>> </openejb-jar>
>>
>> If I try to use the old format, I only get parse errors...
>>
>>
>> so ... My question is.
>>
>> How do I map env-resources (in my case JMX Topics and Queues)  and  
>> normal
>> resources correctly with this new openejb format ?
> 
> The openejb 2.x xml plan format should still work, it is either  
> converted on the fly to the new format or understood by some part of  
> the deployer.  I've been seeing one error message per ejb  plan but  
> it doesn't seem to have any bad effects, the ejbs still deploy and  
> work fine.
> 
> The last I heard was that it was better to use the 2.x plans rather  
> than a 3.x plan for openejb stuff since the conversion code will  
> continue to be maintained but the 3.x schema is subject to change  
> without any backward compatibility -- you would have  to update your  
> plans yourself.
> 
> What is actually not working with the 2.x plans?
> 
> thanks
> david jencks
> 
>>
>>
>> Thanks
>>
>>
>> Peter
>> -- 
>> View this message in context: http://www.nabble.com/Resource-Refs- 
>> in-an-ejb-jar-inside-an-EAR-on-Geronimo-2-0-M5- 
>> tf3824624s134.html#a10827459
>> Sent from the Apache Geronimo - Users mailing list archive at  
>> Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Resource-Refs-in-an-ejb-jar-inside-an-EAR-on-Geronimo-2-0-M5-tp10827459s134p20033539.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Resource Refs in an ejb-jar inside an EAR on Geronimo 2-0-M5

Posted by ptriller <pt...@soapwars.de>.

djencks wrote:
> 
> 
> On May 27, 2007, at 12:09 PM, ptriller wrote:
> 
>>
>> Hi !
>>
>> Ok, my Problem.
>>
>> I try to have some EE5 MDBs inside an EAR for geronimo-2.0-M5.
>>
>> I managed to add the resource-adapter to my EAR, and it seems to work.
>> Becaue I can inject
>> the resources from the Resource Adapter  into a Listener class in  
>> my Webapp
>> (also included in
>> my EAR) and if I voluntarily add some typos to the resource adapter  
>> or the
>> resource-ref or
>> resource-env-res in my geronimo-web, I get deployment errors.
>>
>> So far so good.
>>
>> Now I want to add an ejb-jar with an MDB. ok....
>>
>> I write an EJB .. annotate it. and put it in a jar ... add it to the
>> application.xml .. all is well.
>>
>> That works no problem with stateless session beans .. but now I  
>> have some
>> JNDI  and env
>> resources to map ..
>> so I add an openejb-jar.xml to the jar .
>>
>> It seems they changed the xsd for this file substantially in the 2.0
>> release.. I had to
>> get the xsd from the geronimo server to know what I should do.
>>
>> The new format seems to be very simplistic compared to the old  
>> ones....
>>
>> my current openejb-jar.xml is
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
>> 	<ejb-deployment ejb-name="ScheduledTestEJB">
>> 		<resource-link res-ref-name="jms/QueueConnectionFactory"
>> 			res-id="ConnectionFactory" />
>> 		<resource-link res-ref-name="jms/ScheduleManagerQueue"
>> 			res-id="ScheduleManagerQueue" />
>> 		<resource-link res-ref-name="jms/ScheduledTopic"
>> 			res-id="ScheduledTopic" />
>> 	</ejb-deployment>
>> </openejb-jar>
>>
>> If I try to use the old format, I only get parse errors...
>>
>>
>> so ... My question is.
>>
>> How do I map env-resources (in my case JMX Topics and Queues)  and  
>> normal
>> resources correctly with this new openejb format ?
> 
> The openejb 2.x xml plan format should still work, it is either  
> converted on the fly to the new format or understood by some part of  
> the deployer.  I've been seeing one error message per ejb  plan but  
> it doesn't seem to have any bad effects, the ejbs still deploy and  
> work fine.
> 
> The last I heard was that it was better to use the 2.x plans rather  
> than a 3.x plan for openejb stuff since the conversion code will  
> continue to be maintained but the 3.x schema is subject to change  
> without any backward compatibility -- you would have  to update your  
> plans yourself.
> 
> What is actually not working with the 2.x plans?
> 
> thanks
> david jencks
> 
> 

Put simply the resources just wont map.


in my geronimo-web.xml (also part of my EAR)

i do a 

<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
	xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
	xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1"
	xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1">
........
	<resource-ref>
		<ref-name>jms/TopicConnectionFactory</ref-name>
		<resource-link>ConnectionFactory</resource-link>
	</resource-ref>
	<resource-env-ref>
		<ref-name>jms/ScheduleManagerQueue</ref-name>
		<admin-object-link>ScheduleManagerQueue</admin-object-link>
	</resource-env-ref>
	<resource-env-ref>
		<ref-name>jms/ScheduledTopic</ref-name>
		<admin-object-link>ScheduledTopic</admin-object-link>
	</resource-env-ref>
</web-app>


and it seems to work. It deploys and starts, and I get stuff injected and no
errors when I call the 
JMS methods.


in my openejb-jar.xml I tried
<?xml version="1.0" encoding="UTF-8"?>
<op:openejb-jar xmlns:op="http://www.openejb.org/xml/ns/openejb-jar-2.2"
	xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1">
	<op:enterprise-beans>
		<op:message-driven>
			<op:ejb-name>ScheduledTestEJB</op:ejb-name>
			<op:resource-adapter>ScheduleManagerRA</op:resource-adapter>
			<nam:resource-ref>
				<nam:ref-name>jms/QueueConnectionFactory</nam:ref-name>
				<nam:resource-link>ConnectionFactory</nam:resource-link>
			</nam:resource-ref>
			<nam:resource-env-ref>
				<nam:ref-name>jms/ScheduleManagerQueue</nam:ref-name>
				<nam:admin-object-link>ScheduleManagerQueue</nam:admin-object-link>
			</nam:resource-env-ref>
			<nam:resource-env-ref>
				<nam:ref-name>jms/ScheduledTopic</nam:ref-name>
				<nam:admin-object-link>ScheduledTopic</nam:admin-object-link>
			</nam:resource-env-ref>
		</op:message-driven>
	</op:enterprise-beans>
</op:openejb-jar>


and 

?xml version="1.0" encoding="UTF-8"?>
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
	<ejb-deployment ejb-name="ScheduledTestEJB">
		<resource-link res-ref-name="jms/QueueConnectionFactory"
			res-id="ConnectionFactory" />
		<resource-link res-ref-name="jms/ScheduleManagerQueue"
			res-id="ScheduleManagerQueue" />
		<resource-link res-ref-name="jms/ScheduledTopic"
			res-id="ScheduledTopic" />
	</ejb-deployment>
</openejb-jar>


but in both cases I get a :

org.apache.geronimo.common.DeploymentException: Unable to resolve resource
reference 'jms/ScheduleManagerQueue' (Could not auto-map to resource.  Try
adding a resource-ref mapping to your Geronimo deployment plan.
Search conducted in current module and dependencies:
.....


I am sure I am missing something, but I have no Idea what .... do I have to
add a dependency
to the resource adapter ?


I have no idea ..




Thanks



Peter

-- 
View this message in context: http://www.nabble.com/Resource-Refs-in-an-ejb-jar-inside-an-EAR-on-Geronimo-2-0-M5-tf3824624s134.html#a10829382
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Resource Refs in an ejb-jar inside an EAR on Geronimo 2-0-M5

Posted by David Jencks <da...@yahoo.com>.
On May 27, 2007, at 12:09 PM, ptriller wrote:

>
> Hi !
>
> Ok, my Problem.
>
> I try to have some EE5 MDBs inside an EAR for geronimo-2.0-M5.
>
> I managed to add the resource-adapter to my EAR, and it seems to work.
> Becaue I can inject
> the resources from the Resource Adapter  into a Listener class in  
> my Webapp
> (also included in
> my EAR) and if I voluntarily add some typos to the resource adapter  
> or the
> resource-ref or
> resource-env-res in my geronimo-web, I get deployment errors.
>
> So far so good.
>
> Now I want to add an ejb-jar with an MDB. ok....
>
> I write an EJB .. annotate it. and put it in a jar ... add it to the
> application.xml .. all is well.
>
> That works no problem with stateless session beans .. but now I  
> have some
> JNDI  and env
> resources to map ..
> so I add an openejb-jar.xml to the jar .
>
> It seems they changed the xsd for this file substantially in the 2.0
> release.. I had to
> get the xsd from the geronimo server to know what I should do.
>
> The new format seems to be very simplistic compared to the old  
> ones....
>
> my current openejb-jar.xml is
>
> <?xml version="1.0" encoding="UTF-8"?>
> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
> 	<ejb-deployment ejb-name="ScheduledTestEJB">
> 		<resource-link res-ref-name="jms/QueueConnectionFactory"
> 			res-id="ConnectionFactory" />
> 		<resource-link res-ref-name="jms/ScheduleManagerQueue"
> 			res-id="ScheduleManagerQueue" />
> 		<resource-link res-ref-name="jms/ScheduledTopic"
> 			res-id="ScheduledTopic" />
> 	</ejb-deployment>
> </openejb-jar>
>
> If I try to use the old format, I only get parse errors...
>
>
> so ... My question is.
>
> How do I map env-resources (in my case JMX Topics and Queues)  and  
> normal
> resources correctly with this new openejb format ?

The openejb 2.x xml plan format should still work, it is either  
converted on the fly to the new format or understood by some part of  
the deployer.  I've been seeing one error message per ejb  plan but  
it doesn't seem to have any bad effects, the ejbs still deploy and  
work fine.

The last I heard was that it was better to use the 2.x plans rather  
than a 3.x plan for openejb stuff since the conversion code will  
continue to be maintained but the 3.x schema is subject to change  
without any backward compatibility -- you would have  to update your  
plans yourself.

What is actually not working with the 2.x plans?

thanks
david jencks

>
>
> Thanks
>
>
> Peter
> -- 
> View this message in context: http://www.nabble.com/Resource-Refs- 
> in-an-ejb-jar-inside-an-EAR-on-Geronimo-2-0-M5- 
> tf3824624s134.html#a10827459
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>