TOTD #140: Moving GlassFish Installation - Referenced file does not exist "osgi-main.jar"

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

Comments:

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.

Posted by Sahoo on June 03, 2010 at 12:42 AM PDT #

Thanks Sahoo!

Posted by Arun Gupta on June 03, 2010 at 07:04 AM PDT #

Thanks Arun, you made our day.

Posted by Guillem Barnolas on September 22, 2011 at 02:11 AM PDT #

You made my day too. I can now easily move Glassfish from computer to computer.

Posted by John on November 29, 2011 at 04:09 PM PST #

Extracting the installer archive...
java.util.zip.ZipException: invalid entry size (expected 3805977 but got 66972 bytes)
at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:393)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:165)
at sun.tools.jar.Main.extractFile(Main.java:849)
at sun.tools.jar.Main.extract(Main.java:784)
at sun.tools.jar.Main.run(Main.java:228)
at sun.tools.jar.Main.main(Main.java:1044)
Extracting the installer runtime...
java.io.EOFException: Unexpected end of ZLIB input stream
at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:240)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:163)
at sun.tools.jar.Main.extractFile(Main.java:849)
at sun.tools.jar.Main.extract(Main.java:784)
at sun.tools.jar.Main.run(Main.java:228)
at sun.tools.jar.Main.main(Main.java:1044)
Extracting the installer resources...
java.io.FileNotFoundException: ./Product/Packages/Resources.zip (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:137)
at java.io.FileInputStream.<init>(FileInputStream.java:96)
at sun.tools.jar.Main.run(Main.java:223)
at sun.tools.jar.Main.main(Main.java:1044)
Extracting the installer metadata...
java.io.FileNotFoundException: ./Product/Packages/metadata.zip (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:137)
at java.io.FileInputStream.<init>(FileInputStream.java:96)
at sun.tools.jar.Main.run(Main.java:223)
at sun.tools.jar.Main.main(Main.java:1044)
chmod: cannot access `product-installer.sh': No such file or directory
sh: product-installer.sh: No such file or directory

Posted by Atabay on May 05, 2012 at 09:07 PM PDT #

Post a Comment:
Comments are closed for this entry.
About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today