Could not find or load main class error when starting Confluence 8.0.3 after upgrade
Asked by Andre:

Upgraded Confluence from 7.19 to 8.0.3 and getting this in catalina.out as soon as I start the application

```
Error: Could not find or load main class @.opt.atlassian.apps.confluence.current.confluence.WEB-INF.jpms-args.txt
```

Confluence does not start after that. Any ideas what could be the cause of this?

Here's more info that I could think of:

```
[atlassian@ip-172-31-12-42 logs]$ cat catalina.out 
Error: Could not find or load main class @.opt.atlassian.apps.confluence.current.confluence.WEB-INF.jpms-args.txt
Error: Could not find or load main class @.opt.atlassian.apps.confluence.current.confluence.WEB-INF.jpms-args.txt
Error: Could not find or load main class @.opt.atlassian.apps.confluence.current.confluence.WEB-INF.jpms-args.txt
[atlassian@ip-172-31-12-42 logs]$ ll /opt/atlassian/apps/confluence/current/confluence/WEB-INF/
total 120
drwxr-xr-x 2 atlassian atlassian 24576 Jan 26 08:59 atlassian-bundled-plugins
drwxr-xr-x 2 atlassian atlassian 4096 Jan 26 08:59 atlassian-bundled-plugins-setup
drwxr-xr-x 3 atlassian atlassian 4096 Jan 26 09:08 classes
-rw-r--r-- 1 atlassian atlassian 6971 Jan 25 09:22 decorators.xml
-rw-r--r-- 1 atlassian atlassian 15163 Jan 25 09:22 glue-config.xml
-rw-r--r-- 1 atlassian atlassian 928 Jan 25 09:22 jpms-args.txt
drwxr-xr-x 2 atlassian atlassian 32768 Jan 26 08:59 lib
drwxr-xr-x 2 atlassian atlassian 4096 Jan 26 08:59 osgi-framework-bundles
drwxr-xr-x 2 atlassian atlassian 76 Jan 26 08:59 packages
-rw-r--r-- 1 atlassian atlassian 1968 Jan 25 09:22 server-config.wsdd
-rw-r--r-- 1 atlassian atlassian 1301 Jan 25 09:22 sitemesh.xml
-rw-r--r-- 1 atlassian atlassian 965 Jan 25 09:22 urlrewrite.xml
-rw-r--r-- 1 atlassian atlassian 1688 Jan 25 09:22 web.xml
[atlassian@ip-172-31-12-42 logs]$ cat /opt/atlassian/apps/confluence/current/confluence/WEB-INF/jpms-args.txt 
# Add various JPMS arguments to allow Confluence to work on Java 17.
# These also work with Java 11, but are optional.
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/java.io=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED
--add-opens java.base/sun.net.www.protocol.jar=ALL-UNNAMED
--add-opens java.base/sun.net.www.protocol.http=ALL-UNNAMED
--add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED
--add-opens java.base/sun.util.locale=ALL-UNNAMED
--add-opens java.management/javax.management=ALL-UNNAMED
--add-exports java.base/sun.security.action=ALL-UNNAMED
--add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMED
--add-exports java.xml/com.sun.org.apache.xml.internal.utils=ALL-UNNAMED
--add-exports java.desktop/sun.font=ALL-UNNAMED
--add-exports java.base/sun.security.util=ALL-UNNAMED
```

Thanks!


Answers:
author: Andre
body: Here's the picture of me remembering that supported platforms page is supposed to be read BEFORE the upgrade and not AFTER you upgrade and Confluence doesn't start for some reason.

![giphy (1).gif](https://community.atlassian.com/t5/image/serverpage/image-id/236990i0970F4E773749984/image-size/large?v=v2&px=999 "giphy (1).gif")

Here's my Confluence after I've upgraded Java from 8 to 17:

![2023-01-29_11-09-44.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/236989i7D05A7ECB98BE143/image-size/large?v=v2&px=999 "2023-01-29_11-09-44.jpg")

Now, how embarrassing it'll be to accept my own answer? ;)

comments: author: Olga Svyryd
body: Hi! Thanks a lot for leaving it here. You have just rescued my day))


author: Tom Dickson
body: This can also happen if you edited server.xml and made it mad by leaving -- inside a comment - running start-confluence.sh manually will show you what it is unhappy about.


author: Andre
body: The only files that were modified during the upgrade are server.xml (for https reverse proxy) and confluence-init.properties to point to the data directory

comments: author: serge calderara
body: [@Andre](/t5/user/viewprofilepage/user-id/2132645) did you find your solution, I have exactly the same problem

Thanks for our help


author: Andre
body: yes, I had non-supported Java version


author: sireesha pavalla
body: [@Andre](/t5/user/viewprofilepage/user-id/2132645) how did you fix the issue.?

i'm also getting same error and my confluence java version is 11 which is compatible.


Tags: confluence-server

server