Message Boards

Liferay Uni Exercise: Components and Services, errors on osgi-service build

Noah Bowman, modified 3 Years ago.

Liferay Uni Exercise: Components and Services, errors on osgi-service build

New Member Posts: 13 Join Date: 9/28/20 Recent Posts
I am following the instruction step-by-step when creating the Bnd OSGi Project 'osgi-service'. I created both the workspace and project the way the directions show below:








When my "osgi-service" project is created, it immediately has 23 errors in the build. No annotations are recognized and nothing  "Liferay" is either. Here are the errors I have:

​​​​​​​

I'm new to dev studio, but I followed all of the directions given to me. What is the problem here?
thumbnail
Olaf Kock, modified 3 Years ago.

RE: Exercise: Components and Services - Errors on osgi-service build

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Noah Bowman:

I am following the instruction step-by-step when creating the Bnd OSGi Project 'osgi-service'. I created both the workspace and project the way the directions show below: ...

It would help knowing which instructions you followed, and if you used all the same versions as used in that exercise. I'm assuming that you went through one of the Liferay University courses - please state which version it is for, which version (of DevStudio, Liferay) you're using, and if you're using Java 8 or 11
Noah Bowman, modified 3 Years ago.

RE: Exercise: Components and Services - Errors on osgi-service build

New Member Posts: 13 Join Date: 9/28/20 Recent Posts
Hi Olaf, I am using Liferay Developer Studio version 3.8.1 and JDK 8. The exercises use both studio and JDK 8, but do not specify which version of the developer studio. The instructions I followed are all shown in the screenshots on my post.
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Exercise: Components and Services - Errors on osgi-service build

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
I am not sure where you found those instructions, but they seem to create a "generic" osgi module.
Instead of that, I recommend that you follow the Liferay documentation and create a Liferay Module Workspace and then a module project.  That way, you can leverage the workspace features and the wizards implemented by Liferay to create new module projects.
https://help.liferay.com/hc/en-us/articles/360017885072-Creating-a-Liferay-Workspace-with-Dev-Studio
Noah Bowman, modified 3 Years ago.

RE: Exercise: Components and Services - Errors on osgi-service build

New Member Posts: 13 Join Date: 9/28/20 Recent Posts
Christoph, The instructions are a part of the a Liferay University exercise and include creating a workspace (see step 4). It has me create a workspace and a project. If you have anything to share about the specific errors, it would be appreciated.
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Liferay Uni Exercise: Components and Services, errors on osgi-service b

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
Ah! The backend developer course!
I am not sure, where the problem is, but I suspect it has to do with maven. Maven(https://de.wikipedia.org/wiki/Apache_Maven ) is used to find the dependencies and it obviously doesn't in your case.
1) Are you connected to the internet when you try to build? (It has to download the dependencies)
2) Can you check, if you have a C:\Users\<YourUser>\.m2 folder? Is it there (Note: You can change it in the Eclipse Preferences -> Maven -> User settings. Did you do that by chance?)
Maybe you could remove the Developer studio and install it from scratch? Something is wrong and it is really hard to say what. IMHO it has nothing to do with the project type, something else is wrong. But it is hard to say, what it is.
Noah Bowman, modified 3 Years ago.

RE: Liferay Uni Exercise: Components and Services, errors on osgi-service b

New Member Posts: 13 Join Date: 9/28/20 Recent Posts
Yep, it's the backend developer course. I am connected to the internet when I build, but the build immediately fails so if the dependencies are yet to be downloaded, then I don't know what would be preventing it outside a bad internet connection.
I checked that path you suggested, and I do see a .m2 folder there. I also checked the maven user settings in eclipse, I see the path to that folder under the "User Settings" and "Local Repository" file paths. The file path for "Global settings" is empty though. Could this empty file path be the issue?I have removed and re-installed the developer studio a few times already, but get the same result. I have even completely started the exercises from scratch, starting with the first exercise to make sure I did not miss anything.
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Liferay Uni Exercise: Components and Services, errors on osgi-service b

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
I have no idea what the root cause of your issue could be. You could try to remove the .m2 folder (or maybe rename it to be safe), maybe it got corrupted somehow. It should be automatically recreated.
You could also try to use the command line mvn command and try "mvn clean install".
Noah Bowman, modified 3 Years ago.

RE: Liferay Uni Exercise: Components and Services, errors on osgi-service b

New Member Posts: 13 Join Date: 9/28/20 Recent Posts
That command is not recognized in cmd or powershell for me, but thanks for trying. I am in contact with University support, so they should hopefully have a better understanding of the issue.
Noah Bowman, modified 3 Years ago.

RE: Liferay Uni Exercise: Components and Services, errors on osgi-service b (Answer)

New Member Posts: 13 Join Date: 9/28/20 Recent Posts

I was able to narrow the issue down to a consistent problem when downloading dependencies. My machine is authenticated by my company's certificate, so I had to add an entry to the java cert store for the IDE to recognize network activity as valid.

This is the command I ran (as admin) in cmd (Windows 10):

keytool -importcert -file ".crt file path" -keystore "C:\Program Files\Java\jre1.8.0_271\lib\security\cacerts" -alias "my alias"

This is the article I referenced when creating the command https://stackoverflow.com/questions/684081/importing-ssl-certificate-into-eclipse

Hopefully this reaches anyone who might be running into this same problem. I could not find anything about this issue on the community or Liferay's documentation.