We are trying to migrate code from Liferay 6.2 to Liferay 7.2, but we've hit a wall when it comes to service builder. We've followed the guide (changing the dependency-injector to ds, adding the #Component to impl classes...) but when we run a ds:unsatisfied command in the gogo shell, this appears:
Declarative Service {id: 5522, name: foo.**PersistenceImpl, unsatisfied references:
{name: Configuration, target: (&(origin.bundle.symbolic.name=foo.service)(name=service))}
}
Any ideas what is happening?
a couple of months late but here is what fixed our problems.
Basically we had to create a two new classes, one that implements org.osgi.framework.BundleActivator and another com.liferay.portal.upgrade.registry.UpgradeStepRegistrator.
Doing this, we force the table to update the version of the service and publish them to osgi.
A possible failure of "unsatisfied references" may be also in the case you used Service Builder and you changed the default package name (suggested by the process), but you did not update the other references manually.
In more details: I had the same issue, but after checking with Gogo Shell tool (Control Panel -> Gogo Shell and then write ds:unsatisfied), it figured out that there were some missing packages that should have been exported by the *-api component (hint: there is an *-api and a *-service component that are generated when you follow the Service Builder steps).
The fix
So, I went in the bnd.bnd file from the *-api component and checked the Export-Package entry. What I noticed was that, even though I have changed the package to totally something else, the Service Builder process did not care and used the same old default package (hint: it names them by appending to the name of the service the .exception, .model, .service and .service.persistence). Below is an example of my Export-Package property from the bnd.bnd file:
Export-Package:\
<my_service_name>.exception,\
<my_service_name>.model,\
<my_service_name>.service,\
<my_service_name>.service.persistence
Changind the <my_service_name> to the actually name of my package solved the issue.
Further reading: https://help.liferay.com/hc/en-us/articles/360018168891-Detecting-Unresolved-OSGi-Components
Related
I want to script my Jenkins installation. I use always use the "stable" release of Jenkins (currently : 2.121.3), but I noticed that when I install the stable release, the update website (in admin > plugin > advance) is setted to "https://updates.jenkins.io/update-center.json" which is not the stable release. I have to change this setting to "http://updates.jenkins-ci.org/stable/update-center.json".
I want to do it automatically, by script. I know I can change this setting in the /var/lib/jenkins/hudson.model.UpdateCenter.xml file, but I prefere to use a Groovy script to do this.
But I cant find a way to change this settings in Groovy scriptbecause i'm not aware of the Jenkins/Hudson data model neither the Groovy syntax, I dont know how to change and save the setting.
I was also searching for something like this, I just solved this using groovy, hope this helps anyone else as well.
import hudson.model.UpdateCenter;
import hudson.model.UpdateSite;
import hudson.util.PersistedList;
import jenkins.model.Jenkins
site = "http://updates.jenkins.io/update-center.json"; // TBD: update as necessary
PersistedList < UpdateSite > sites = Jenkins.getInstance().getUpdateCenter().getSites();
for (UpdateSite s: sites) {
if (s.getId().equals(UpdateCenter.ID_DEFAULT))
sites.remove(s);
}
sites.add(new UpdateSite(UpdateCenter.ID_DEFAULT, site));
As for the current Jenkins core API version (>2.16X),
The UpdateCenter Javadoc and UpdateSite Javadoc do not display any method that allows to either add or update the update site.
The UpdateCenter Class source code confirms that the values of the update sites are actually loaded (I suppose at the start of Jenkins) with no possibility to alter the lists afterwards.
So I guess the only way to set a custom update site is to have a custom update site is to feed Jenkins with a custom hudson.model.UpdateCenter.xml at the start.
Here're a couple of observations that I made (please confirm or invalidate in the comments below, as I'm not 100% sure about these):
the custom update site must have id default
discovery of plugins seems to fail at first start. Jenkins must be re-started in order to discover plugins.
Im working with Liferay 7 and module development.
I created a module of type "portlet-provider" for can change the view of personalBar.
When I deploy it first time, it deploys ok, but after that, new deploys are not refreshing jsp files.
Is important to said that when I deploy the module, via blade or via gradle in Intellij, it deploys ok and also change the OSGI related folder, deleting old version and creating a new one with new jsp ok.
Even with that in a clear browser (recent removed all cache and temp) does no not refresh the personalBar view, related to new jsp file.
I saw this thread: https://web.liferay.com/community/forums/-/message_boards/message/88515142 , and tested the following.
1) Changed the tomcat timeZone, put the same timezone that I had in my desktop. (GMT-3 ) , it didn't work .
2) The only thing that seems to work is to clear all osgi state content and $liferay_home/work content and restart server as David said in above post.
But I need a way to can deploy theses modules without having to restart the server
Any help on this?
Thanks in advance
About my problem, I had a problem with the priority of the module so the module been deployed were not the same showed in portal.
At the beginning I set the "service.ranking:Integer="+Integer.MAX_VALUE , but I don't know why it was removed and for that the portlet showed was the portal default personal bar.
In Liferay Developer Studio, I am try to set the Runtime Environment for my local server. After selecting a runtime environment from the drop down, I then try to save the change and get the following message:
The server cannot be saved for the following reasons: [Overview] Changing runtime base directories is not supported.
Is this a change I need to do manually in a configuration file, or should I going elsewhere to change the runtime environment?
It seems to be a known issue in Liferay IDE, check the issue.
You may have a clean version of the Liferay-Tomcat bundle given along with the Liferay IDE. What I recommand you is to create a new server that refers to this runtime environnement.
If you don't have a clean version of the Liferay-Tomcat bundle you can download new one from Liferay official site.
I found a way to get the existing runtime evironment changed.
I first had to go to the server properties and select "Switch Location". This moved the server properties from "[workspace metadata] to my workspace/servers/ directory.
Inside the .server file, I just had to change the runtime-id property to one of my predefined runtimes, in my case...
runtime-id="Liferay v6.2 EE (Tomcat 7)"
My Liferay server is now working as expected.
This is my first azure project and I'm not sure if I'm doing something wrong.
I'm trying to get some configuration inside an MVC 3 webrole and for this I'm using:
RoleEnvironment.GetConfigurationSettingValue(KeyName)
When I run the application on the emulator i get his error:
BC30451: 'RoleEnvironment' is not declared. It may be inaccessible due to its protection level.
I tried to add the full namespace like this:
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(KeyName)
And I get this error:
BC30456: 'ServiceRuntime' is not a member of 'WindowsAzure'.
However, I can access the RoleEnvironment inside the "OnStart" event of the WebRole class.
So, is it the expected behavior? If yes, how am I supposed to read configuration through the whole project?
Thanks in advance;
Have you added a reference to the Microsoft.WindowsAzure.ServiceRuntime assembly in your MVC project?
http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleenvironment.aspx
I started a new solution based on seanost suggestion and it worked well, so I figured the problem wasn't VS. After a few try and errors I finally found a solution, I just don't have an explanation for it :-)
Under my MVC project I have a folder called "App_Code".
Since i come from web forms development I'm use to the name so I created this folder to keep some classes. If I try to access "RoleEnviroment" from a class inside this folder the project compiles but won't even open, no matter what I try to access it will throw the same error.
If I rename the folder or move the files to another folder (let's say "Code"), it just works.
As I said before, I just don't know why it happens (and it doesn;t really matter now :-)
FYI, if you're using Visual Studio's Azure templates, references to the following namespaces are included by default, so it's not necessary to set Copy Local to true:
Microsoft.WindowsAzure.Diagnostics
Microsoft.WindowsAzure.ServiceRuntime
Microsoft.WindowsAzure.StorageClient
To make sure Visual Studio and the SDK is installed correctly, you should be able to do the following: Create a new MVC3 Azure project, add a using directive for the ServiceRuntime library in your Home controller, then add the following code in the Index action:
ViewBag.configValue = RoleEnvironment.GetConfigurationSettingValue("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString");
return View();
Then, add the following Razor syntax in the View:
<p>#ViewBag.configValue;</p>
And you should get the following result in your browser:
UseDevelopmentStorage=true
I have a WCF service that uses a separate project for a DAL, which I have a reference to, and can access the entity objects with the DAL, through the service as such:
[OperationContract]
GeoLocations GetLocations();
This returns a GeoLocations object.
The issue is that I have updated the DAL as my database has changed, and I see all the new fields in the code, however when I do a 'view source' on GeoLocations I see the following file:
GeoLocations [from metadata]
... which doesn't contain any of the new fields, and is locked in the IDE.
I have tried cleaning the project, deleting all the DLL's, etc., but I still see the old class.
How can I update this with the new properties?
Thanks.
I faced such issue in many time and i found problem is related to this.
1.As you change in DAL. It is neccesarry that you build that project first.
WCF pproject as Reference of DAL. So you need to build this too and verify that it has updated DLL.
Now go to project and update service reference. of that Service in project or application where you consume your WCF service.
A couple of things:
When updating the service reference, depending on how large the service is that is being consumed, all the property definitions may not be updated right away. Also, after the service reference has been updated, I recommend building the project and then continuing. This seems to avoid the previous issue.