Import org.openntf cannot be resolved - xpages

I have a Notes V11.0.1 designer client and configured a widget that imports the latest OpenNTF Domino API (downloaded from OpenNTF website) through an update site.
The plug-in is loaded in the designer
I created a new application and added the library to XSP Properties.
But when I create a simple Java class and want to import org.openntf.domino.*, I get an error:
package test;
import org.openntf.domino.*;
public class Test {
public static void test() {
Session session = null;
}
}
Error: the import org.openntf cannot be resolved.
Building the app does not solve the problem.
In the MANIFESST.MF I get the following error
Any idea why this goes wrong?

It's most likely that the default Target Platform in 9.0.1FP10 and newer (11.0.1 included) is broken: https://frostillic.us/blog/posts/2018/10/19/058650e080e352178525832b00519d2c

Related

setting micronaut configuration location

I have an existing groovy micronaut app I'm trying to change where it loads its config from. I don't understand what code to write so I can set the location of the micronaut configuration. I know you can use micronaut.config.files system variable or MICRONAUT_CONFIG_FILES environment variable, but this is a terrible idea because micronaut is built into grails and therefore every grails app you have running in tomcat will pick up the same config and crash.
Nor do I know where in the code to set the config file. There's an Application class with a run() method, but I don't know if this is only called during development, or whether it gets called when deploying in Tomcat. When setting the config in a Grails app, there is an Application class extending EnvironmentAware, and you can override setEnvironment, and load external configs there, but there is no hint of that for micronaut apps.
The micronaut doco says it can load a configuration from "application.{extension}", but it doesn't say what "application" is, or what directory it expects that in, or whether you can change the directory. Is "application" the value of micronaut.application.name in one's application.yml? I couldn't seem to get it to load based on that.
Then the documentation talks about loading from a PropertySource, which is fine and all, but doesn't tell you where you can put that code to load from a PropertySource. There is mention you can pass the PropertySource to ApplicationContext.run(xx), but in this app I inherited, there is no mention of ApplicationContext, and the micronaut documentation isn't very clear what I'm supposed to do with ApplicationContext. This app I've inherited has an Application class with a main() calling Micronaut.run() which apparently returns an ApplicationContext, but it's not clear if main() is called when running in Tomcat, or whether I should be calling run() on that, when it works as is, and I'm just trying to change where it loads its config.
The question is, how do I get my micronaut app to load its config from
where I tell it to, and not from micronaut.config.file system variable
location.
I don't think we have a specific feature in the framework that allows you to tell the framework to ignore micronaut.config.files. If you would like such a feature you can request it at https://github.com/micronaut-projects/micronaut-core/issues. If that is of interest I suggest you open it up for discussion at https://github.com/micronaut-projects/micronaut-core/discussions first.
You can load external config files, from a path not set as micronaut.config.files, in the main method of the Application class before running the application. Take a look at below class which accepts a config folder location as a system property demo.config.path(can be something else) and loads yaml config files from that folder:
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import io.micronaut.context.env.PropertySource;
import io.micronaut.context.env.yaml.YamlPropertySourceLoader;
import io.micronaut.core.io.ResourceLoader;
import io.micronaut.core.io.file.DefaultFileSystemResourceLoader;
import io.micronaut.runtime.Micronaut;
public class Application {
private static final String PROP_CONFIG_LOCATION = "demo.config.path";
public static void main(String[] args) throws IOException {
if (System.getProperty(PROP_CONFIG_LOCATION) != null) {
List<PropertySource> propertySources = new ArrayList<>();
YamlPropertySourceLoader propertySourceLoader = new YamlPropertySourceLoader();
ResourceLoader resourceLoader = new DefaultFileSystemResourceLoader();
Files.newDirectoryStream(Paths.get(System.getProperty(PROP_CONFIG_LOCATION))).forEach(file -> {
String fileName = file.toString();
String fileNameWithoutExtension = fileName.substring(0, fileName.lastIndexOf('.'));
propertySourceLoader.load(fileNameWithoutExtension, resourceLoader).ifPresent(propertySources::add);
});
Micronaut.build(args)
.classes(Application.class)
.propertySources(propertySources.toArray(new PropertySource[1]))
.start();
} else {
Micronaut.run(Application.class, args);
}
}
}
As is, this code works for yaml config files(with snakeyaml in classpath). With minor changes, it can be made to work for properties files and to read config location from environment variable instead of system property. Full sample application present in github

