Issue with building service in liferay7? - liferay

I got error while deloying my servicebuilder project in liferay 7. The error is as follows:-
Problem with deploying bundle: Could not resolve module: abhishek-service [497]
Unresolved requirement: Import-Package: com.example.exception; version="[1.0.0,2.0.0)"
I could not figure out why this problem came? The steps I followed are as follows:-
1) Made a servicebuilder through liferay ide named 'abhishek'.
2) Leave the default namespace and entity as it is in service.xml in abhishek-services folder.
3) Build the service through BuildService option in Gradle window.
4) Deployed abhishek-service onto the server.
5) Error pops up as mentioned above.
Please help..thanx in advance..

I guess:
com.example.exception was generated by service builder and placed in abhishek-api module.
you only deployed abhishek-service module
Try to deploy abhishek-api module as well.

Related

Unresolved requirement: Import-Package: com.liferay.portal.kernel.portlet.bridges.mvc; version="[2.0.0,3.0.0)"

I have downloaded Liferay 7.3.5 Community Edition from here and trying to deploy a HelloWorld portlet for testing purposes. It is bundled with Tomcat.
I am using Liferay Developer Studio (the same old Eclipse on steroids) for developing and deploying the portlet. Version 3.8.1.202004240132-ga2
I have also created a Server like in this link - the server is using the tomcat 9.0.37 from the already downloaded bundle.
After steps above, I have followed steps from here to create a Module Project and to deploy it on the already started tomcat server. The portlet appears in the deployed section, but with a red "x" near it:
I went to add the portlet/widget in a widget page that I have created for this purpose, but I could not find the portlet:
Then, logged in with an admin user, I went to Control Panel -> App Manager and searched for my Portlet. It appears as "Installed" and I can activate it. After I hit "Activate", Eclipse logs start writing: ERROR [http-nio-8080-exec-8][PortletServlet:119] javax.portlet.PortletException: org.osgi.framework.BundleException: Could not resolve module: VictorTestPortlet [2716]_ Unresolved requirement: Import-Package: com.liferay.portal.kernel.portlet.bridges.mvc; version="[2.0.0,3.0.0)"_ [Sanitized]
The Question: what is causing this error ?
The problem is as it is already stated - the dependency is not found.
To fix this, I went in build.gradle file that is missing a version for the "com.liferay.portal" dependency. So, my line was looking like this:
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel"
And now it is looking like this:
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "9.8.1"
The version MUST be the same as found in your Liferay Server instance - you can find it by accessing the portal-kernel.jar and looking into its MANIFEST.MF file for the key "Bundle-Version". The jar is located in ...portal-tomcat-7.3.5\tomcat-9.0.37\lib\ext folder.
Good luck !
You found the complex solution yourself, there are two simpler ways:
Use the target platform. Assuming you're using Liferay Workspace, your gradle.properties in the root of your workspace has an entry liferay.workspace.target.platform.version. Set it to 7.3.5 and the versions will be taken automagically
Have even the required modules be detected automagically by setting the target platform, and declare your dependency as
dependencies {
compileOnly group: "com.liferay.portal", name: "release.portal.api"
}
This will even figure out the exact module (of more than 1000) that you need to depend on. Granted, it kind of works against the whole concept of modularization (to be aware of your dependencies), but it's soooo convenient.

Azure Application Insights error when deploying to tomcat

I kept running into the following error messages when after deploying my application using Application Insights. I'm following the Microsoft tutorial, found here, but there still seems to be a dependency error.
Error creating bean with name 'webRequestTrackingFilterRegistrationBean'
java.lang.NoSuchMethodError: com.microsoft.applicationinsights.internal.config.ReflectionUtils.addClass(Ljava/lang/Class;)
I found that the issue was with my dependencies. It turns out that I needed to add the insight-core dependency. Previously I only had applicationinsights-web as my dependency and this ran fine locally but did did not work once I deployed my app.
implementation group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.+'

CookiePolicyOptions' does not contain a definition for CheckConsentNeeded

I am implementing SignalR using dotnet core on visual studio code
on Linux debian ,and following this tutorial (working at the time of posting).
Inside the startup class I got this error message.
According to this article CookiePolicyOptions class does contain the property CheckConsentNeeded which is used to check consent policy.
I am unable to solve this please help.

Integrate Kura and Azure

As I know, we can integrate Kura and Azure IoT Hub.
I followed a tutorial from Microsoft to simulate a device and send data to Azure IoT HUb. Everything is ok.
But when I try to integrate it on Kura.
I followed the tip from Kura to insert external jar ( from Microsoft).
Everything look ok. I exported successful my Bundle.
But when my bundle start, It's not satisfy some conditions with lack class.
Here is the error message:
Instances:
No instances were created because: Can not activate instance of component org.kura.microsoft.simulatedevicesecond.Simulatedevicesecond. The activation throws: java.lang.NoClassDefFoundError: javax/crypto/spec/SecretKeySpec
But the class "javax/crypto/spec/SecretKeySpec" is belong to jce.jar ( existed in java JDK).
Please help me to fix this issue.
Thank a lot.
Your bundle needs to import the package javax.crypto.spec.
I found a solution for my question.
I used wrong version of Kura and Kura Workspace.
I used Kura Workspace 2.2 with Kura version 1.4.
It maked this error. Change it to Kura version 2.x.
Everything is ok

Migrations Error in MVC 5 project

Im develop the MVC project, i have a some issue for this , im already to created database , but i cant update DB in add PM> Update-Database method,
displayed the following error , how can i fix it?
No migrations configuration type was found in the assembly 'MVCMovei'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration).
Thank you
In the package manager console run the following command
Enable-Migrations
After that run Command
Add-Migrations "AnyName" (initialmigration etc)
After that Run
Update-Database (if you want to make changes in database)
I came across this issue whilst working on MVC Movie App tutorial too. Using MS Visual Studio Nuget Packet Manager(PM) do the following;
PM> Enable-Migrations
Checking if the context targets an existing database...
Code First Migrations enabled for project MVC Movie.
PM> Add-Migration Initial
Scaffolding migration 'Initial'.
PM> Update-Database
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Applying explicit migrations: [201808240707259_Initial].
Applying explicit migration: 201808240707259_Initial.
Running Seed method.
To follow these solution in detail use these resource from MS Docs. I hope this help other starters on SO who get stuck.

Resources