Trying to add a "java.net.URL" resource in tomee.xml, but the parameters are not being passed to the constructor. Here is the addition to the tomee.xml:
<Resource id="someJndiName" class-name="java.net.URL" factory-name="URL" constructor="spec">
spec http://google.com
</Resource>
This causes:
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 [email protected] :
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)
Based on OpenEJB/TomEE Resources: how does it work? the code is using reflection to call the constructor and should be passing the parameter, but this does not appear to be the case here. Is this a bug, or is there another way to pass parameters to the constructor?
I tried adding an entry in "%TomEE%/conf/system.properties", but it made no change.
someJndiName.spec=http://google.com
I tried using the 3 parameter constructor for URL, with the same result.
<Resource id="someJndiName" class-name="java.net.URL" factory-name="URL" constructor="protocol, host, file">
protocol http
host google.com
file
</Resource>
My current need is to add "java.net.URL" objects to the server resources, but being able to add arbitrary objects using this general method would be very useful.
Does some handler class need to be created for "java.net.URL" to be processed as a TomEE resource?
are you still having this issue? This is working in TomEE 7.1.0.
resources.xml
:Application.java
: