I would like to get size of youtube video without downloading in scrapy or python - youtube

I would like to get size of youtube video without downloading, ist it possible for below link?
https://youtu.be/hkuUVjlBOVs

You can get the file size without downloading a YT video with pytube.
from pytube import YouTube
yt = YouTube('https://youtu.be/hkuUVjlBOVs')
print(yt.streams.get_highest_resolution().filesize)
Output file size in bytes:
4410471
Return all available resolutions:
for i in yt.streams:
print(i)
Output:
<Stream: itag="17" mime_type="video/3gpp" res="144p" fps="6fps" vcodec="mp4v.20.3" acodec="mp4a.40.2" progressive="True" type="video">
<Stream: itag="18" mime_type="video/mp4" res="360p" fps="25fps" vcodec="avc1.42001E" acodec="mp4a.40.2" progressive="True" type="video">
<Stream: itag="134" mime_type="video/mp4" res="360p" fps="25fps" vcodec="avc1.4d4015" progressive="False" type="video">
<Stream: itag="243" mime_type="video/webm" res="360p" fps="25fps" vcodec="vp9" progressive="False" type="video">
<Stream: itag="396" mime_type="video/mp4" res="360p" fps="25fps" vcodec="av01.0.01M.08" progressive="False" type="video">
<Stream: itag="133" mime_type="video/mp4" res="240p" fps="25fps" vcodec="avc1.4d400d" progressive="False" type="video">
<Stream: itag="242" mime_type="video/webm" res="240p" fps="25fps" vcodec="vp9" progressive="False" type="video">
<Stream: itag="395" mime_type="video/mp4" res="240p" fps="25fps" vcodec="av01.0.00M.08" progressive="False" type="video">
<Stream: itag="160" mime_type="video/mp4" res="144p" fps="25fps" vcodec="avc1.4d400b" progressive="False" type="video">
<Stream: itag="278" mime_type="video/webm" res="144p" fps="25fps" vcodec="vp9" progressive="False" type="video">
<Stream: itag="394" mime_type="video/mp4" res="144p" fps="25fps" vcodec="av01.0.00M.08" progressive="False" type="video">
<Stream: itag="139" mime_type="audio/mp4" abr="48kbps" acodec="mp4a.40.5" progressive="False" type="audio">
<Stream: itag="140" mime_type="audio/mp4" abr="128kbps" acodec="mp4a.40.2" progressive="False" type="audio">
<Stream: itag="249" mime_type="audio/webm" abr="50kbps" acodec="opus" progressive="False" type="audio">
<Stream: itag="250" mime_type="audio/webm" abr="70kbps" acodec="opus" progressive="False" type="audio">
<Stream: itag="251" mime_type="audio/webm" abr="160kbps" acodec="opus" progressive="False" type="audio">

Related

how to solve: symbol(s) not found for architecture in macOS bundle