Hybris can't install occ addon

I've followed the official documentation in order to create my own occaddon webservice layer : https://help.sap.com/viewer/e5d7cec9064f453b84235dc582b886da/1905/en-US/8b96a80f8669101482d4f3c1e27b4eb6.html and created the "dummy" controller :
package org.training.trainingoccaddon.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
#Controller
#RequestMapping(value = "/{baseSiteId}/newResource")
public class ExtendedCustomersController {
#RequestMapping(method = RequestMethod.GET)
#ResponseBody
public String getNewResource() {
return "newSampleResource";
}
}
However, when I try to access to
https://localhost:9002/rest/v2/{baseSiteId}/newResource
It redirects me to hac.
I've created my new occ addon
added to localextensions.xml
Performed ant addoninstall -Daddonnames="occaddon" -DaddonStorefront.ycommercewebservices="ycommercewebservices"
Rebuit the application with ant clean all && hybrisserver debug
But It doesn't work. Am I missing something?
Also, how can I setup swagger?
I am assuming you are using SAP Commerce 1905, also that you not have added any custom 'ycommercewebservices' extension.
Missing ycommercewebservices extension
Since you are redirected to the HAC your 'ycommercewebservices' extension is not loaded correctly. Normally it should throw an error from the 'ycommercewebservices' extension itself instead of redirecting to the HAC.
The extension should be at least present in the 'localextension.xml'.
You can verify loaded extensions in the HAC
e.g. https://localhost:9002/platform/extensions
The next thing you could check if your addon was added as dependency in the 'ycommercewebservices' extension by checking the 'extensioninfo.xml' in its directory. Also double check if a 'project.properties' file was generated in your custom occaddon extension. If something is wrong here you should review your 'ant addoninstall' command.
Swagger Setup
Swagger works out of the box and you can decorate your classes with the annotations as documented on here https://github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X.
You can visit the swagger ui on the ycommercewebservices extension
e.g. https://localhost:9002/rest/v2/swagger-ui.html

Xamarin.Android Cannot pull table from Azure database in Android 10 Q

I did read that because lack of support for Netcore 2.1 the
myItemsList = await App.MobileServiceAndroid.GetTable<MyTable>().ToListAsync();
does not currently work on Android, and there is a workaround to pass an HttpClientHandler() in the constructor of the MobileServiceClient, and so I did like this:
public static MobileServiceClient MobileServiceAndroid =
new MobileServiceClient(AppConstants.AZURE_PRODUCTION_WEB_API_URL, new HttpClientHandler());
But this is incomplete,its still not working, what exactly do I have to do to make this work, any guidance is much appreciated.
From my understanding, you are using a Forms/PCL project whereas the other solution was implementing this code inside their Android project.
For you, once you add using Xamarin.Android.Net; to the class, you should be able to just do this:
public static MobileServiceClient MobileServiceAndroid =
new MobileServiceClient(AppConstants.AZURE_PRODUCTION_WEB_API_URL, new AndroidClientHandler());
Most likely you might have issues getting that using statement, for that you will have to follow steps shown here, or customized for you in the following steps:
Add the Xamarin Forms project to all your projects.
Create an interface ICustomClientHandler in the Core project
using System;
using System.Net.Http;
namespace Test
{
public interface ICustomClientHandler
{
HttpClientHandler GetHandler();
}
}
Then create a CustomClientHandler in the Droid project, which will be the Android part of the dependency service that will help you retrieve the native AndroidClientHandler
using System.Net.Http;
using Xamarin.Android.Net;
using System.Runtime.CompilerServices;
using Xamarin.Forms;
using Test;
[assembly: Xamarin.Forms.Dependency(typeof(Test.Droid.CustomClientHandler))]
namespace Test.Droid
{
public class CustomClientHandler : ICustomClientHandler
{
public HttpClientHandler GetHandler()
{
return new AndroidClientHandler();
}
}
}
Implement an iOS version as well in a similar way, but it will instead return new HttpClientHandler();
Finally, use the code as shown, in your Core project:
var clientHandler = DependencyService.Get<ICustomClientHandler>().GetHandler();
public static MobileServiceClient MobileServiceAndroid =
new MobileServiceClient(AppConstants.AZURE_PRODUCTION_WEB_API_URL, clientHandler);

