I don't know how resource bundles work but I expect they have
assumptions about classloaders loading the resource files that are not
valid in osgi outside a single bundle. I'm not sure exactly what
happens with osgi either but I think that you have to use the Bundle
object to load classes and resources from other bundles, not the
classloader that loads the classes in a bundle.
For a modular system I'd expect that the resources would need to be in
the bundle itself or else supplied through some kind of resource
service. If the resources aren't in the right bundle lets move them.
BTW I'm starting to try to get the welcome app to deploy, I'm adding a
couple mini-assemblies to the build. I'm starting with the jetty
server.... if you'd like to take a look at the tomcat one that might
be a standardized testbed for this work. I've just committed the
server assemblies under plugins/welcome.
thanks
david jencks
On Nov 19, 2009, at 7:51 PM, Forrest Xia wrote:
Hi,
I managed to locally make an assembly of tomcat-minimal
successfully(of cause, disabled some modules, such as hot-deploy,
remote-deploy).
But when I tried to start the server, I encounter a strange problem
that I can not figure out why. The problem is:
When boot comes to plugin "org.apache.geronimo.configs/tomcat6/3.0-
SNAPSHOT/car", an java.util.MissingResourceException threw out.
Full stack trace is:
[********************************* ] 83% 10s Starting
org.apache.ger...2009-11-20 11:13:40,920 ERROR [GBeanInstanceState]
Error while starting; GBean is now in the FAILED state:
abstractName="org.apache.geronimo.configs/tomcat6/3.0-SNAPSHOT/car?
ServiceModule=org.apache.geronimo.configs/tomcat6/3.0-SNAPSHOT/
car,j2eeType=GBean,name=TomcatServer"
org.apache.xbean.recipe.ConstructionException: Error invoking
constructor: public
org.apache.catalina.connector.Connector(java.lang.String) throws
java.lang.Exception
at org.apache.xbean.recipe.ReflectionUtil
$ConstructorFactory.create(ReflectionUtil.java:962)
at
org
.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:
276)
at
org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
at
org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
at
org
.apache
.geronimo.tomcat.model.ConnectorType.getConnector(ConnectorType.java:
595)
at
org
.apache
.geronimo.tomcat.model.ServiceType.getService(ServiceType.java:278)
at
org.apache.geronimo.tomcat.model.ServerType.build(ServerType.java:294)
at
org
.apache
.geronimo.tomcat.TomcatServerGBean.<init>(TomcatServerGBean.java:132)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun
.reflect
.NativeConstructorAccessorImpl
.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun
.reflect
.DelegatingConstructorAccessorImpl
.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.xbean.recipe.ReflectionUtil
$ConstructorFactory.create(ReflectionUtil.java:952)
at
org
.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:
276)
at
org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
at
org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
at
org
.apache
.geronimo
.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:917)
at
org
.apache
.geronimo
.gbean
.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:
269)
at
org
.apache
.geronimo
.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:103)
at
org
.apache
.geronimo
.gbean
.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:
125)
at
org
.apache
.geronimo
.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:544)
at
org
.apache
.geronimo
.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:385)
at
org
.apache
.geronimo
.kernel
.config
.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:
459)
at
org
.apache
.geronimo
.kernel
.config
.KernelConfigurationManager.start(KernelConfigurationManager.java:223)
at
org
.apache
.geronimo
.kernel
.config
.SimpleConfigurationManager
.startConfiguration(SimpleConfigurationManager.java:713)
at
org
.apache
.geronimo.system.main.EmbeddedDaemon.doStartup(EmbeddedDaemon.java:
149)
at
org
.apache
.geronimo.system.main.EmbeddedDaemon.execute(EmbeddedDaemon.java:81)
at
org.apache.geronimo.main.Bootstrapper.execute(Bootstrapper.java:88)
at
org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:65)
at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java:
32)
Caused by: java.util.MissingResourceException: Can't find bundle for
base name org.apache.catalina.connector.LocalStrings, locale en_US
at
java
.util
.ResourceBundle.throwMissingResourceException(ResourceBundle.java:
1521)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:
1260)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:787)
at
org.apache.tomcat.util.res.StringManager.<init>(StringManager.java:77)
at
org.apache.tomcat.util.res.StringManager.<init>(StringManager.java:72)
at
org
.apache.tomcat.util.res.StringManager.getManager(StringManager.java:
161)
at
org
.apache.catalina.connector.MapperListener.<init>(MapperListener.java:
79)
at org.apache.catalina.connector.Connector.<init>(Connector.java:
266)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun
.reflect
.NativeConstructorAccessorImpl
.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun
.reflect
.DelegatingConstructorAccessorImpl
.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.xbean.recipe.ReflectionUtil
$ConstructorFactory.create(ReflectionUtil.java:952)
... 29 more
So I double check the catalina bundle(whose bundle id is 122 in my
assembly) and confirmed there are resource files for LocalStrings in
the jar. Its package is exported and imported properly in the
bundle's MENIFEST file. Just no LocalStrings_en_US.properties there.
But I think, even the local resource is not found, the default
resource LocalStrings.properties should be picked up.
From the error msg, it does not happen as supposed to. However, I
manually add a resource file to the jar, stop osgi runtime, clear
bundle cache, and start the server again. The same problem is still
there. Why? does the caller bundle not see the resource from another
bundle? I am confused.
Here I also attached an active bundle list before the error happens
for reference.
Hope someone can give me a light about it. My ideal goal is to have
a minimal tomcat assembly started without problems, so that I can
try to deploy a simple sample application to the runtime and see if
it works.
Thanks for any comments.
Forrest
<startedbundles.txt>