zeroc-ice / ice-demos

Sample programs for Ice
https://zeroc.com
GNU General Public License v2.0
325 stars 217 forks source link

unknown issues running client.jar #167

Closed husseinsafa98 closed 1 year ago

husseinsafa98 commented 1 year ago

Hi, I am working on the ice-demons specifically in java for IceGrid -> IceBox and I completed the steps of running the server and logging in on the Gui but when I try running the command "java -jar build/libs/client.jar" for the client.jar I'm getting this error if anyone can help me resolve it (Using JDK 11 and Gradle 7.5.1, on Intellij IDE)

It Shows this in the Client CMD

Exception in thread "main" com.zeroc.Ice.NoEndpointException
    proxy = "hello -t -e 1.1"
        at com.zeroc.IceInternal.OutgoingAsync.waitForResponseOrUserEx(OutgoingAsync.java:140)
        at com.zeroc.IceInternal.OutgoingAsync.waitForResponse(OutgoingAsync.java:112)
        at com.zeroc.demos.IceGrid.icebox.Demo.HelloPrx.sayHello(HelloPrx.java:27)
        at com.zeroc.demos.IceGrid.icebox.Demo.HelloPrx.sayHello(HelloPrx.java:22)
        at Client.main(Client.java:43)

And in the server CMD it shows

-! 11/01/22 19:34:12.248 icegridnode: warning: administrative session manager endpoints `IceGrid.Registry.AdminSessionManager.Endpoints' enabled (with Glacier2 filters disabled)
-- 11/01/22 19:34:52.368 icegridnode: Activator: activating server `IceBox'
!! 11/1/22 19:34:55:874 IceBox: error: main: ServiceManager: class HelloServiceI not found
   com.zeroc.IceBox.FailureException
       reason = "ServiceManager: class HelloServiceI not found"
        at com.zeroc.IceBox.ServiceManagerI.start(ServiceManagerI.java:532)
        at com.zeroc.IceBox.ServiceManagerI.run(ServiceManagerI.java:387)
        at com.zeroc.IceBox.Server.run(Server.java:100)
        at com.zeroc.IceBox.Server.main(Server.java:118)

-- 11/01/22 19:34:55.915 icegridnode: Activator: detected termination of server `IceBox'
   exit code = 1
-- 11/01/22 19:34:55.922 icegridnode: Activator: activating server `IceBox'
!! 11/1/22 19:34:59:027 IceBox: error: main: ServiceManager: class HelloServiceI not found
   com.zeroc.IceBox.FailureException
       reason = "ServiceManager: class HelloServiceI not found"
        at com.zeroc.IceBox.ServiceManagerI.start(ServiceManagerI.java:532)
        at com.zeroc.IceBox.ServiceManagerI.run(ServiceManagerI.java:387)
        at com.zeroc.IceBox.Server.run(Server.java:100)
        at com.zeroc.IceBox.Server.main(Server.java:118)

-- 11/01/22 19:34:59.068 icegridnode: Activator: detected termination of server `IceBox'
   exit code = 1
-- 11/01/22 19:34:59.070 icegridnode: Activator: activating server `IceBox'
!! 11/1/22 19:35:02:031 IceBox: error: main: ServiceManager: class HelloServiceI not found
   com.zeroc.IceBox.FailureException
       reason = "ServiceManager: class HelloServiceI not found"
        at com.zeroc.IceBox.ServiceManagerI.start(ServiceManagerI.java:532)
        at com.zeroc.IceBox.ServiceManagerI.run(ServiceManagerI.java:387)
        at com.zeroc.IceBox.Server.run(Server.java:100)
        at com.zeroc.IceBox.Server.main(Server.java:118)

