【发布时间】:2013-12-18 11:06:41
【问题描述】:
尝试在 tomee.xml 中添加“java.net.URL”资源,但参数未传递给构造函数。这是对 tomee.xml 的补充:
<Resource id="someJndiName" class-name="java.net.URL" factory-name="URL" constructor="spec">
spec http://google.com
</Resource>
这会导致:
INFO: Creating Resource(id=someJndiName)
Dec 18, 2013 5:10:12 AM org.apache.openejb.util.OpenEJBErrorHandler handleUnknownError
SEVERE: FATAL ERROR: Unknown error in Assembler. Please send the following stack trace and this message to users@openejb.apache.org :
java.lang.NullPointerException
at org.apache.xbean.recipe.ReflectionUtil.toParameterList(ReflectionUtil.java:1026)
at org.apache.xbean.recipe.ReflectionUtil.findStaticFactory(ReflectionUtil.java:811)
at org.apache.xbean.recipe.ObjectRecipe.findFactory(ObjectRecipe.java:538)
at org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:274)
at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
基于OpenEJB/TomEE Resources: how does it work?,代码使用反射来调用构造函数并且应该传递参数,但这里似乎并非如此。这是一个错误,还是有其他方法可以将参数传递给构造函数?
我尝试在“%TomEE%/conf/system.properties”中添加一个条目,但没有任何改变。
someJndiName.spec=http://google.com
我尝试使用 URL 的 3 参数构造函数,结果相同。
<Resource id="someJndiName" class-name="java.net.URL" factory-name="URL" constructor="protocol, host, file">
protocol http
host google.com
file
</Resource>
我目前的需要是将“java.net.URL”对象添加到服务器资源中,但是能够使用这种通用方法添加任意对象将非常有用。
是否需要为“java.net.URL”创建一些处理程序类才能作为 TomEE 资源处理?
【问题讨论】:
标签: jndi openejb apache-tomee