3

I am new to WSO2 API Manager. As per the documentation i tried to start the server locally but i got error stating that Could not find or load main class Enterprise.

Can someone please help me to fix this issue to proceed further

D:\softwares\WSO2\WSO2 API Manager\wso2am-2.0.0\wso2am-2.0.0\bin>wso2server.bat

JAVA_HOME environment variable is set to C:\Program Files\Java\jdk1.8.0_111
CARBON_HOME environment variable is set to D:\softwares\WSO2\WSO2 Enterprise Service Bus\wso2esb-5.0.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Error: Could not find or load main class Enterprise

D:\softwares\WSO2\WSO2 API Manager\wso2am-2.0.0\wso2am-2.0.0\bin>

Thanks Munna

Abimaran Kugathasan
  • 31,165
  • 11
  • 75
  • 105
munna
  • 314
  • 5
  • 21

6 Answers6

5

Thank you for the details.

Here are steps for resolving this issue

  1. I created APIM folder with spaces. due to that it was giving below error. So please avoid spaces when you create any WSO2 folders Error: Could not find or load main class API

  2. When we unzip the latest version of APIM it will create folder in below structure. D:\softwares\WSO2\WSO2 API Manager*wso2am-2.0.0\wso2am-2.0.0*

Due to above structure wso2server.bat file will look for repository/conf file and it will through below error.

Configuration error java.io.FileNotFoundException: D:\softwares\WSO2\APIM\wso2am-2.0.0\wso2am-2.0.0\bin\..\repo‌​sitory\conf\etc\logg‌​ing-bridge.propertie‌​s (The system cannot find the path specified) Error occured while creating the log4j prop fragment bundle. java.io.FileNotFoundException: D:\softwares\WSO2\APIM\wso2am-2.0.0\wso2am-2.0.0\bin\..\repo‌​sitory\components\..‌​\conf\log4j.properti‌​es (The system cannot find the path specified)

So eventually it will try to look for repository folder under wso2am-2.0.0\wso2am-2.0.0\ which is not exist.

