Romain +1

Hi Rafael,

We go to some observations:

1) The example you are using is to Tomee 7.0.1-SNAPSHOT, ie the APIs used
in this example are for Java EE 7 and not 6, it may cause some errors if
you are using API 7 and trying deploy the war in Tomee 1.7.4.

2) I've seen that you are not setting any of its resources, ie the Tomee
will not be able to inject objects like this:
https://github.com/apache/tomee/blob/042d4d9fc647c32ee31c4c7455a4769817564340/examples/dynamic-datasource-routing/src/main/java/org/superbiz/dynamicdatasourcerouting/RoutedPersister.java#L30-L31

Well, with the above observations, it appears that the problem must be
solved, I made the example and you can view here:
https://github.com/danielsoro/dynamic-datasource-routing

What I did was:
1) Change my pom.xml packaging from jar to war.
2) Remove the META-INF / org.router / service-jar.xml
3) Add the resources in: webapp / WEB-INF / resources.xml
4) Create my web.xml: webapp / WEB-INF / web.xml

On Mon, Jun 6, 2016 at 5:38 AM, Romain Manni-Bucau <rmannibu...@gmail.com>
wrote:

> Hi
>
> this error means you didn't set up the provider, ie this file:
>
> https://github.com/apache/tomee/blob/042d4d9fc647c32ee31c4c7455a4769817564340/examples/dynamic-datasource-routing/src/main/resources/META-INF/org.router/service-jar.xml
>
> Note that it is no more required and can be replaced in resources.xml by:
>
> <Resource id="My Router" class-name="
> org.superbiz.dynamicdatasourcerouting.DeterminedRouter">
>  # config
> </Resource>
>
> Also note that for a war descriptors (resources.xml there) should be in
> WEB-INF and not META-INF - guess it is your issue.
>
>
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com/> | Old Blog
> <http://rmannibucau.wordpress.com/> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-06-06 13:21 GMT+02:00 Rafael Reynoud <raf...@teorema.inf.br>:
>
> >
> > Good afternoom
> >  we are using the server tomee, we need create several Resouce, but we
> did
> > not get make work.
> >
> > we use example
> >
> https://github.com/apache/tomee/tree/042d4d9fc647c32ee31c4c7455a4769817564340/examples/dynamic-datasource-routing
> ,
> > In this example I can do the test successfully , but we try the same
> > project on our server (tomee, files .ear or .war), we have difficulties,
> > example message:  org.apache.openejb.OpenEJBException: Can't find
> resource
> > for class org.superbiz.dynamicdatasourcerouting.RoutedPersister#router.
> (No
> > provider available for resource-ref id with type
> > 'org.superbiz.dynamicdatasourcerouting.DeterminedRouter' for
> > 'BoostrapUtility'.).
> >
> > We look at various examples and tutorials including some developed by
> > tomitribe employees, but in no case could the success.
> >
> > we are using java 8 and apache-tomee-webprofile-1.7.4.
> >
> > Attached, we send the same example that we downloaded from github and
> > tomee.xml
> >
> > we look forward for a positive response, thank you!
> >
> > and congratulations for the work yours.!
> >
> >
>



-- 
Daniel Cunha
https://twitter.com/dvlc_
http://www.tomitribe.com
http://www.tomitribe.io

Reply via email to