To use the BCE SMS service, I downloaded its SDK and added it to my portlet. Java.lang.NoClassDefFoundError error occurred, the cost of 2-3 days to the investigation. For some records.
Increase the path of the jar package to the environment variable: No.
As the link says to create a separate directory and do related processing: No.
Solution :
1. Create a new Libs folder under the project root directory
2. Put the package you want to add to this directory
3. Right-key build path-> use as source folder
4. Right-->add to build path on jar bundle
Clean:not work: No way.
User libraries:added to this, try: No.
The Bce_jar directory under the project is deleted.
3rd parties ' Lib not included? Third party also joined the project BCE Lib inside. No
Java build Path:ordre and Export: joined the library (the library you joined) BCE: No way.
Article (link here): Resolving the Java.lang.NoClassDefFoundError in the project using Maven: ....
Join the project directory Web-inf\lib, drag directly from the bottom of the BCE library can be: at least compiled successfully. And the site can be started normally.
A preliminary look at the errors associated with BCE. The error is changed as follows:
11:52:04,615 ERROR [http-bio-8080-exec-4][render_portlet_jsp:132] Null
Java.lang.ClassNotFoundException:com.google.common.base.Preconditions
However, when the corresponding function is Savevalue, the error appears as follows: (the error has changed.) )
11:56:11,874 ERROR [http-bio-8080-exec-10][portletservlet:116] javax.portlet.PortletException: Java.lang.NoClassDefFoundError:Could not initialize class Com.baidubce.services.sms.SmsClientConfiguration
Javax.portlet.PortletException:java.lang.NoClassDefFoundError:Could not initialize Class Com.baidubce.services.sms.SmsClientConfiguration
Inside the generated war package, the corresponding jar package (Bce-java-sdk-0.10.4.jar) appears in the Web-inf directory. At least it was a step more right. or from the above article to get the inspiration.
Guessing the problem above may be that the BCE third party jar package is not in the generation. All the BCE third party jar packs are placed in the Web-inf\lib directory, and the release is recompiled. You can run and return to the default page. The "unavailable portlets" prompt does not appear. As for whether the mobile phone can receive SMS, it is another problem (there is a lot of debug information available). (PostScript: Text messages have been sent correctly.) )
Preliminary conclusion: There should be a third-party jar package as a library in the Web-inf\lib directory in the project in Eclipse, and the resulting war package will include these jars for normal operation.
(PostScript: In the next section of the Hu Qi-Stable tutorial, lesson 19th-"Integrated use of Struts2 and Liferay", there is a demo of putting a third party jar package, the Struts2 jar package, into the web-inf\lib. If you had seen it earlier, you would have saved some time. )