How do I get a specific dependency with grab?

Im using the AWS SDK:
#Grab(group='com.amazonaws', module='aws-java-sdk-elasticbeanstalk', version='1.11.232')
import com.amazonaws.regions.Regions
import com.amazonaws.services.elasticbeanstalk.*
import com.amazonaws.services.elasticbeanstalk.model.DescribeEnvironmentsRequest
import com.amazonaws.auth.AWSStaticCredentialsProvider
import com.amazonaws.auth.BasicAWSCredentials
import com.amazonaws.auth.EnvironmentVariableCredentialsProvider
class testAws {
static Object test (){
def awsCreds = new BasicAWSCredentials('sdfsdfdf', 'sdfsdfdsf')
def ebClient = new AWSElasticBeanstalkClientBuilder()
.withRegion(Regions.valueOf('US-EAST-1'))
.withCredentials(new AWSStaticCredentialsProvider (awsCreds))
.build()
ebClient.describeEnvironments(
new DescribeEnvironmentsRequest().withEnvironmentNames('zzzzz')
).getEnvironments()
}
}
I get this error:
Caught: java.lang.NoSuchMethodError: `org.apache.http.conn.ssl.SSLConnectionSocketFactory.<init>(Ljavax/net/ssl/SSLContext;Ljavax/net/ssl/HostnameVerifier;)V`
Doing some googling i found the aws sdk depends on a specific version of the http library. If this was a java project I would define that specific version in my pom or gradle config. How do I do this with grab?
To be clear I dont need to grab http explicitly because it gets pulled in as a dependency of the aws sdk. The problem is I have a different (newer) version installed locally. Even if I explicitly grab the older version it still throws this error. If I uninstall the new version from my system it works. But I want to enforce this in groovy and not have to modify local environemnt.

Problems using an installclass in a web setup for a web site

I am trying to create a web setup for my web site, and I want to use an installer class to do some custom stuff. I am using VS 2010, and the web site and installer is .NET 3.5.
I have added reference to the installer class project output in the Install section under Custom Actions:
I have also set /targetdir="[TARGETDIR]/" on the CustomActionData for this action.
The InstallScript project is a standard class library (dll).
There is a public class that inherits from Installer class. It overrides the Install method as I have seen been done in several online examples:
using System.Collections;
using System.Windows.Forms;
namespace InstallScript
{
public class MyWebInstaller : System.Configuration.Install.Installer
{
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
var targetDir = Context.Parameters["targetdir"];
if(targetDir==null) targetDir = "No TARGETDIR!";
MessageBox.Show("TARGETDIR:\t" + targetDir);
}
}
}
I would think there should be shown a message box here som time during the install, but it seems like it is never called. No error is shown either. The setup just runs through as if this code was never called.
Anyone have idea of what is wrong?
OK, I found out what was missing.
You need to specify the class with the class attribute RunInstaller(true) for the setup to pick up and actually run the code.
So the class needs to be declared like this:
[System.ComponentModel.RunInstaller(true)]
public class MyWebInstaller : System.Configuration.Install.Installer
{
...

Resources