-- 11/01/22 19:35:02.064 icegridnode: Activator: detected termination of server `IceBox'
   exit code = 1
pepone commented 1 year ago

Hi,

IceBox: error: main: ServiceManager: class HelloServiceI not found

This indicates that IceBox server is failing to start because it cannot find the HelloServiceI class, this class is included in the service.jar, can you check if the service.jar was built and have the expected contents, jar tvf build\libs\service.jar will show the contents of the Jar file.

IceGrid\icebox>jar tvf build\libs\service.jar
     0 Wed Nov 02 11:33:44 CET 2022 META-INF/
  1106 Wed Nov 02 11:33:44 CET 2022 META-INF/MANIFEST.MF
  2813 Wed Nov 02 11:33:44 CET 2022 Client.class
     0 Wed Nov 02 11:33:42 CET 2022 com/
     0 Wed Nov 02 11:33:42 CET 2022 com/zeroc/
     0 Wed Nov 02 11:33:42 CET 2022 com/zeroc/demos/
     0 Wed Nov 02 11:33:42 CET 2022 com/zeroc/demos/IceGrid/
     0 Wed Nov 02 11:33:42 CET 2022 com/zeroc/demos/IceGrid/icebox/
     0 Wed Nov 02 11:33:42 CET 2022 com/zeroc/demos/IceGrid/icebox/Demo/
   484 Wed Nov 02 11:33:42 CET 2022 com/zeroc/demos/IceGrid/icebox/Demo/Hello$1.class
  3306 Wed Nov 02 11:33:42 CET 2022 com/zeroc/demos/IceGrid/icebox/Demo/Hello.class
 10412 Wed Nov 02 11:33:42 CET 2022 com/zeroc/demos/IceGrid/icebox/Demo/HelloPrx.class
   452 Wed Nov 02 11:33:42 CET 2022 com/zeroc/demos/IceGrid/icebox/Demo/_HelloPrxI.class
   131 Wed Nov 02 11:33:42 CET 2022 com/zeroc/demos/IceGrid/icebox/Demo/_Marker.class
  1821 Wed Nov 02 11:33:44 CET 2022 HelloI.class
  1820 Wed Nov 02 11:33:44 CET 2022 HelloServiceI.class
husseinsafa98 commented 1 year ago

Hey, thank you for your response it created the jar files, I'm attaching an image of my build\libs folder. I have also tried to repo the project again and build it, same error happens.

image

The following shows when I ran jar tvf build\libs\service.jar

     0 Tue Nov 01 19:17:58 EDT 2022 META-INF/
  1127 Tue Nov 01 18:07:32 EDT 2022 META-INF/MANIFEST.MF
  2813 Tue Nov 01 19:17:58 EDT 2022 Client.class
     0 Tue Nov 01 19:17:58 EDT 2022 com/
     0 Tue Nov 01 19:17:58 EDT 2022 com/zeroc/
     0 Tue Nov 01 19:17:58 EDT 2022 com/zeroc/demos/
     0 Tue Nov 01 19:17:58 EDT 2022 com/zeroc/demos/IceGrid/
     0 Tue Nov 01 19:17:58 EDT 2022 com/zeroc/demos/IceGrid/icebox/
     0 Tue Nov 01 19:17:58 EDT 2022 com/zeroc/demos/IceGrid/icebox/Demo/
   484 Tue Nov 01 19:17:58 EDT 2022 com/zeroc/demos/IceGrid/icebox/Demo/Hello$1.class
  3306 Tue Nov 01 19:17:58 EDT 2022 com/zeroc/demos/IceGrid/icebox/Demo/Hello.class
 10412 Tue Nov 01 19:17:58 EDT 2022 com/zeroc/demos/IceGrid/icebox/Demo/HelloPrx.class
   452 Tue Nov 01 19:17:58 EDT 2022 com/zeroc/demos/IceGrid/icebox/Demo/_HelloPrxI.class
   131 Tue Nov 01 19:17:58 EDT 2022 com/zeroc/demos/IceGrid/icebox/Demo/_Marker.class
  1821 Tue Nov 01 19:17:58 EDT 2022 HelloI.class
  1820 Tue Nov 01 19:17:58 EDT 2022 HelloServiceI.class
pepone commented 1 year ago

Are you running icegridnode from the demo ice-demos/java/IceGrid/icebox directory?

Can you also post the contents of META-INF/MANIFEST.MF, just unzip the JAR file and post the contents of META-INF/MANIFEST.MF?

husseinsafa98 commented 1 year ago

I am running the icegridnode from this ice-demos/java/IceGrid/icebox directory, i dont see META-INF/MANIFEST.MF i dont think it was created

pepone commented 1 year ago

META-INF/MANIFEST.MF is inside the service.jar, you have to unzip the JAR to see it

husseinsafa98 commented 1 year ago

Thank you, I have just changed my name with a (userName) tag but that is what was in the MANIFEST.MF Manifest-Version: 1.0 Main-Class: Service

Class-Path: file:/C:/Users/(userName)/.gradle/caches/modules-2/files-2.1/co
 m.zeroc/icegrid/3.7.8/2d34a19f53abf07504da362d61e7f8c8ab30d8a4/icegrid-
 3.7.8.jar file:/C:/Users/(userName)/.gradle/caches/modules-2/files-2.1/com
 .zeroc/icebox/3.7.8/da3ffa8c91527e528a5454e0c320ebfe8163fdb5/icebox-3.7
 .8.jar file:/C:/Users/(userName)/.gradle/caches/modules-2/files-2.1/com.ze
 roc/icessl/3.7.8/5ceb55e5b260411d2ac43b03cef209a4e4921fbf/icessl-3.7.8.
 jar file:/C:/Users/(userName)/.gradle/caches/modules-2/files-2.1/com.zeroc
 /icelocatordiscovery/3.7.8/c52b39096f9b7e3b75a426d77778880d5e600e07/ice
 locatordiscovery-3.7.8.jar file:/C:/Users/(userName)/.gradle/caches/module
 s-2/files-2.1/com.zeroc/glacier2/3.7.8/8e6d13975e19096455b433c51474c330
 6aedf8e7/glacier2-3.7.8.jar file:/C:/Users/(userName)/.gradle/caches/modul
 es-2/files-2.1/com.zeroc/ice/3.7.8/693567126c86914ea2d4812c107af3ae787d
 b46f/ice-3.7.8.jar file:/C:/Users/(userName)/.gradle/caches/modules-2/file
 s-2.1/org.apache.commons/commons-compress/1.14/7b18320d668ab080758bf538
 3d6d8fcf750babce/commons-compress-1.14.jar
pepone commented 1 year ago

Not clear what is going on, the manifest looks correct, and HelloServiceI class is in the JAR file. Wondering if IceGrid is not picking the correct Java version.

What is the output of where java?

husseinsafa98 commented 1 year ago

mine is coming from C:\Workspace\jdk-11.0.15.1\bin\java.exe

pepone commented 1 year ago

Can you try updating the application descriptor to use the full path for the jar files and the Java executable?

https://github.com/zeroc-ice/ice-demos/blob/145766cccb3596b723b05977171288b3fa356417/java/IceGrid/icebox/application.xml#L15

To

<service name="${name}" entry="C:\Users\jose\source\repos\3.7.8\ice-demosx\java\IceGrid\icebox\build\libs\service.jar:HelloServiceI">

https://github.com/zeroc-ice/ice-demos/blob/145766cccb3596b723b05977171288b3fa356417/java/IceGrid/icebox/application.xml#L57

To

<icebox id="IceBox" activation="on-demand" exe="C:\Program Files\Java\jdk-17.0.1\bin\java.exe">

And

https://github.com/zeroc-ice/ice-demos/blob/145766cccb3596b723b05977171288b3fa356417/java/IceGrid/icebox/application.xml#L61

To

<option>C:\Users\jose\source\repos\3.7.8\ice-demos\java\IceGrid\icebox\build\libs\iceboxserver.jar</option>

Then update the application using the icegridadmin command

icegridadmin --Ice.Config=config.grid -e "application update application.xml"
husseinsafa98 commented 1 year ago

It worked when I changed it to closer directory for example in my C:\Workspace\ice-demos Thank you for your help

pepone commented 1 year ago

Glad it worked