Im writing simple wrapper for loading leaderboards from game center and it's working like a charm on iOS, but while i build my app on macOS i'm getting this error:
"_gameCenter_loadLeaderboard", referenced from:
_LeaderboardWrapper_gameCenter_loadLeaderboard_m1E818D39D7E09691764495F877AE9D990EC4D432 in F9507B415CD33260EA533B953F7CF7A8.o
(maybe you meant: _LeaderboardWrapper_gameCenter_loadLeaderboard_m1E818D39D7E09691764495F877AE9D990EC4D432)
"_gameCenter_setLoadLeaderboardCallbackHandler", referenced from:
_LeaderboardWrapper_gameCenter_setLoadLeaderboardCallbackHandler_m622CA920AA696EFA52E1BA9706D4A1087FA4F1FF in F9507B415CD33260EA533B953F7CF7A8.o
(maybe you meant: _LeaderboardWrapper_gameCenter_setLoadLeaderboardCallbackHandler_m622CA920AA696EFA52E1BA9706D4A1087FA4F1FF)
ld: symbol(s) not found for architecture x86_64
Undefined symbols for architecture arm64:
"_gameCenter_loadLeaderboard", referenced from:
_LeaderboardWrapper_gameCenter_loadLeaderboard_m1E818D39D7E09691764495F877AE9D990EC4D432 in E59781FE06F50F58456801B2C8EBD151.o
(maybe you meant: _LeaderboardWrapper_gameCenter_loadLeaderboard_m1E818D39D7E09691764495F877AE9D990EC4D432)
"_gameCenter_setLoadLeaderboardCallbackHandler", referenced from:
_LeaderboardWrapper_gameCenter_setLoadLeaderboardCallbackHandler_m622CA920AA696EFA52E1BA9706D4A1087FA4F1FF in E59781FE06F50F58456801B2C8EBD151.o
(maybe you meant: _LeaderboardWrapper_gameCenter_setLoadLeaderboardCallbackHandler_m622CA920AA696EFA52E1BA9706D4A1087FA4F1FF)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
my LeaderboardWrapper.h looks like:
void gameCenter_setLoadLeaderboardCallbackHandler(GameCenter_LoadLeaderboardCallback handler);
void gameCenter_loadLeaderboard(const char* leaderboardId);
enum GameCenterLoadLeaderboardError
{
GCLoadLeaderboard_NoError = 0,
GCLoadLeaderboard_CallbackHandlerNotSet,
GCLoadLeaderboard_ServiceError,
GCLoadLeaderboard_LeaderboardNotFound
};
and LeaderboardWrapper.m:
#import "LeaderboardWrapper.h"
#import <GameKit/GameKit.h>
#import <Foundation/Foundation.h>
#ifdef __cplusplus
extern "C" {
#endif
GameCenter_LoadLeaderboardCallback _gameCenterLoadLeaderboardCallbackHandler = NULL;
void gameCenter_setLoadLeaderboardCallbackHandler(GameCenter_LoadLeaderboardCallback handler)
{
_gameCenterLoadLeaderboardCallbackHandler = handler;
}
void gameCenter_loadLeaderboard(const char* leaderboardId)
{
if(_gameCenterLoadLeaderboardCallbackHandler == NULL)
{
NSMutableDictionary* result = [NSMutableDictionary dictionary];
result[#"LeaderboardId"] = [NSString stringWithUTF8String:leaderboardId];
result[#"Sucess"] = [NSNumber numberWithBool:false];
result[#"Error"] = [NSNumber numberWithInt:GCLoadLeaderboard_CallbackHandlerNotSet];
_gameCenterLoadLeaderboardCallbackHandler([makeResultString(result) UTF8String]);
return;
}
}
#ifdef __cplusplus
}
#endif
Can anyone tell me what im doing wrong?

Get all "someValuesFrom" of an object property class with Jena

I want to get all the values of "someValuesFrom" of each Object Property as a list.
I have this part of an owl file:
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#ErgativeFrame">
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#hasAgent"/>
<owl:someValuesFrom>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Animal"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Object"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Person"/>
</owl:unionOf>
</owl:Class>
</owl:someValuesFrom>
</owl:Restriction>
</owl:equivalentClass>
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#hasMainAction"/>
<owl:someValuesFrom rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#ErgativeVerb"/>
</owl:Restriction>
</owl:equivalentClass>
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#hasOptionalPatient"/>
<owl:someValuesFrom>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Animal"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Beverage"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#BodyPart"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#ClosedLocation"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Clothing"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Food"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Furniture"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#NatureElement"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#NaturePhenomenon"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#OpenLocation"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Person"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Toy"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Transport"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Vegetal"/>
</owl:unionOf>
</owl:Class>
</owl:someValuesFrom>
</owl:Restriction>
</owl:equivalentClass>
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Frame"/>
</owl:Class>
I've tried something like this:
OntClass ontClass = this.ontModel.getOntClass(NS_OWL + "ErgativeFrame");
List<OntClass> list = ontClass.listEquivalentClasses().toList();
for (OntClass equiv: list) {
if (equiv.isRestriction()) {
System.out.println("is restriction");
System.out.println(equiv.getLocalName());
}
}
The quantity of "is restriction" printed on the screen is equal to the length of properties, but getLocalName is always "null".
What do I have to do?
EDIT: I've got the name of property correctly doing some changes in the code (see below).
Now I still can't get the "someValueFrom".
OntClass ontClass = this.ontModel.getOntClass(NS_OWL + "ErgativeFrame");
List<OntClass> list = ontClass.listEquivalentClasses().toList();
for (OntClass equiv: list) {
if (equiv.isRestriction()) {
System.out.println("is restriction");
System.out.println(equiv.asRestriction().getOnProperty().getLocalName());
}
}
The reason why getLocalName is returning null is because you are using anonymous classes and properties, i.e. classes and properties without assigned URIs. Since Jena cannot find the URI, it returns null.
To illustrate, here is a subset of your ontology with named classes and properties rather than anonymous classes and properties:
<rdf:Description rdf:about="http://www.w3.org/2002/07/owl#topObjectProperty">
<rdfs:range rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#AnimalObjectPerson"/>
</rdf:Description>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Frame"/>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Object"/>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Person"/>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Animal"/>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#AnimalObjectPerson">
<owl:equivalentClass>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Animal"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Object"/>
<rdf:Description rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Person"/>
</owl:unionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
<owl:Class rdf:about="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#ErgativeFrame">
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#hasAgent"/>
<owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
</owl:Restriction>
</owl:equivalentClass>
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/gumaro/ontologies/2017/11/untitled-ontology-26#Frame"/>
</owl:Class>
and here is the code for retrieving the range of the property:
OntClass ontClass = ontModel.getOntClass(NS_OWL + "ErgativeFrame");
List<OntClass> list = ontClass.listEquivalentClasses().toList();
for (OntClass equiv: list) {
if (equiv.isRestriction()) {
OntProperty ontProperty = equiv.asRestriction().getOnProperty();
OntResource range = ontProperty.getRange();
List<OntClass> rangeList = range.asClass().listEquivalentClasses().toList();
for (OntClass rangeEquiv: rangeList) {;
for (OntClass rangeUnionClass: rangeEquiv.asUnionClass().listOperands().toList()) {
System.out.println("classes in union = " + rangeUnionClass);
}
}
}
}
I hope that helps.
In the provided snippet there is ambiguous situation: the restriction ...#hasMainAction + ...#ErgativeVerb could be either Data or Object Property Existential Quantification Restriction (for more about this see owl2 guide).
There are no explicit declarations in the snippet to judge what it is exaclty.
All Restrictions are anonymous resources (class expressions) - that's why they have no uri and local name therefore.
Jena-API (the package org.apache.jena.ontology) is only for outdated OWL-1, not OWL-2.
But there is a jena-based analogue of org.apache.jena.ontology.OntModel - special for OWL-2: com.github.owlcs.ontapi.jena.model.OntModel.
Although it is not directly related to the original question, it might be more useful in this case.
Here is an example:
String fullOwlAsString = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<rdf:RDF xmlns=\"http://www.semanticweb.org/owlapi/test#\"\n" +
" xml:base=\"http://www.semanticweb.org/owlapi/test\"\n" +
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\"\n" +
" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\n" +
" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" +
" xmlns:owl=\"http://www.w3.org/2002/07/owl#\">" +
"<owl:Ontology rdf:about=\"#\" />" + yourSnippet + "</rdf:RDF>";
InputStream in = new ByteArrayInputStream(fullOwlAsString.getBytes(StandardCharsets.UTF_8));
OntModel ont = OntManagers.createONT().loadOntologyFromOntologyDocument(in).asGraphModel();
ont.ontObjects(OntClass.ObjectSomeValuesFrom.class).map(x -> x.getValue())
.filter(x -> x.canAs(OntClass.ComponentsCE.class))
.map(x -> (OntClass.ComponentsCE<? extends OntObject>)x.as(OntClass.ComponentsCE.class))
.flatMap(x -> x.getList().members())
.filter(RDFNode::isResource).map(RDFNode::asResource).map(Resource::getLocalName)
.forEach(System.out::println);
And the output:
Animal
Beverage
BodyPart
ClosedLocation
Clothing
Food
Furniture
NatureElement
NaturePhenomenon
OpenLocation
Person
Toy
Transport
Vegetal
Animal
Object
Person

Weighted Blend in GEGL library

Can someone post a code example on how to use the "gegl:weighted-blend" operations in c Code not gegl (terminal) with xml files (filters) .
I started using gegl library, it fit my needs perfectly, but I can't seem to find a good documentation (the website is good but not detailed).
Is there a forum or a place where you can ask for help in programming with the gegl library?
If it helps here is my trial of using gegl:weighted-blend :
GeglNode *gegl = gegl_node_new ();
GeglNode *display = gegl_node_create_child (gegl, "gegl:display");
GeglNode *over = gegl_node_new_child (gegl,"operation", "gegl:over",NULL);
GeglNode *c2g = gegl_node_new_child (gegl,"operation", "gegl:c2g",NULL);
GeglNode *blur = gegl_node_new_child (gegl,"operation", "gegl:gaussian-blur","std- dev-x",1.0,"std-dev-y",1.0,NULL);
GeglNode *img = gegl_node_new_child (gegl,"operation", "gegl:load","path","test.jpg",NULL);
GeglBuffer *buffer = NULL;
GeglNode *sink = gegl_node_new_child (gegl,"operation", "gegl:buffer-sink","buffer", &buffer,NULL);
gegl_node_link_many (img , c2g , sink, NULL);
gegl_node_process (sink);
GeglNode *blend = gegl_node_new_child (gegl,"operation", "gegl:weighted-blend","aux",buffer,"value",0.0,NULL);
gegl_node_link_many(img, blend, display, NULL);
//gegl_node_process (blend);
//gegl_node_link_many(blend, display, NULL);
gegl_node_process (display);
A bit info, in this example I have a test.jpg image. I applied a c2g filter on it, then I tried to blend it with itself without the c2g filter.
The c2g and gegl:buffer-sink parts work, meaning I can display the image with grayscale and the buffer is filled with the image in grayscale colors.
What am I doing wrong? Because the output of this with the combination of gegl:weighted-blend is a blank screen .
There are a few small issues with your code right now.
You're connecting to the "aux" pad of the weighted-blend operation incorrectly. The correct way to connect the c2g output to the weighted-blend input is gegl_node_connect_to (c2g, "output", blend, "aux");. Right now you're trying to set it as a property of the weighted-blend node, but input pads (images) and properties are different concepts in gegl.
The weighted-blend node does not have a value property, and using it might be tricky in this case, if you need to adjust the amount of blending. A better way to construct the graph would be to apply gegl:opacity to set the transparency of the top image and then use svg:src-over to blend them together (which is roughly what the layer stack in gimp does).
So, fixing your example might look like this:
GeglNode *gegl = gegl_node_new ();
GeglNode *img = gegl_node_new_child (gegl,
"operation", "gegl:load",
"path", "test.jpg",
NULL);
GeglNode *save = gegl_node_new_child (gegl,
"operation", "gegl:save",
"path","result.jpg",
NULL);
GeglNode *over = gegl_node_new_child (gegl,
"operation", "gegl:over",
NULL);
GeglNode *c2g = gegl_node_new_child (gegl,
"operation", "gegl:c2g",
NULL);
GeglNode *opacity = gegl_node_new_child (gegl,
"operation", "gegl:opacity",
"value", 0.4, NULL);
GeglNode *blend = gegl_node_new_child (gegl,
"operation", "svg:src-over",
NULL);
gegl_node_link_many (img, c2g, opacity, NULL);
gegl_node_connect_to (opacity, "output", blend, "aux");
gegl_node_link_many (img, blend, save, NULL);
gegl_node_process (save);

DBus: returning a file descriptor

I want to implement a DBus service that returns a file descriptor, but this error is raised:
** (process:3419): WARNING **: Cannot marshal type "(null)" in variant
** (process:3419): CRITICAL **: unable to append OUT arg of type GValue for create_connection: ((GValue*) 0x647730)
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6fcd5b9 in g_type_check_value ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
The interface I have implemented looks like this:
<node name="/org/designfu/IceService">
<interface name="org.designfu.IceService">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="ice_service"/>
<method name="create_connection">
<!-- This is optional, and in this case is redunundant -->
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="ice_service_create_connection"/>
<arg type="b" name="controlling_mode" direction="in" />
<arg type="b" name="upnp" direction="in" />
<arg type="s" name="dbus_path" direction="out" />
<arg type="s" name="username_fragment" direction="out" />
<arg type="s" name="password" direction="out" />
<arg type="v(h)" name="send_fd" direction="out" />
<arg type="v(h)" name="recv_fd" direction="out" />
</method>
</interface>
</node>
and this is my implementation:
gboolean ice_service_create_connection(IceService *obj,
const gboolean controlling_mode,
const gboolean upnp,
char **dbus_conn_path,
char **username_fragment,
char **password,
GVariant **send_fd,
GVariant **recv_fd,
GError **error)
{
IceConnection *conn;
gboolean res;
conn = g_object_new(ICE_CONNECTION_TYPE,
"controlling-mode", controlling_mode,
"upnp", upnp,
NULL);
/* register dbus path */
char uuid_str[] = "123";
char dbus_path[512];
g_snprintf(dbus_path, 512, "/org/designfu/IceService/object/%s", uuid_str, NULL);
dbus_g_connection_register_g_object(bus, dbus_path, G_OBJECT(conn));
/* set output parameters */
*dbus_conn_path = g_strdup(dbus_path);
res = ice_connection_get_local_credentials(conn, username_fragment, password);
g_assert(res);
*send_fd = g_variant_new("(h)", conn->their_sock[SEND]);
*recv_fd = g_variant_new("(h)", conn->their_sock[RECV]);
g_assert(*send_fd);
g_assert(*recv_fd);
return TRUE;
}
If I leave out the send_fd and recv_fd output parameters, the functions works like a charm.
However, somehow I have an error in passing the file descriptors to the dbus.
The descriptors were created using
int domain = AF_LOCAL;
int type = SOCK_STREAM;
int protocol = 0;
err = socketpair(domain, type, protocol, sock);
Does anyone have a clue what's wrong here?
v(h) doesn't look like a valid DBus type signature, are you sure you don't mean (h)?

Primefaces google map - null pointer exception after dragging marker

I am using primefaces (JSF) to intergrate google maps in my web application.
However, after following the tutorial on http://www.primefaces.org/showcase/ui/gmapDraggableMarkers.jsf I am encountering a Null Pointer Exception from the primefaces renderer as follows
20:48:45,741 INFO [javax.enterprise.resource.webcontainer.jsf.context] java.lang.NullPointerException: java.lang.NullPointerException
at org.primefaces.component.gmap.GMapRenderer.decode(GMapRenderer.java:62) [:]
at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:787) [:2.1.1-FCS]
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1181) [:2.1.1-FCS]
at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:506) [:2.1.1-FCS]
at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183) [:2.1.1-FCS]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1589) [:2.1.1-FCS]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) [:2.1.1-FCS]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) [:2.1.1-FCS]
at javax.faces.component.UIForm.visitTree(UIForm.java:344) [:2.1.1-FCS]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) [:2.1.1-FCS]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) [:2.1.1-FCS]
at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:376) [:2.1.1-FCS]
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:252) [:2.1.1-FCS]
at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183) [:2.1.1-FCS]
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931) [:2.1.1-FCS]
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) [:2.1.1-FCS]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [:2.1.1-FCS]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [:2.1.1-FCS]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:409) [:2.1.1-FCS]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at com.abc.filters.CityAdminProtFilter.doFilter(AbcProtFilter.java:58) [:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]
Do you have any indication where this is coming from? What I noticed is that the markerDragListener is not being called and the exception happens before it is called.
The following is the code I am using for rendering the map, etc. :
<p:gmap id="gmap" center="41.381542, 2.122893" zoom="10" type="HYBRID" style="width:380px;height:350px"
model="#{attractionsBean.mapModel}"
markerDragListener="#{attractionsBean.onMarkerDrag}"/>
and
public void onMarkerDrag(MarkerDragEvent event) {
Marker marker = event.getMarker();
if (mapModel.getMarkers().size() > 0) {
mapModel.getMarkers().get(0).setLatlng(marker.getLatlng());
System.out.println("Updated marker location: " + "Lat:" + marker.getLatlng().getLat() + ", Lng:" + marker.getLatlng().getLng());
}
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Marker Dragged", "Lat:" + marker.getLatlng().getLat() + ", Lng:" + marker.getLatlng().getLng()));
}
Thanks in advance!!
else if(params.containsKey(clientId + "_markerDragged")) {
String id = params.get(clientId + "_markerId");
Marker marker = (Marker) model.findOverlay(id);
double lat = Double.valueOf(params.get(clientId + "_lat"));
double lng = Double.valueOf(params.get(clientId + "_lng"));
marker.setLatlng(new LatLng(lat, lng));
map.queueEvent(new MarkerDragEvent(map, marker));
}
The marker object is null, this happened to me because I was overriding the restoreState method of the component and changing the state

Resources