I have been debugging for many, many hours but I can't understand why the code is not working.
Two service classes, annotated in the same way, show a different interceptor behaviour.
Stack trace #1:
Daemon Thread [http-thread-pool-8080(1)] (Suspended (breakpoint at line 120 in UserService))
UserService.saveUserOnLogin(UserBE) line: 120
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 601
EJBSecurityManager.runMethod(Method, Object, Object[]) line: 1052
EJBSecurityManager.invoke(Method, boolean, Object, Object[]) line: 1124
StatelessSessionContainer(BaseContainer).invokeBeanMethod(EjbInvocation) line: 5388
EjbInvocation.invokeBeanMethod() line: 619
AroundInvokeChainImpl.invokeNext(int, InterceptorManager$AroundInvokeContext) line: 800
EjbInvocation.proceed() line: 571
_GuiceInterceptor_Serializable(GuiceInterceptor).injectByGuice(InvocationContext) line: 24
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 601
AroundInvokeInterceptor.intercept(InterceptorManager$AroundInvokeContext) line: 861
AroundInvokeChainImpl.invokeNext(int, InterceptorManager$AroundInvokeContext) line: 800
EjbInvocation.proceed() line: 571
_SystemInterceptorProxy_Serializable(SystemInterceptorProxy).doAround(InvocationContext, Method) line: 162
_SystemInterceptorProxy_Serializable(SystemInterceptorProxy).aroundInvoke(InvocationContext) line: 144
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 601
AroundInvokeInterceptor.intercept(InterceptorManager$AroundInvokeContext) line: 861
AroundInvokeChainImpl.invokeNext(int, InterceptorManager$AroundInvokeContext) line: 800
InterceptorManager.intercept(InterceptorManager$InterceptorChain, InterceptorManager$AroundInvokeContext) line: 370
StatelessSessionContainer(BaseContainer).__intercept(EjbInvocation) line: 5360
StatelessSessionContainer(BaseContainer).intercept(EjbInvocation) line: 5348
EJBLocalObjectInvocationHandler.invoke(Class, Method, Object[]) line: 214
EJBLocalObjectInvocationHandlerDelegate.invoke(Object, Method, Object[]) line: 88
$Proxy209.saveUserOnLogin(UserBE) line: not available
__EJB31_Generated__UserService__Intf____Bean__.saveUserOnLogin(UserBE) line: not available
LoginUserHandler.saveUser(UserDTO) line: 165
LoginUserHandler.loginUser(UserDTO) line: 123
LoginUserHandler.loginWithOAuth(String, String, String, String) line: 158
LoginUserHandler.execute(LoginUser, ExecutionContext) line: 103
LoginUserHandler.execute(Action, ExecutionContext) line: 1
GuiceDispatch(AbstractDispatch).doExecute(A, ExecutionContext) line: 81
GuiceDispatch(AbstractDispatch).execute(A) line: 68
HupaDispatchServlet(AbstractSecureDispatchServlet).execute(String, Action<?>) line: 29
HupaDispatchServlet.execute(String, Action<?>) line: 56
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 601
RPC.invokeAndEncodeResponse(Object, Method, Object[], SerializationPolicy, int) line: 569
HupaDispatchServlet(RemoteServiceServlet).processCall(String) line: 208
HupaDispatchServlet(RemoteServiceServlet).processPost(HttpServletRequest, HttpServletResponse) line: 248
HupaDispatchServlet(AbstractRemoteServiceServlet).doPost(HttpServletRequest, HttpServletResponse) line: 62
HupaDispatchServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 688
HupaDispatchServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 770
ServletDefinition.doService(ServletRequest, ServletResponse) line: 263
ServletDefinition.service(ServletRequest, ServletResponse) line: 178
ManagedServletPipeline.service(ServletRequest, ServletResponse) line: 91
FilterChainInvocation.doFilter(ServletRequest, ServletResponse) line: 62
ManagedFilterPipeline.dispatch(ServletRequest, ServletResponse, FilterChain) line: 118
GuiceFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 113
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 217
StandardWrapperValve.invoke(Request, Response) line: 279
StandardContextValve.invoke(Request, Response) line: 175
StandardPipeline.doInvoke(Request, Response, boolean) line: 655
StandardPipeline.invoke(Request, Response) line: 595
StandardHostValve.invoke(Request, Response) line: 161
CoyoteAdapter.doService(Request, Request, Response, Response) line: 331
CoyoteAdapter.service(Request, Response) line: 231
ContainerMapper$AdapterCallable.call() line: 317
ContainerMapper.service(Request, Response) line: 195
ProcessorTask.invokeAdapter() line: 849
ProcessorTask.doProcess() line: 746
ProcessorTask.process(InputStream, OutputStream) line: 1045
DefaultProtocolFilter.execute(Context) line: 228
HttpProtocolChain(DefaultProtocolChain).executeProtocolFilter(Context, int) line: 137
HttpProtocolChain(DefaultProtocolChain).execute(Context, int) line: 104
HttpProtocolChain(DefaultProtocolChain).execute(Context) line: 90
HttpProtocolChain.execute(Context) line: 79
ProtocolChainContextTask.doCall() line: 54
ProtocolChainContextTask(SelectionKeyContextTask).call() line: 59
ProtocolChainContextTask(ContextTask).run() line: 71
FixedThreadPool$BasicWorker(AbstractThreadPool$Worker).doWork() line: 532
FixedThreadPool$BasicWorker(AbstractThreadPool$Worker).run() line: 513
HttpWorkerThread(Thread).run() line: 722
Stack trace #2
Daemon Thread [http-thread-pool-8080(2)] (Suspended (entry into method synchronizeHeaders in MessageService))
__EJB31_Generated__MessageService__Intf____Bean__(MessageService).synchronizeHeaders(String) line: 93
FetchMessagesHandler.executeInternal(FetchMessages, ExecutionContext) line: 80
FetchMessagesHandler.executeInternal(Action, ExecutionContext) line: 1
FetchMessagesHandler(AbstractSessionHandler<A,R>).executeWithRetries(A, ExecutionContext, int) line: 127
FetchMessagesHandler(AbstractSessionHandler<A,R>).execute(A, ExecutionContext) line: 97
GuiceDispatch(AbstractDispatch).doExecute(A, ExecutionContext) line: 81
GuiceDispatch(AbstractDispatch).execute(A) line: 68
HupaDispatchServlet(AbstractSecureDispatchServlet).execute(String, Action<?>) line: 29
HupaDispatchServlet.execute(String, Action<?>) line: 56
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 601
RPC.invokeAndEncodeResponse(Object, Method, Object[], SerializationPolicy, int) line: 569
HupaDispatchServlet(RemoteServiceServlet).processCall(String) line: 208
HupaDispatchServlet(RemoteServiceServlet).processPost(HttpServletRequest, HttpServletResponse) line: 248
HupaDispatchServlet(AbstractRemoteServiceServlet).doPost(HttpServletRequest, HttpServletResponse) line: 62
HupaDispatchServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 688
HupaDispatchServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 770
ServletDefinition.doService(ServletRequest, ServletResponse) line: 263
ServletDefinition.service(ServletRequest, ServletResponse) line: 178
ManagedServletPipeline.service(ServletRequest, ServletResponse) line: 91
FilterChainInvocation.doFilter(ServletRequest, ServletResponse) line: 62
ManagedFilterPipeline.dispatch(ServletRequest, ServletResponse, FilterChain) line: 118
GuiceFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 113
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 256
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 217
StandardWrapperValve.invoke(Request, Response) line: 279
StandardContextValve.invoke(Request, Response) line: 175
StandardPipeline.doInvoke(Request, Response, boolean) line: 655
StandardPipeline.invoke(Request, Response) line: 595
StandardHostValve.invoke(Request, Response) line: 161
CoyoteAdapter.doService(Request, Request, Response, Response) line: 331
CoyoteAdapter.service(Request, Response) line: 231
ContainerMapper$AdapterCallable.call() line: 317
ContainerMapper.service(Request, Response) line: 195
ProcessorTask.invokeAdapter() line: 849
ProcessorTask.doProcess() line: 746
ProcessorTask.process(InputStream, OutputStream) line: 1045
DefaultProtocolFilter.execute(Context) line: 228
HttpProtocolChain(DefaultProtocolChain).executeProtocolFilter(Context, int) line: 137
HttpProtocolChain(DefaultProtocolChain).execute(Context, int) line: 104
HttpProtocolChain(DefaultProtocolChain).execute(Context) line: 90
HttpProtocolChain.execute(Context) line: 79
ProtocolChainContextTask.doCall() line: 54
ProtocolChainContextTask(SelectionKeyContextTask).call() line: 59
ProtocolChainContextTask(ContextTask).run() line: 71
FixedThreadPool$BasicWorker(AbstractThreadPool$Worker).doWork() line: 532
FixedThreadPool$BasicWorker(AbstractThreadPool$Worker).run() line: 513
HttpWorkerThread(Thread).run() line: 722
It seems as if the interceptor is not invoked for the message service class. However, it does work for the user service class. Why could this be?
The message service class:
#Stateless
#Interceptors(GuiceInterceptor.class)
public class MessageService {
/**
* The gmail folder default.
*/
private static final String GMAIL_ALL_MAIL = "[Gmail]/All Mail";
/**
* The IMAP store cache.
*/
#Inject
private IMAPStoreCache imapStoreCache;
/**
* The EJB resolver.
*/
#Inject
private EJBResolver ejbResolver;
The user service class:
#Stateless
#Interceptors(GuiceInterceptor.class)
public class UserService {
/**
* The entity manager.
*/
#PersistenceContext(unitName = "hupa")
private EntityManager em;
/**
* The session provider.
*/
#Inject
private Provider<HttpSession> sessionProvider;
And finally the interceptor:
public class GuiceInterceptor {
#EJB
private GuiceInjectorHolder injectorHolder;
#AroundInvoke
#AroundTimeout
public Object injectByGuice(InvocationContext invocationContext) throws Exception {
Injector injector = injectorHolder.getInjector();
injector.injectMembers(invocationContext.getTarget());
return invocationContext.proceed();
}
}
Hope there are experts on this, I am frustrated ;)
The problem was that I could not use the final modifier anywhere in the class or it would not work with Guice. Not even on auxiliary helper methods.
Can you fill in details on who is invoking MessageService and how they obtained a reference to it?
My first guess is that whoever is invoking MessageService has a direct reference to the instance itself and is not invoking the bean via the container-created proxy that is obtained via either #EJB MessageService service; injection or JNDI lookup.
See this answer on the importance of using the proxy and how that differs from using the this or similar direct reference to the bean instance.
Related
I am trying to a scikit-learnpipeline on Databricks. However, I encounter the following issue:
import dill
f = open("/dbfs/HR_pipe.p", mode='wb')
dill.dump(fitted,f)
where:
fitted = main_pipeline.fit(X_train, y_train)
Below you can find the error traceback, I am actually using scikit-learn version 0.24.2 and the class of the fitted object is a sklearn pipeline.
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<command-97102145541341> in <module>
1 import dill
2 f = open("/dbfs/HR_pipe.p", mode='wb')
----> 3 dill.dump(fitted,f)
/local_disk0/.ephemeral_nfs/envs/pythonEnv-1f8e9f3e-114d-4f9b-915f-25ba440655c4/lib/python3.7/site-packages/dill/_dill.py in dump(obj, file, protocol, byref, fmode, recurse, **kwds)
334 _kwds = kwds.copy()
335 _kwds.update(dict(byref=byref, fmode=fmode, recurse=recurse))
--> 336 Pickler(file, protocol, **_kwds).dump(obj)
337 return
338
/local_disk0/.ephemeral_nfs/envs/pythonEnv-1f8e9f3e-114d-4f9b-915f-25ba440655c4/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
618 raise PicklingError(msg)
619 else:
--> 620 StockPickler.dump(self, obj)
621 return
622 dump.__doc__ = StockPickler.dump.__doc__
/usr/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/usr/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/usr/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/usr/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/local_disk0/.ephemeral_nfs/envs/pythonEnv-1f8e9f3e-114d-4f9b-915f-25ba440655c4/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
1249 # we only care about session the first pass thru
1250 pickler._first_pass = False
-> 1251 StockPickler.save_dict(pickler, obj)
1252 log.info("# D2")
1253 return
/usr/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/usr/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/usr/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/usr/lib/python3.7/pickle.py in save_list(self, obj)
817
818 self.memoize(obj)
--> 819 self._batch_appends(obj)
820
821 dispatch[list] = save_list
/usr/lib/python3.7/pickle.py in _batch_appends(self, items)
841 write(MARK)
842 for x in tmp:
--> 843 save(x)
844 write(APPENDS)
845 elif n:
/usr/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/usr/lib/python3.7/pickle.py in save_tuple(self, obj)
772 if n <= 3 and self.proto >= 2:
773 for element in obj:
--> 774 save(element)
775 # Subtle. Same as in the big comment below.
776 if id(obj) in memo:
/usr/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/usr/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
631 "args[0] from __newobj__ args has the wrong class")
632 args = args[1:]
--> 633 save(cls)
634 save(args)
635 write(NEWOBJ)
/usr/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/local_disk0/.ephemeral_nfs/envs/pythonEnv-1f8e9f3e-114d-4f9b-915f-25ba440655c4/lib/python3.7/site-packages/dill/_dill.py in save_type(pickler, obj, postproc_list)
1838 _save_with_postproc(pickler, (_create_type, (
1839 type(obj), obj.__name__, obj.__bases__, _dict
-> 1840 )), obj=obj, postproc_list=postproc_list)
1841 log.info("# %s" % _t)
1842 else:
/local_disk0/.ephemeral_nfs/envs/pythonEnv-1f8e9f3e-114d-4f9b-915f-25ba440655c4/lib/python3.7/site-packages/dill/_dill.py in _save_with_postproc(pickler, reduction, is_pickler_dill, obj, postproc_list)
1152 if source:
1153 pickler.write(pickler.get(pickler.memo[id(dest)][0]))
-> 1154 pickler._batch_setitems(iter(source.items()))
1155 else:
1156 # Updating with an empty dictionary. Same as doing nothing.
/usr/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/usr/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
/databricks/spark/python/pyspark/context.py in __getnewargs__(self)
354 # This method is called when attempting to pickle SparkContext, which is always an error:
355 raise Exception(
--> 356 "It appears that you are attempting to reference SparkContext from a broadcast "
357 "variable, action, or transformation. SparkContext can only be used on the driver, "
358 "not in code that it run on workers. For more information, see SPARK-5063."
Exception: It appears that you are attempting to reference SparkContext from a broadcast variable, action, or transformation. SparkContext can only be used on the driver, not in code that it run on workers. For more information, see SPARK-5063.
Do you happen to know how to solve such issue?
details about the questions ..........................................................................
I am trying to deploy Dask Gateway integrated with JupyterHub which is the reason I decided to give DaskHub Chart a try.
After following the instructions on https://docs.dask.org/en/latest/setup/kubernetes-helm.html#helm-install-dask-for-mulitple-users. The JH is working fine but When I try to create a new Dask cluster via the UI or through:
[from dask_gateway import GatewayCluster
cluster = GatewayCluster()][2]
I get this error:
ValueError Traceback (most recent call last)
<ipython-input-3-36809e239298> in <module>
1 from dask_gateway import GatewayCluster
----> 2 cluster = GatewayCluster()
3
/srv/conda/envs/notebook/lib/python3.7/site-packages/dask_gateway/client.py in __init__(self, address, proxy_address, public_address, auth, cluster_options, shutdown_on_close, asynchronous, loop, **kwargs)
816 shutdown_on_close=shutdown_on_close,
817 asynchronous=asynchronous,
--> 818 loop=loop,
819 )
820
/srv/conda/envs/notebook/lib/python3.7/site-packages/dask_gateway/client.py in _init_internal(self, address, proxy_address, public_address, auth, cluster_options, cluster_kwargs, shutdown_on_close, asynchronous, loop, name)
912 self.status = "starting"
913 if not self.asynchronous:
--> 914 self.gateway.sync(self._start_internal)
915
916 #property
/srv/conda/envs/notebook/lib/python3.7/site-packages/dask_gateway/client.py in sync(self, func, *args, **kwargs)
337 )
338 try:
--> 339 return future.result()
340 except BaseException:
341 future.cancel()
/srv/conda/envs/notebook/lib/python3.7/concurrent/futures/_base.py in result(self, timeout)
433 raise CancelledError()
434 elif self._state == FINISHED:
--> 435 return self.__get_result()
436 else:
437 raise TimeoutError()
/srv/conda/envs/notebook/lib/python3.7/concurrent/futures/_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
--> 384 raise self._exception
385 else:
386 return self._result
/srv/conda/envs/notebook/lib/python3.7/site-packages/dask_gateway/client.py in _start_internal(self)
926 self._start_task = asyncio.ensure_future(self._start_async())
927 try:
--> 928 await self._start_task
929 except BaseException:
930 # On exception, cleanup
/srv/conda/envs/notebook/lib/python3.7/site-packages/dask_gateway/client.py in _start_async(self)
940 self.status = "starting"
941 self.name = await self.gateway._submit(
--> 942 cluster_options=self._cluster_options, **self._cluster_kwargs
943 )
944 # Connect to cluster
/srv/conda/envs/notebook/lib/python3.7/site-packages/dask_gateway/client.py in _submit(self, cluster_options, **kwargs)
529 options = self._config_cluster_options()
530 options.update(kwargs)
--> 531 resp = await self._request("POST", url, json={"cluster_options": options})
532 data = await resp.json()
533 return data["name"]
/srv/conda/envs/notebook/lib/python3.7/site-packages/dask_gateway/client.py in _request(self, method, url, json)
407
408 if resp.status in {404, 422}:
--> 409 raise ValueError(msg)
410 elif resp.status == 409:
411 raise GatewayClusterError(msg)
ValueError: Unknown fields ['image']
Any help will be greatly appreciated.
I'm currently searching for a problem in one of our projects, which uses Xtext to generate java source code.
We use the model inferrer and Xannotation to use javax.* annotations to generate our entities.
import javax.persistence.FetchType
import javax.persistence.Id
import javax.persistence.Column
import javax.persistence.ManyToOne
package test.some.namespace {
domain DomainA {
entity for table "DOMAINA" {
#Id
#Column(name = "DAIA", unique = true)
Long id;
}
}
domain DomainB {
entity for table "DOMAINB" {
#Id
#Column(name = "DAIB", unique = true)
Long id;
#ManyToOne(fetch = FetchType::LAZY)
DomainA domainA;
}
}
domain DomainC {
entity for table "DOMAINC" {
#Id
#Column(name = "DAIC", unique = true)
Long id;
#ManyToOne(fetch = FetchType::LAZY)
DomainA domainA;
}
}
}
We search for the annotation by iterating through XAnnotationElementValuePair pair : annotation.getElementValuePairs() and return the value pair.getValue(), so far it works.
Now we try to access the FetchType with (exp as XMemberFeatureCall).feature where exp is the result of pair.getValue().
For DomainB.domainA it will return an instance of org.eclipse.xtext.common.types.impl.JvmEnumerationLiteralImplCustom.
For DomainC.domainA it will return an instance of org.eclipse.xtext.common.types.impl.JvmVoidImplCustom.
This problem only occurs when I save the document. This is the current thread stack from eclipse.
Thread [Worker-5] (Suspended (breakpoint at line 60 in CustomDSLJvmModelInferrer$2))
owns: ClusteringBuilderState (id=19135)
CustomDSLJvmModelInferrer.xtend line: 60
JvmDispatchableModelAssociator.installDerivedState(DerivedStateAwareResource, boolean) line: 66
BatchLinkableResource(DerivedStateAwareResource).installDerivedState(boolean) line: 159
DerivedStateAwareResourceDescriptionManager.internalGetResourceDescription(Resource, IDefaultResourceDescriptionStrategy) line: 53
DefaultResourceDescriptionManager$1.get() line: 60
DefaultResourceDescriptionManager$1.get() line: 1
OnChangeEvictingCache.get(Object, Resource, Provider<T>) line: 75
DerivedStateAwareResourceDescriptionManager(DefaultResourceDescriptionManager).getResourceDescription(Resource) line: 58
ClusteringBuilderState.writeNewResourceDescriptions(BuildData, IResourceDescriptions, CurrentDescriptions, IProgressMonitor) line: 366
ClusteringBuilderState.doUpdate(BuildData, ResourceDescriptionsData, IProgressMonitor) line: 121
ClusteringBuilderState(AbstractBuilderState).update(BuildData, IProgressMonitor) line: 112
XtextBuilder.doBuild(ToBeBuilt, IProgressMonitor, IXtextBuilderParticipant$BuildType) line: 194
XtextBuilder.incrementalBuild(IResourceDelta, IProgressMonitor) line: 171
XtextBuilder.build(int, Map, IProgressMonitor) line: 99
BuildManager$2.run() line: 734
SafeRunner.run(ISafeRunnable) line: 42
BuildManager.basicBuild(int, IncrementalProjectBuilder, Map<String,String>, MultiStatus, IProgressMonitor) line: 206
BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, ICommand[], MultiStatus, IProgressMonitor) line: 246
BuildManager$1.run() line: 299
SafeRunner.run(ISafeRunnable) line: 42
BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, MultiStatus, IProgressMonitor) line: 302
BuildManager.basicBuildLoop(IBuildConfiguration[], IBuildConfiguration[], int, MultiStatus, IProgressMonitor) line: 358
BuildManager.build(IBuildConfiguration[], IBuildConfiguration[], int, IProgressMonitor) line: 381
AutoBuildJob.doBuild(IProgressMonitor) line: 143
AutoBuildJob.run(IProgressMonitor) line: 241
Worker.run() line: 54
But it works fine if I just modify the document without saving. Stack from eclipse:
Thread [Worker-3] (Suspended (breakpoint at line 60 in CustomDSLJvmModelInferrer$2))
owns: DirtyStateManager (id=19093)
owns: Object (id=19094)
CustomDSLJvmModelInferrer.xtend line: 60
JvmDispatchableModelAssociator.installDerivedState(DerivedStateAwareResource, boolean) line: 66
BatchLinkableResource(DerivedStateAwareResource).installDerivedState(boolean) line: 159
DirtyStateResourceDescription$Manager.getResourceDescription(Resource) line: 65
DirtyStateEditorSupport.announceDirtyState(XtextResource) line: 467
XtextDocumentReconcileStrategy.postParse(XtextResource, IProgressMonitor) line: 160
XtextDocumentReconcileStrategy.doReconcile(IRegion) line: 146
XtextDocumentReconcileStrategy.reconcile(IRegion) line: 65
XtextReconciler.doRun(XtextResource, IProgressMonitor) line: 401
XtextReconciler.access$3(XtextReconciler, XtextResource, IProgressMonitor) line: 386
XtextReconciler$1.process(XtextResource) line: 327
XtextReconciler$1.process(Object) line: 1
XtextReconciler$1(IUnitOfWork$Void).exec(T) line: 36
XtextDocument$XtextDocumentLocker.modify(IUnitOfWork<T,XtextResource>) line: 418
XtextDocument.internalModify(IUnitOfWork<T,XtextResource>) line: 131
XtextReconciler.run(IProgressMonitor) line: 324
Worker.run() line: 54
So far I am all out of ideas. Is it a bug? Is there something i missed?
I hope you guys can help me.
Best regards
I'm just starting out using Neo4j and I'd like to use 2.0 (I have 2.0.1 community installed). I see that neo4django was only tested against neo4j 1.8.2-1.9.4, but have people gotten it working with 2.x? I installed the gremlin plugin but can't create or query through neo4django.
create:
In [8]: NeoProfile.objects.create(profile_id=1234)
[INFO] requests.packages.urllib3.connectionpool#214: Resetting dropped connection: localhost
---------------------------------------------------------------------------
StatusException Traceback (most recent call last)
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>()
----> 1 NeoProfile.objects.create(profile_id=1234)
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/manager.pyc in create(self, **kwargs)
41
42 def create(self, **kwargs):
---> 43 return self.get_query_set().create(**kwargs)
44
45 def filter(self, *args, **kwargs):
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/query.pyc in create(self, **kwargs)
1295 if 'id' in kwargs or 'pk' in kwargs:
1296 raise FieldError("Neo4j doesn't allow node ids to be assigned.")
-> 1297 return super(NodeQuerySet, self).create(**kwargs)
1298
1299 #TODO would be awesome if this were transactional
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/db/models/query.pyc in create(self, **kwargs)
375 obj = self.model(**kwargs)
376 self._for_write = True
--> 377 obj.save(force_insert=True, using=self.db)
378 return obj
379
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in save(self, using, **kwargs)
315
316 def save(self, using=DEFAULT_DB_ALIAS, **kwargs):
--> 317 return super(NodeModel, self).save(using=using, **kwargs)
318
319 #alters_data
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/db/models/base.pyc in save(self, force_insert, force_update, using)
461 if force_insert and force_update:
462 raise ValueError("Cannot force both insert and updating in model saving.")
--> 463 self.save_base(using=using, force_insert=force_insert, force_update=force_update)
464
465 save.alters_data = True
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in save_base(self, raw, cls, origin, force_insert, force_update, using, *args, **kwargs)
331
332 is_new = self.id is None
--> 333 self._save_neo4j_node(using)
334 self._save_properties(self, self.__node, is_new)
335 self._save_neo4j_relationships(self, self.__node)
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in _save_neo4j_node(self, using)
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in trans_method(func, *args, **kw)
95 #TODO this is where generalized transaction support will go,
96 #when it's ready in neo4jrestclient
---> 97 ret = func(*args, **kw)
98 #tx.commit()
99 return ret
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in _save_neo4j_node(self, using)
359 self.__node = conn.gremlin_tx(script, types=type_hier_props,
360 indexName=self.index_name(),
--> 361 typesToIndex=type_names_to_index)
362 return self.__node
363
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/neo4jclient.pyc in gremlin_tx(self, script, **params)
177 will be wrapped in a transaction.
178 """
--> 179 return self.gremlin(script, tx=True, **params)
180
181 def cypher(self, query, **params):
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/neo4jclient.pyc in gremlin(self, script, tx, raw, **params)
166 try:
167 return send_script(include_unloaded_libraries(lib_script),
--> 168 params)
169 except LibraryCouldNotLoad:
170 if i == 0:
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/neo4jclient.pyc in send_script(s, params)
151 if raw:
152 execute_kwargs['returns'] = RETURNS_RAW
--> 153 script_rv = ext.execute_script(s, params=params, **execute_kwargs)
154 if isinstance(script_rv, basestring):
155 if LIBRARY_ERROR_REGEX.match(script_rv):
/Users/atomos/workspace/Project-Vitamin/src/neo4j-rest-client/neo4jrestclient/client.py in __call__(self, *args, **kwargs)
2313 except (ValueError, AttributeError, KeyError, TypeError):
2314 pass
-> 2315 raise StatusException(response.status_code, msg)
2316
2317 def __repr__(self):
StatusException: Code [400]: Bad Request. Bad request syntax or unsupported method.
Invalid data sent: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: groovy.lang.MissingMethodException.setMaxBufferSize() is applicable for argument types: () values: []
query:
In [9]: NeoProfile.objects.filter(profile_id=1234)
Out[9]: ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>()
----> 1 NeoProfile.objects.filter(profile_id=1234)
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/core/displayhook.pyc in __call__(self, result)
236 self.start_displayhook()
237 self.write_output_prompt()
--> 238 format_dict = self.compute_format_data(result)
239 self.write_format_data(format_dict)
240 self.update_user_ns(result)
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
148 MIME type representation of the object.
149 """
--> 150 return self.shell.display_formatter.format(result)
151
152 def write_format_data(self, format_dict):
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/core/formatters.pyc in format(self, obj, include, exclude)
124 continue
125 try:
--> 126 data = formatter(obj)
127 except:
128 # FIXME: log the exception
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
445 type_pprinters=self.type_printers,
446 deferred_pprinters=self.deferred_printers)
--> 447 printer.pretty(obj)
448 printer.flush()
449 return stream.getvalue()
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/lib/pretty.pyc in pretty(self, obj)
358 if callable(meth):
359 return meth(obj, self, cycle)
--> 360 return _default_pprint(obj, self, cycle)
361 finally:
362 self.end_group()
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _default_pprint(obj, p, cycle)
478 if getattr(klass, '__repr__', None) not in _baseclass_reprs:
479 # A user-provided repr.
--> 480 p.text(repr(obj))
481 return
482 p.begin_group(1, '<')
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/db/models/query.pyc in __repr__(self)
70
71 def __repr__(self):
---> 72 data = list(self[:REPR_OUTPUT_SIZE + 1])
73 if len(data) > REPR_OUTPUT_SIZE:
74 data[-1] = "...(remaining elements truncated)..."
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/db/models/query.pyc in __len__(self)
85 self._result_cache = list(self.iterator())
86 elif self._iter:
---> 87 self._result_cache.extend(self._iter)
88 if self._prefetch_related_lookups and not self._prefetch_done:
89 self._prefetch_related_objects()
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/query.pyc in iterator(self)
1274 using = self.db
1275 if not self.query.can_filter():
-> 1276 for model in self.query.execute(using):
1277 yield model
1278 else:
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/query.pyc in execute(self, using)
1161 conn = connections[using]
1162
-> 1163 groovy, params = self.as_groovy(using)
1164
1165 raw_result_set = conn.gremlin_tx(groovy, **params) if groovy is not None else []
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/query.pyc in as_groovy(self, using)
925 # add the typeNodeId param, either for type verification or initial
926 # type tree traversal
--> 927 cypher_params['typeNodeId'] = self.model._type_node(using).id
928
929 type_restriction_expr = """
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in _type_node(cls, using)
411 return cls.__type_node_memoized(using)
412 else:
--> 413 return cls.__type_node_classmethod(using)
414
415 #classmethod
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in __type_node(cls, using)
394 script_rv = conn.gremlin_tx(script, types=type_hier_props)
395 except Exception, e:
--> 396 raise RuntimeError(error_message, e)
397 if not hasattr(script_rv, 'properties'):
398 raise RuntimeError(error_message + '\n\n%s' % script_rv)
RuntimeError: ('The type node for class NeoProfile could not be created in the database.', StatusException())
My model is incredibly complex:
class NeoProfile(neomodels.NodeModel):
profile_id = neomodels.IntegerProperty(indexed=True)
Could someone please explain to me why in the following code (using r25630 Windows), the value of iInsertTot at line 241 is null, or more to the point, why is line 234 ("return iInsertTot;") not executed and therefore at line 241, iInsertTot is null. The value of iInsertTot at lines 231/232 is an integer. While I can and probably should code this differently, I thought that I would try and see if it worked, because my understanding of Futures and Chaining was that it would work. I have used “return” in a similar way before and it worked, but I was returning null in those cases (eg. line 201 below).
/// The problem lines are :
233 fUpdateTotalsTable().then((_) {
234 return iInsertTot;
235 });
While running in the debugger, it appears that line 234 “return iInsertTot;” is never actually executed. Running from command line has the same result.
The method being called on line 233 (fUpdateTotalsTable) is something I am just in the process of adding, and it consists basically of sync code at this stage. However, the debugger appears to go through it correctly.
I have included the method “fUpdateTotalsTable()” (line 1076) just in case that is causing a problem.
Lines 236 to 245 have just been added, however just in case that code is invalid I have commented those lines out and run with the same problem occurring.
218 /*
219 * Process Inserts
220 */
221 }).then((_) {
222 sCheckpoint = "fProcessMainInserts";
223 ogPrintLine.fPrintForce ("Processing database ......");
224 int iMaxInserts = int.parse(lsInput[I_MAX_INSERTS]);
225 print ("");
226 return fProcessMainInserts(iMaxInserts, oStopwatch);
227 /*
228 * Update the 'totals' table with the value of Inserts
229 */
230 }).then((int iReturnVal) {
231 int iInsertTot = iReturnVal;
232 sCheckpoint = "fUpdateTotalsTable (insert value)";
233 fUpdateTotalsTable().then((_) {
234 return iInsertTot;
235 });
236 /*
237 * Display totals for inserts
238 */
239 }).then((int iInsertTot) {
240 ogTotals.fPrintTotals(
241 "${iInsertTot} rows inserted - Inserts completed",
242 iInsertTot, oStopwatch.elapsedMilliseconds);
243
244 return null;
245 /*
192 /*
193 * Clear main table if selected
194 */
195 }).then((tReturnVal) {
196 if (tReturnVal)
197 ogPrintLine.fPrintForce("Random Keys Cleared");
198 sCheckpoint = "Clear Table ${S_TABLE_NAME}";
199 bool tClearTable = (lsInput[I_CLEAR_YN] == "y");
200 if (!tFirstInstance)
201 return null;
202 return fClearTable(tClearTable, S_TABLE_NAME);
203
204 /*
205 * Update control row to increment count of instances started
206 */
207 }).then((_) {
1073 /*
1074 * Update totals table with values from inserts and updates
1075 */
1076 async.Future<bool> fUpdateTotalsTable() {
1077 async.Completer<bool> oCompleter = new async.Completer<bool>();
1078
1079 String sCcyValue = ogCcy.fCcyIntToString(ogTotals.iTotAmt);
1080
1081 print ("\n********* Total = ${sCcyValue} \n");
1082
1083 oCompleter.complete(true);
1084 return oCompleter.future;
1085 }
Your function L230-235 does not return anything and that's why your iInsertTot is null L239. To make it work you have to add a return at line 233.
231 int iInsertTot = iReturnVal;
232 sCheckpoint = "fUpdateTotalsTable (insert value)";
233 return fUpdateTotalsTable().then((_) {
234 return iInsertTot;
235 });