对于iphone–CoreData/Cocoa:@distinctUnionOfObjects没有返回可用的NSArray*感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍ping没有返回值,并
对于iphone – Core Data / Cocoa:@distinctUnionOfObjects没有返回可用的NSArray *感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍ping没有返回值,并为您提供关于asp.net core 3.0 JObject The collection type ''Newtonsoft.Json.Linq.JObject'' is not supported、collection element of type ''CGColorRef _Nullable'' (aka''stuct CGColor*'')is not an Objective-C object、Consider defining a bean of type ''org.springframework.data.redis.connection.RedisConnectionFa...、Could not enlist in transaction on entering meta-aware object的有用信息。
本文目录一览:- iphone – Core Data / Cocoa:@distinctUnionOfObjects没有返回可用的NSArray *(ping没有返回值)
- asp.net core 3.0 JObject The collection type ''Newtonsoft.Json.Linq.JObject'' is not supported
- collection element of type ''CGColorRef _Nullable'' (aka''stuct CGColor*'')is not an Objective-C object
- Consider defining a bean of type ''org.springframework.data.redis.connection.RedisConnectionFa...
- Could not enlist in transaction on entering meta-aware object
iphone – Core Data / Cocoa:@distinctUnionOfObjects没有返回可用的NSArray *(ping没有返回值)
鉴于父/子关系,我想做以下事情:
父母有一个孩子的集合.孩子们有一个属性,groupByProperty,我想分组.
以下代码:
NSSet *allChildren = parent.children; NSArray *groups = [allChildren valueForKeyPath:@"@distinctUnionOfObjects.groupByProperty"]; Child *child = [groups objectAtIndex:x]; //x is the row that I would like to retrieve
尝试设置子指针时产生NSinvalidargumentexception.
但是,当我这样做时:
NSSet *allChildren = parent.children; NSArray *groups = [[NSArray alloc] initWithArray:[allChildren valueForKeyPath:@"@distinctUnionOfObjects.groupByProperty"]]; Child *child = [groups objectAtIndex:x]; //x is the row that I would like to retrieve
一切正常.
谁能解释这种行为?我很想弄清楚它是如何工作的.
提前感谢您提供的任何帮助……
克里斯
解决方法
它现在看起来像这样:
NSSet *allChildren = parent.children; NSSet *groups = [allChildren valueForKeyPath:@"@distinctUnionOfObjects.groupByProperty"]; Child *child = [[groups allObjects] objectAtIndex:x]; //x is the row that I would like to retrieve
感谢您的帮助,我想我只需要更仔细地查看异常,这里的关键是“ – [NSCFSet objectAtIndex:…..”
asp.net core 3.0 JObject The collection type ''Newtonsoft.Json.Linq.JObject'' is not supported
在asp.net core 3.0 中,如果直接在Controller
中返回 Jobject
类型,会抛出如下错误:
The collection type ''Newtonsoft.Json.Linq.JObject'' is not supported.
System.NotSupportedException: The collection type ''Newtonsoft.Json.Linq.JObject'' is not supported.
at System.Text.Json.JsonPropertyInfoNotNullable`4.GetDictionaryKeyAndValueFromGenericDictionary(WriteStackFrame& writeStackFrame, String& key, Object& value)
at System.Text.Json.JsonPropertyInfo.GetDictionaryKeyAndValue(WriteStackFrame& writeStackFrame, String& key, Object& value)
at System.Text.Json.JsonSerializer.HandleDictionary(JsonClassInfo elementClassInfo, JsonSerializerOptions options, Utf8JsonWriter writer, WriteStack& state)
at System.Text.Json.JsonSerializer.Write(Utf8JsonWriter writer, Int32 originalWriterDepth, Int32 flushThreshold, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.JsonSerializer.WriteAsyncCore(Stream utf8Json, Object value, Type inputType, JsonSerializerOptions options, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
该问题的出现估计与.net 3.0 新引入的System.Text.Json
类库有关.
折衷的解决办法是:
使用Content
方法将 JObject
类型的返回值转为 ContentResult
类型.
伪代码如下:
[HttpPost]
public ContentResult Method1([FromBody]Param param1)
{
JObject result=xxx;
return Content(result.ToString());
}
如果有时间,建议跟一下System.Text.Json
类库的源码来彻底解决该问题.
collection element of type ''CGColorRef _Nullable'' (aka''stuct CGColor*'')is not an Objective-C object
类型转换为ID解决问题: “Collection element of type ''CGColorRef'' (aka ''struct CGColor *'') is not an Objective-C object”
编译器理解Objective-C方法返回的核心基础类型遵循历史可命名约定(见-高级内存管理编程指南)。例如,编译器知道,在iOS的cgcolor返回用UIColor的cgcolor方法不拥有。您必须仍然使用一个合适的类型转换,
1down voteaccepted |
It is documented in the "Transitioning to ARC Release Notes":
|
参考:http://stackoverflow.com/questions/21933209/why-type-cast-to-id-will-get-rid-of-this-error-message-collection-element-of-ty
Consider defining a bean of type ''org.springframework.data.redis.connection.RedisConnectionFa...
Description:
Parameter 0 of method redisTemplate in com.liaojie.cloud.auth.server.config.redis.RedisConfiguration required a bean of type
''org.springframework.data.redis.connection.RedisConnectionFactory'' that could not be found.
Action:
Consider defining a bean of type ''org.springframework.data.redis.connection.RedisConnectionFactory'' in your configuration.
解决方案:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
Could not enlist in transaction on entering meta-aware object
不知道大家有没有遇到过类似的问题,hibernete没法open connection
Caused by: javax.ejb.EJBException: Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:838) at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:781) at org.jboss.as.jpa.container.AbstractEntityManager.find(AbstractEntityManager.java:193)
一般来说,造成Could not open connection有如下原因:
- 到database的链接当真有问题,这时,你可以往下追述log一般能看到和socket相关的exception
- 在链接访问database之前抛出了其他异常
这里我的问题是:
Caused by: java.sql.sqlException: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@3459752a[state=norMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@33c3112d connection handles=0 lastUse=1464930224060 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@13869fdc pool internal context=SemaphoreArrayListManagedConnectionPool@5a8c3626[pool=aswuDS] xaResource=LocalXAResourceImpl@1da914c[connectionListener=3459752a connectionManager=33ae043f warned=false currentXid=null productName=Postgresql productVersion=9.3.3 jndiName=java:/jdbc/aswuDS] txSync=null] at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:151) at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70) at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:301) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214) ... 210 more Caused by: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@3459752a[state=norMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@33c3112d connection handles=0 lastUse=1464930224060 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@13869fdc pool internal context=SemaphoreArrayListManagedConnectionPool@5a8c3626[pool=aswuDS] xaResource=LocalXAResourceImpl@1da914c[connectionListener=3459752a connectionManager=33ae043f warned=false currentXid=null productName=Postgresql productVersion=9.3.3 jndiName=java:/jdbc/aswuDS] txSync=null] at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:650) at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:513) at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:143) ... 213 more Caused by: javax.resource.ResourceException: IJ000461: Could not enlist in transaction on entering Meta-aware object at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:490) at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:645) ... 215 more Caused by: javax.transaction.SystemException: IJ000356: Failed to enlist: java.lang.Throwable: Unabled to enlist resource,see the prevIoUs warnings. tx=TransactionImple < ac,BasicAction: 0:ffff0a8d2f03:7ccc2cac:57510d3d:4ea status: ActionStatus.ABORT_ONLY > at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener$TransactionSynchronization.checkEnlisted(TxConnectionListener.java:669) at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.enlist(TxConnectionListener.java:368) at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:483) ... 216 more
解决方案是:
在JBoss的configure file里面(standalone.xml或host.xml)的system properties加入下面这条:
<property name="com.arjuna.ats.arjuna.allowMultipleLastResources" value="true"/>
今天关于iphone – Core Data / Cocoa:@distinctUnionOfObjects没有返回可用的NSArray *和ping没有返回值的介绍到此结束,谢谢您的阅读,有关asp.net core 3.0 JObject The collection type ''Newtonsoft.Json.Linq.JObject'' is not supported、collection element of type ''CGColorRef _Nullable'' (aka''stuct CGColor*'')is not an Objective-C object、Consider defining a bean of type ''org.springframework.data.redis.connection.RedisConnectionFa...、Could not enlist in transaction on entering meta-aware object等更多相关知识的信息可以在本站进行查询。
本文标签: