• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

OCP 17 - Chapter 12 - Exception when executing

 
Greenhorn
Posts: 25
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody!
Stuck in this problem since a few hours..

When trying to execute zoo.visitor.Tourist.class I get this error message.

Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package zoo.tours in both module zoo.tours.agency and module zoo.tours.reservations



The strage thing is that the first time I ran it, it did it properly, but when I added zoo.tours.agency it gave me that message. Deleting the service provider jar file made the class working again, then I tried to check that module and repack it, but still not working. So I decide to restart from the beginning with the whole compilation and pack thing (javac and jar commands) of all the modules and after that I tried to run the class file before packing the zoo.tours.agency.jar file, and I got the same message.

Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package zoo in both module zoo.tours.reservations and module zoo.visitor



Can someone help me solving this?
 
Marco Olivi
Greenhorn
Posts: 25
3
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Recompiled and repacked everything for the third time and now it magically works  
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Marco,
I'm glad the problem went away. I suspect you had a typo in the target directory during one of your compiles and got two copies of the class.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems I have the same problem. Initially I did build the whole exercise into my own structure. Everything went fine up to the consumerModule, including the compiling and creation of the jar. However, when trying to run the program  I got the Error:

Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package zoo in both module zoo.tours.reservations and module zoo.tours.api


I did do all compilation over again but I could not get rid of this error. Finally, I decided to just download the repository and run the java commands one by one from the readme file included on the repo structure. Surprisingly the same type of error occurred, but this time it complained about:

Package zoo.tours in both module zoo.tours.reservations and module zoo.tours.api

.
I am not sure this is something buggy or not. But I cannot see a more cleaner way of picking the repo directory and executing the commands by copy pasting them in my terminal?
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andy,
Welcome to CodeRanch!

I checked out a fresh copy of the repo and ran the commands. It "works on my machine". So there is something different about when I tried it and when you tried it. If you want to run through it again and post your log here, we can compare what is different. (I'm on Mac although shouldn't matter)

 
reply
    Bookmark Topic Watch Topic
  • New Topic