Cannot access class 'jupyter.kotlin.MimeTypedResult' - kotlin

I am running jupyter with the latest kotlin kernel
Kotlin kernel v. 0.11.0.170, Kotlin v. 1.8.0-dev-3517
I am using kotlin-jupyter-api version 0.11.0-183-1.
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlin-jupyter-api</artifactId>
<version>0.11.0-183-1</version>
</dependency>
I tried to put a MIME object (a png) to display in a cell by calling the API.
E.g.,
return new MimeTypedResult(singletonMap("text/html", html), false, null);
The MimeTypedResult returned is of class
org.jetbrains.kotlinx.jupyter.api.MimeTypedResult
in kotlin-jupyter-api version 0.11.0-183-1.
However, the notebook gives this error: Line_19.jupyter-kts (4:3 - 7) Cannot access class 'jupyter.kotlin.MimeTypedResult'. Check your module classpath for missing or conflicting dependencies
I cannot understand why it is looking for 'jupyter.kotlin.MimeTypedResult' instead of 'org.jetbrains.kotlinx.jupyter.api.MimeTypedResult'
enter image description here
I searched the source code in here but can't find anything about jupyter.kotlin.MimeTypedResult or jupyter-kts.
Can anybody help me to solve this problem?

Related

Missing Template Arguments for pcl::gpu::EuclideanClusterExtraction in PCL-1.12

