This is a quick Tip Of The Day (TOTD) to show how to get GlassFish running again if the directory is moved to a new location after it has been started once. Note, of course, you are not moving the directory while the server is running. Its only after the server has been started once at least and stopped.
If you move your GlassFish installation to a different directory then you may see errors like:
ERROR: Error creating archive. (java.io.IOException: Referenced file does not exist: /Users/arungupta/tools/glassfish/v3/glassfishv3/glassfish/modules/osgi-main.jar)
java.io.IOException: Referenced file does not exist: /Users/arungupta/tools/glassfish/v3/glassfishv3/glassfish/modules/osgi-main.jar
at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:994)
at org.apache.felix.framework.cache.BundleArchive.revise(BundleArchive.java:631)
at org.apache.felix.framework.cache.BundleArchive.(BundleArchive.java:206)
at org.apache.felix.framework.cache.BundleCache.getArchives(BundleCache.java:149)
at org.apache.felix.framework.Felix.init(Felix.java:558)
at org.apache.felix.main.Main.main(Main.java:292)
. . .
org.osgi.framework.BundleException: Bundle symbolic name and version are not unique: com.sun.grizzly.grizzly-config:1.9.18.k
at org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:1145)
at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
at org.apache.felix.framework.Felix.installBundle(Felix.java:2372)
. . .
May 30, 2010 4:27:05 PM Main install
WARNING: Failed to install file:/Users/arungupta/tools/glassfish/v3/glassfishv3-2/glassfish/modules/grizzly-config.jar
org.osgi.framework.BundleException: Bundle symbolic name and version are not unique: com.sun.grizzly.grizzly-config:1.9.18.k
at org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:1145)
at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
at org.apache.felix.framework.Felix.installBundle(Felix.java:2372)
. . .
Fortunately the fix is simple, just remove your "domains/domain1/osgi-cache" directory. The cache will be rebuilt during the next run of GlassFish.
Technorati: totd glassfish v3 osgi cache error
Related posts:- TOTD #160: OSGi bundles not auto-starting in GlassFish 3.1 ?
- TOTD #127: Embedding GlassFish in an existing OSGi runtime – Eclipse Equinox
- TOTD #103: GlassFish v3 with different OSGi runtimes – Felix, Equinox, and Knoplerfish
- TOTD #126: Creating an OSGi bundles using Eclipse and deploying in GlassFish
- TOTD #130: Invoking a OSGi service from a JAX-WS Endpoint – OSGi and Enterprise Java
Even better to fix the cache by running a script as mentioned here:
http://forums.java.net/jive/thread.jspa?messageID=390111#390111
That way, if you have installed any bundles separately, they won’t vanish.
Comment by Sahoo — June 3, 2010 @ 7:42 am
Thanks Sahoo!
Comment by Arun Gupta — June 3, 2010 @ 2:04 pm