Mesaage from Romain (TomEE commiter):
Hi
you use @Resource(name = "nosql/qmmongo") Properties props;
this is not portable and that's what the error says.
To do it in tomEE you can use the follwing class:
public class PropertiesFactory {
private Properties properties;
public void setProperties(final Properties properties) {
this.properties = properties;
}
public Properties create() {
return properties;
}
}
And declare it in tomee.xml (if the class is in the container) or
resources.xml with this block:
<Resource id="name of the injection"
class-name="org.superbiz.PropertiesFactory" factory-name="create">
propertyKey1 = value1
propertyKey2 = value2
</Resource>
You'll get with this some warning:
WARNING - Property "attr2" not supported by "p"
WARNING - Property "attr1" not supported by "p"
but this is not a problem. You can also workaround them using the
following PropertiesFactory if you know the properties you want:
public class PropertiesFactory {
private Properties properties;
public void setValue1(final String v1) { // idem for other
properties
this.properties.put("key1", v1);
}
public Properties create() {
return properties;
}
}
Note: i'll get rid of this warning for properties case in next
releases (> 1.6.0)
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau
2013/11/19 jvence <[email protected]>
> Great idea Thibault. Thanks for the recommendation. I have integrate TomEE
> but keep getting a strange error:
>
> SEVERE: Unable to deploy collapsed ear in war
>
> StandardEngine[Catalina].StandardHost[localhost].StandardContext[/simple-shiro-web-app-1.0]
> org.apache.openejb.OpenEJBException: No provider available for resource-ref
> 'null' of type 'java.util.Properties' for
> 'localhost/simple-shiro-web-app-1.0.Comp'.
> at
>
> org.apache.openejb.config.AutoConfig.autoCreateResource(AutoConfig.java:1770)
> at
> org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:1763)
> at
> org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:1714)
> at
>
> org.apache.openejb.config.AutoConfig.processResourceRef(AutoConfig.java:1101)
> at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:832)
> at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:186)
> at
>
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:363)
> at
>
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:850)
> at
>
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:791)
> at
>
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:746)
> at
>
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:118)
> at
>
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> at
>
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
> at
>
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at
>
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
> at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
> at
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
> at
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
> at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
> at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
> at java.lang.Thread.run(Thread.java:695)
>
> Searching google does not yield anything. Any ideas on what this could be?
> Many thanks again for your assistance.
>
> Jean
>
>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/Example-Shiro-MongoDB-Realm-tp7579029p7579398.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>