0

Hi I have project that develop with java 8 and manage in google app engine and everything work fine. my project used appengine-web.xml and not app.ymal file to config the app engine i decided to upgrade to java 11 so now i need to use app.ymal file to config app engine. this is my config file

runtime: java11
env: standard
entrypoint: 'java -cp "*" mypackageName.ServerMain myprojectName-1.0.war'

after upgrate to java 11 in my local host the project work fine but when i deploy the project to app engine i get error (from app engine logs)

2022-09-22 11:01:43.876 IDT
Error: Could not find or load main class mypackageName.ServerMain
2022-09-22 11:01:43.876 IDT
Caused by: java.lang.ClassNotFoundException: mypackageName.ServerMain

to upgrade my project to java 11 i use this guide https://happycoding.io/tutorials/google-cloud/migrating-to-java-11

config pom file

<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>1.0</version>

<groupId>mypackageName</groupId>
<artifactId>myprojectName</artifactId>

when i look on app engine console i saw war file correct and app.yaml file

so what is problem thank you

user2320349
  • 109
  • 1
  • 12
  • 1
    please check this stackoverflow [link1](https://stackoverflow.com/questions/63333073/app-engine-java-11-could-not-find-or-load-main-class-on-live-server),[link2](https://stackoverflow.com/questions/59609094/springboot-on-google-appengine-could-not-find-or-load-main-class) & [link3](https://stackoverflow.com/questions/18093928/what-does-could-not-find-or-load-main-class-mean) – Sathi Aiswarya Sep 23 '22 at 07:08
  • Hi Sathi Aiswarya Thank you for replay. link2 and link3 not help me but link 1 i think is direction to answer but is not working to me. when i run the command mvn exec:java everything working fine in localhost. but when i run java -jar myjarFile-1.0.jar i get same error "Error: Could not find or load main class mypackageName.ServerMain" when i open jar file with one commander software i dont see my code only static files so i think this is problem the jar file not include the java file maybe you know why? – user2320349 Sep 25 '22 at 04:50
  • Have a look at this link1(https://stackoverflow.com/a/63855211/18265638) & link2(https://stackoverflow.com/a/70040457/18265638) – Sathi Aiswarya Sep 26 '22 at 06:39
  • Hi Sathi Aishwarya I changed alot of thinks like remove some pugins that did problem with java 11 and more and copy pom file from this project https://github.com/KevinWorkman/HappyCoding/tree/gh-pages/examples/google-cloud/google-cloud-example-projects/app-engine-hello-world. now I think I'm moving forward with a solution but is still not work for me. now when i run the command mvn package exec:java the server runing when i run the command java -jar myJarFile the server is running when i deploy to gcp the server is running – user2320349 Sep 28 '22 at 09:50
  • continue the last comment but when i try to url servlet (to localhost or live server) like i did with java 8 (http://localhost:8080/pullGeneralInfo) i get "Error 503 Service Unavailable" also in live server and i have another problem i cant to run the project from eclipse with java 8 i ran it with google app engine sdk but how i can run it from eclipse now? – user2320349 Sep 28 '22 at 09:50
  • can you check this [document](https://cloud.google.com/endpoints/docs/frameworks/troubleshoot-response-errors#503_service_unavailable) & this stackoverflow [link](https://stackoverflow.com/a/52312545/18265638) – Sathi Aiswarya Sep 30 '22 at 08:13
  • Hi Sathi Aishwarya after a lot of changed and a lot of upgrade libs in localhost everythind work fine in production server is still not working i get error 503 but is something in my project beacuse i create new project and then deploy to my production server is working. probabley i have some code that cause to problem maybe you idea how to check where is worng code because i big project with thousnd files – user2320349 Oct 01 '22 at 10:55

0 Answers0