So to fix that issue move all the files from subfolder from wso2am-2.0.0\wso2am-2.0.0\ to wso2am-2.0.0 and delete the subfolder means highlighted one (wso2am-2.0.0**wso2am-2.0.0**.

Now go to D:\softwares\WSO2\APIM\wso2am-2.0.0\bin and run the wso2server.bat file and it will run successfully.

Please fell free to reach out to me in case of any issues.

Thank you Munna Mahaboob

Abimaran Kugathasan
  • 31,165
  • 11
  • 75
  • 105
munna
  • 314
  • 5
  • 21
5

My suggestion is:

  1. Set the CARBON_HOME environment variable system wide, according to wso2am_HOME, but do not use the ending backslash ('\'). e.g. CARBON_HOME=D:\Program Files\WSO2\API Manager\2.6.0
  2. missing quote marks at one place in the wso2server.bat, at the starting java VM part, that's why the spaces in path not works, but if you correct it, you do not need to avoid spaces... the wrong place is the wso2.carbon.xml parameter path. The correct syntax is with quote marks: -Dwso2.carbon.xml="%CARBON_HOME%\repository\conf\carbon.xml"
Armali
  • 18,255
  • 14
  • 57
  • 171
tibi
  • 51
  • 1
  • 1
  • @Armali - Could you please guide me here: https://stackoverflow.com/questions/56186681/java-util-concurrent-executionexception-org-apache-catalina-lifecycleexception ? – PAA May 17 '19 at 13:10
  • @PAA - I'm sorry, but I don't know jack about WSO2. – Armali May 20 '19 at 06:29
1

Probably it is because you used spaces in your CARBON_HOME path. Remove the spaces and you will be okay.

parand87
  • 163
  • 1
  • 3
  • 10
0

Looking at the logs you have provided it looks like you have set an environment variable for CARBON_HOME as D:\softwares\WSO2\WSO2 Enterprise Service Bus\wso2esb-5.0.0. This should be the reason for class loading failure during the server startup. Try removing the environment variable from the system and restart the server.

  • Hi mpmunasinghe,I specified CARBON_HOME because i was getting below error.Now i removed it and getting this error. D:\softwares\WSO2\WSO2 API Manager\wso2am-2.0.0\wso2am-2.0.0\bin>wso2server.bat --run The system cannot find the file specified. JAVA_HOME environment variable is set to C:\Program Files\Java\jdk1.8.0_111 CARBON_HOME environment variable is set to D:\softwares\WSO2\WSO2 API Manager\wso2am-2.0.0\wso2am-2.0.0\bin\.. Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 Error: Could not find or load main class API – munna Dec 29 '16 at 19:10
  • Is it something am i missing with any configurations? Can you please let me know is there a way to debug this further ? – munna Dec 29 '16 at 19:12
  • I see that you have made progress following the suggestion given by Kasun in this regard. For the current problem can you check whether the conf folder is in the required path. **D:\softwares\WSO2\APIM\wso2am-2.0.0\wso2am-2.0.0\repo‌​sitory\conf**. – mpmunasinghe Dec 30 '16 at 03:13
  • Hi mpmunasinghe, There is no such folder in the required pathD:\softwares\WSO2\APIM\wso2am-2.0.0\wso2am-2.0.0\repo‌​sitor‌​y – munna Dec 30 '16 at 04:59
  • Hi mpmunasinghe, I conf empty folder and tried to run the server. but still it is expecting some files in the conf folder like **carbon.xml,log4j.properties,etc\config-validation.xml,event-processor.xml** so on. can you please help to how to gather those files because i have not found conf folder itself once i unzip the APIM. – munna Dec 30 '16 at 05:08
  • Hi mpmunasinghe, I found that conf folder is created uner D:\softwares\WSO2\APIM **wso2am-2.0.0\repository\conf.** Seems wso2server is looking conf folder at D:\softwares\WSO2\APIM\ **wso2am-2.0.0\wso2am-2.0.0\repo‌​sitor‌​y\conf.**. Can you please help how to map it to correct folder. – munna Dec 30 '16 at 05:15
0

Probably you would have set environment variable CARBON_HOME in system level to esb (D:\softwares\WSO2\WSO2 Enterprise Service Bus\wso2esb-5.0.0). This is why when you start the apim it prints the CARBON_HOME as esb path.

You don't need to set CARBON_HOME in system level.Servers itself will try to figure out it when getting started.

Jenananthan
  • 1,381
  • 2
  • 10
  • 20
  • Hi Jenananthan,I specified CARBON_HOME because i was getting below error.Now i removed it and getting this error. D:\softwares\WSO2\WSO2 API Manager\wso2am-2.0.0\wso2am-2.0.0\bin>wso2server.bat --run The system cannot find the file specified. JAVA_HOME environment variable is set to C:\Program Files\Java\jdk1.8.0_111 CARBON_HOME environment variable is set to D:\softwares\WSO2\WSO2 API Manager\wso2am-2.0.0\wso2am-2.0.0\bin\.. Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 Error: Could not find or load main class API – munna Dec 29 '16 at 19:10
  • Is it something i am missing with any configurations? Can you please let me know is there a way to debug this further ? – munna Dec 29 '16 at 19:11
  • 2
    Try removing the spaces in the folder path. – Kasun Gajasinghe Dec 29 '16 at 20:02
  • Hi Kasun, Thank you for the suggestion. Now I made little progress and getting below exception Configuration error java.io.FileNotFoundException: D:\softwares\WSO2\APIM\wso2am-2.0.0\wso2am-2.0.0\bin\..\repository\conf\etc\logging-bridge.properties (The system cannot find the path specified) Error occured while creating the log4j prop fragment bundle. java.io.FileNotFoundException: D:\softwares\WSO2\APIM\wso2am-2.0.0\wso2am-2.0.0\bin\..\repository\components\..\conf\log4j.properties (The system cannot find the path specified) – munna Dec 29 '16 at 23:39
  • [2016-12-29 15:30:13,002] ERROR {org.wso2.carbon.utils.CarbonUtils} - Cannot read file D:\softwares\WSO2\APIM\wso2am-2.0.0\wso2am-2.0.0\bin\..\repository\conf\carbon.xml java.io.FileNotFoundException: D:\softwares\WSO2\APIM\wso2am-2.0.0\wso2am-2.0.0\bin\..\repository\conf\carbon.xml (The system cannot find the path specified) – munna Dec 29 '16 at 23:40
0

Add quotes to the text below with in the wso2server.bat file and all will be well.

BEFORE -Dwso2.carbon.xml=%CARBON_HOME%\repository\conf\carbon.xml

AFTER -Dwso2.carbon.xml="%CARBON_HOME%\repository\conf\carbon.xml"

Kalema Edgar
  • 369
  • 5
  • 17