I am trying this example to use PCL with GPU and get the error
~/gpu-pcl/main.cpp:85: error: missing template arguments before ‘gec’
pcl::gpu::EuclideanClusterExtraction gec;
I have tried that example with pcl-1.11.1 and it worked well .But when updated to pcl-1.12.1, I get that error.
My work environment:
Ubuntu 18.04,
with Cmake version 3.20,
Is there anything that I have missed out??
In the documentation of pcl1.12:
template
class pcl::gpu::EuclideanClusterExtraction< PointT >
EuclideanClusterExtraction is a template class, thus the type of point of the point cloud is needed in the position of PointT, for example, PointXYZ.[https://pointclouds.org/documentation/classpcl_1_1gpu_1_1_euclidean_cluster_extraction.html#details]

idea `org.jetbrains.plugins.go` not found

I had this problem when I was developing the GoLand plug-in and install plugin from build jar Plugin Gorm Generator depends on unknown plugin com.intellij.velocity
<depends>org.jetbrains.plugins.go</depends>
build.gradle:
intellij {
version '2020.2.1'
sandboxDirectory = "${rootProject.rootDir}/idea-sandbox"
type 'IU'
plugins = ['java', 'DatabaseTools', 'Velocity']
updateSinceUntilBuild false
setPlugins("org.jetbrains.plugins.go:202.7319.5")
}
i'm not find
You're setting the plugins list twice - by assigning an array to the plugins property and calling setPlugins method. That makes your first array simply overwritten by the Go dependency.
Try with the first approach only and simply append the Go entry at the end of your array.

How do I fix this Kryo exception when using a UDF on hive?

I have a hive query that worked in hortonworks 2.6 sandbox, but it doesn't work on sandbox ver. 3.0 because of this exception:
Caused by: org.apache.hive.com.esotericsoftware.kryo.KryoException: Encountered unregistered class ID: 95
Serialization trace:
parentOperators (org.apache.hadoop.hive.ql.exec.vector.reducesink.VectorReduceSinkLongOperator)
childOperators (org.apache.hadoop.hive.ql.exec.vector.VectorFilterOperator)
childOperators (org.apache.hadoop.hive.ql.exec.TableScanOperator)
aliasToWork (org.apache.hadoop.hive.ql.plan.MapWork)
at org.apache.hive.com.esotericsoftware.kryo.util.DefaultClassResolver.readClass(DefaultClassResolver.java:137)
at org.apache.hive.com.esotericsoftware.kryo.Kryo.readClass(Kryo.java:670)
at org.apache.hadoop.hive.ql.exec.SerializationUtilities$KryoWithHooks.readClass(SerializationUtilities.java:185)
How do I fix it?
I have seen some answers suggesting doing set hive.exec.parallel=false; but it doesn't work, I still get this error.
I checked the versions of libraries that I use and made sure that hadoop version and hive --version match the versions of libraries that I use in my jar.
I also tried this: https://community.hortonworks.com/content/supportkb/150199/orgapachehivecomesotericsoftwarekryokryoexception-1.html it did not work either.
I was finally able to run my queries after I reduced the size of my udf.jar. It used to be 150 mb and I reduced it to 50 kb. It seems like a kryo bug. I got this info from here:
https://github.com/EsotericSoftware/kryo/issues/307
I reduced the size of my udf.jar by marking all dependencies as provided. So I went from this:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>3.1.1</version>
</dependency>
to this:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>3.1.1</version>
<scope>provided</scope> <!--Notice this line-->
</dependency>
This is definitely a kryo bug, because I was able to run this query with that large udf.jar file in hortonworks 2.6.
I hope someone finds this information valuable.
I actually referred to this thread of hive https://issues.apache.org/jira/browse/HIVE-7711
the comment by Dr.Christian Betz on this issue suggests implementing DoNothingSerializer to solve this exception. I tried implementing that solution and the problem was solved. However, I could not understand the details of how adding Serializer is solving this issue.
Find the solution at this link.
Try implementing following Serializer for the class which extends GenericUDF.
import org.apache.hive.com.esotericsoftware.kryo.Kryo;
import org.apache.hive.com.esotericsoftware.kryo.Serializer;
import org.apache.hive.com.esotericsoftware.kryo.io.Input;
import org.apache.hive.com.esotericsoftware.kryo.io.Output;
public class DoNothingSerializer extends Serializer<App> {
#Override
public App read(Kryo arg0, Input arg1, Class<App> arg2) {
// TODO Auto-generated method stub
return new App();
}
#Override
public void write(Kryo arg0, Output arg1, App arg2) {
// TODO Auto-generated method stub
}
}

Create a repository on a remote server with RDF4J

I've been trying to create a new repository on a remote GraphDB server using RDF4J, but I'm having problems.
This runs, but is seemingly not correct
HTTPRepositoryConfig implConfig = new HTTPRepositoryConfig(address);
RepositoryConfig repoConfig = new RepositoryConfig("test", "test", implConfig);
Model m = new
However, based on the info I get from "edit repository" in the workbench, the result doesn't look right. All the values are empty, except for id and title.
This fails
I tried to copy the settings from an existing repository that I created on the workbench, but that failed with:
org.eclipse.rdf4j.repository.config.RepositoryConfigException:
Unsupported repository type: owlim:MonitorRepository
The code for that attempt is inspired by the one found here . Except that the config file is based on an existing repo, as explained above. I also tried to config file provided in the example, but that failed aswell:
org.eclipse.rdf4j.repository.config.RepositoryConfigException:
Unsupported Sail type: graphdb:FreeSail
Anyone got any tips?
UPDATE
As Henriette Harmse correctly pointed out, I should have provided my code, not simply linked to it. That way I might have discovered that I hadn't done a complete copy after all, but changed the important first bits that she points out in her answer. Full code below:
String address = "serveradr";
RemoteRepositoryManager repositoryManager = new RemoteRepositoryManager( address);
repositoryManager.initialize();
// Instantiate a repository graph model
TreeModel graph = new TreeModel();
InputStream config = Rdf4jHelper.class.getResourceAsStream("/repoconf2.ttl");
RDFParser rdfParser = Rio.createParser(RDFFormat.TURTLE);
rdfParser.setRDFHandler(new StatementCollector(graph));
rdfParser.parse(config, RepositoryConfigSchema.NAMESPACE);
config.close();
// Retrieve the repository node as a resource
Resource repositoryNode = graph.filter(null, RDF.TYPE, RepositoryConfigSchema.REPOSITORY).subjects().iterator().next();
// Create a repository configuration object and add it to the repositoryManager
RepositoryConfig repositoryConfig = RepositoryConfig.create(graph, repositoryNode);
It fails on the last line.
ANSWERED #HenrietteHarmse gives the correct method in her answer below. The error is caused by missing dependencies. Instead of using RDF4J directly, I should have used the graphdb-free-runtime.
There are a number of issues here:
(1) RepositoryManager repositoryManager = new LocalRepositoryManager(new File(".")); will create a repository where ever your Java application is running from.
(2) Changing to new LocalRepositoryManager(new File("$GraphDBInstall/data/repositories")) will cause the repository to be created under the control of GraphDB (assuming you have a local GraphDB instance) only if GraphDB is not running. If you start GraphDB after running your program, you will be able to see the repository in GraphDB workbench.
(3) What you need to do is get the repository manager of the remote GraphDB, which can be done with RepositoryManager repositoryManager = RepositoryProvider.getRepositoryManager("http://IPAddressOfGraphDB:7200");.
(4) In the way you have specified the config, you cause the RDF graph config to be lost. The correct way to specify it is:
RepositoryConfig repositoryConfig = RepositoryConfig.create(graph, repositoryNode);
repositoryManager.addRepositoryConfig(repositoryConfig);
(5) A minor issue is that GraphUtil.getUniqueSubject(...) has been deprecated, for which you can use something like the following:
Model model = graph.filter(null, RDF.TYPE, RepositoryConfigSchema.REPOSITORY);
Iterator<Statement> iterator = model.iterator();
if (!iterator.hasNext())
throw new RuntimeException("Oops, no <http://www.openrdf.org/config/repository#> subject found!");
Statement statement = iterator.next();
Resource repositoryNode = statement.getSubject();
EDIT on 20180408:
(5) Or you can use the compact option as #JeenBroekstra suggested in the comments:
Models.subject(
graph.filter(null, RDF.TYPE, RepositoryConfigSchema.REPOSITORY))
.orElseThrow(() -> new RuntimeException("Oops, no <http://www.openrdf.org/config/repository#> subject found!"));
EDIT on 20180409:
For convenience I have added the complete code example here.
EDIT on 20180410:
So the actual culprit turned out to be an incorrect pom.xml. The correct version is as below:
<dependency>
<groupId>com.ontotext.graphdb</groupId>
<artifactId>graphdb-free-runtime</artifactId>
<version>8.4.1</version>
</dependency>
I believe I just had the same issue. I used the example code from GraphDB Free for running with RDF4J as a remote service and ran into the same exception as you (Unsupported Sail type: graphdb:FreeSail). Henriette Harmse's answer does not directly address this issue but one should follow the suggestions given there to avoid running into issues later. In addition, based on a look into the RDF4J code you need the following dependency in your pom.xml file (assuming GraphDB 8.5):
<dependency>
<groupId>com.ontotext.graphdb</groupId>
<artifactId>graphdb-free-runtime</artifactId>
<version>8.5.0</version>
</dependency>
This seems to be because there is some kind of service loading going on with META-INF, which I frankly am not familiar with. Maybe someone can provide more details in the comments. The requirement for adding this dependency in also seems to be absent from the instructions, so if this works for you, please let me know. Others who followed the same steps we did should be able to resolve this issue as well then.

Unused properties in IntelliJ

I am having a problem with IntelliJ inspection: It is indicating that all of my properties are unused (see the image). This is untrue, because all my properties all correctly used in spring boot project. I am using IntelliJ Community Edition 2016.1.4
If you want to ignore all warnings in a specific file. We just have to add this at the first line :
# suppress inspection "UnusedProperty" for whole file
If you just want to ignore a warning for a single property, you can add this line before the property :
# suppress inspection "UnusedProperty"
Idea -> Preferences -> search "unused" or "Inspections" -> uncheck "Unused Property " under "Properties Files"
Maybe the plugin is not supporting this feature/annotation which Intellij is then able to resolve. But you could write your own method for that.
So you have to create a method which calls the method which is not capable of creating the connection. The created method has to make us of the #PropertyKey Annotation which will allow Intellij to see the connection for your method and resolve the not used problem you have.
private static final String BUNDLE_NAME = "application";
public static void newMethod(#PropertyKey(resourceBundle = BUNDLE_NAME) String key) {
oldMethod(key) //replace oldMethod with your method
}
By calling the method foo it will detect the property connection to the property file if your resources are allocatable.
newMethod("your.awesome.key")
add library to pom.xml file problem will be solved
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.7.2</version>
</dependency>
Use final String variable to define the property's key REGION_CONFIG_KEY,
Invoke the property's key in #Value("${" + REGION_CONFIG_KEY + "}",
So the problem will be fixed