vwjugow

chat picketlink

May 26th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.43 KB | None | 0 0
  1. (11:57:07) xybrek: hi anyone around here?
  2. (11:57:07) pedroigor: this APP is about using a signed token to authenticate user between different request
  3. (11:57:22) pedroigor: xybrek: yes :)
  4. (11:57:26) xybrek: what is this error mea "IdentityObject] does not have any mapping"
  5. (11:57:59) pedroigor: you probably did not provide a JPA entity that maps a specific IdentityType
  6. (11:59:06) pedroigor: check your persistence.xml or the code you have to build the IdentityConfiguration
  7. (11:59:23) vwjuicew: pedroigor: Hi, sorry to bother you, could you take a look at https://community.jboss.org/thread/241382.
  8. (12:00:28) pedroigor: vwjuicew: that is easy, I think :)
  9. (12:00:43) pedroigor: vwjuicew: you just copied the entities from the simple schema, right ?
  10. (12:00:47) xybrek: pedroigor: yes, we have JPA entities
  11. (12:01:44) pedroigor: xybrek: take a look at the persistence.xml and your IDM configuration code (if you're building the IdentityConfiguration manually).
  12. (12:01:49) xybrek: pedroigor: do we need this: IdentityConfigurationBuilder ?
  13. (12:02:17) vwjuicew: pedroigor: mm xybrek can tell where he copied them from specifically, but yes we copied them from some example.
  14. (12:02:52) pedroigor: only if you need to provide some custom configuration. By default, if your application provides PL annotated entities and a @PicketLink producer for the EntityManager, JPA is automatically configured.
  15. (12:02:59) pedroigor: ok
  16. (12:03:04) pedroigor: so here is ..
  17. (12:03:11) pedroigor: let me give you an example ..
  18. (12:03:53) pedroigor: https://github.com/pedroigor/picketlink-quickstarts/blob/token-based-credential/picketlink-angularjs-rest/src/main/java/com/gr/project/security/model/entity/MyUserTypeEntity.java#L38
  19. (12:04:03) pedroigor: look at the @IdentityManaged annotation
  20. (12:04:49) pedroigor: accordingly with the docs, this annotation is important to tell PL which IdentityType type is related with an entity.
  21. (12:05:04) pedroigor: if you just copied from simple scheme, you probably have the User/Role types defined there.
  22. (12:05:17) pedroigor: but you need to change to reflect your custom types, instead.
  23. (12:05:28) xybrek: pedroigor: yup we have @IdentityManaged (IdentityType.class)
  24. (12:05:28) xybrek: @Entity
  25. (12:05:29) xybrek: @Inheritance(strategy = InheritanceType.JOINED)
  26. (12:05:29) xybrek: public class IdentityTypeEntity extends AttributedTypeEntity { ... }
  27. (12:05:47) pedroigor: this one is a base entity class ...
  28. (12:05:52) pedroigor: look at the AccountTypeEntity
  29. (12:06:12) pedroigor: you should define your custo type there using the annotation above
  30. (12:06:32) xybrek: pedroigor: yup we also have:
  31. (12:06:32) xybrek: @IdentityManaged ({User.class, Agent.class})
  32. (12:06:32) xybrek: @Entity
  33. (12:06:32) xybrek: public class AccountTypeEntity extends IdentityTypeEntity { ... }
  34. (12:06:42) pedroigor: exactly
  35. (12:06:59) iandow [[email protected]] entered the room.
  36. (12:07:10) xybrek: pedroigor: ?
  37. (12:07:20) pedroigor: see ... you are still mapping User and Agent.
  38. (12:07:32) pedroigor: can you try changing to your custom type ?
  39. (12:08:31) pedroigor: you can even take a look at the following application:
  40. (12:09:02) xybrek: pedroigor: you mean the one we use for authenticating, like we have: public class UserImpl extends org.picketlink.idm.model.basic.User ?
  41. (12:09:09) pedroigor: yes
  42. (12:09:20) xybrek: pedroigor: I would put, @IdentityManaged ({UserImpl.class, Agent.class}) ?
  43. (12:09:30) pedroigor: you can remove Agent if you don't use it ..
  44. (12:09:41) xybrek: Ok great let me try that
  45. (12:09:45) matzew left the room (quit: Quit: Textual IRC Client: www.textualapp.com).
  46. (12:10:15) iandow left the room (quit: Remote host closed the connection).
  47. (12:11:29) pedroigor: xybrek: vwjuicew: we have an user contributing with this quickstart. we hope to get this soon in our repository:
  48. (12:11:31) pedroigor: https://github.com/filipeferraz/picketlink-authorization-idm-jpa-custom
  49. (12:11:41) pedroigor: it is a great example about how to provide custom types, even relationships.
  50. (12:12:17) vwjuicew: ok thanks Ill take a look at that one too
  51. (12:12:28) xybrek: cool!
  52. (12:12:29) jcacek left the room (quit: Quit: Ex-Chat).
  53. (12:12:50) jcacek [jcacek@nat/redhat/x-uyfjmzwexwwvgqsp] entered the room.
  54. (12:13:28) jcacek left the room (quit: Client Quit).
  55. (12:13:42) iandow [[email protected]] entered the room.
  56. (12:13:47) jcacek [jcacek@nat/redhat/x-pdksyemiqeutxtro] entered the room.
  57. (12:16:35) pedroigor: xybrek: i hope this can help.
  58. (12:20:12) xybrek: pedroigor: now im getting Error while creating IdentityStore [class org.picketlink.idm.jpa.internal.JPAIdentityStore] instance for configuration [org.picketlink.idm.config.JPAIdentityStoreConfiguration
  59. (12:20:22) xybrek: Entity [class org.picketlink.idm.jpa.schema.RelationshipIdentityObject] does not have any mapping.
  60. (12:23:44) pedroigor: xybrek: did you change the RelationshipIdentityObject to reflect your entity type ?
  61. (12:25:41) xybrek: pedroigor: we only have
  62. (12:25:41) xybrek: @Entity
  63. (12:25:41) xybrek: public class RelationshipIdentityTypeEntity implements Serializable {}
  64. (12:27:14) gSharma is now known as gSharma_dinner
  65. (12:27:50) pedroigor: do you have this fields on that entity ?
  66. (12:27:52) pedroigor: @RelationshipDescriptor
  67. (12:27:54) pedroigor: private String descriptor;
  68. (12:27:58) pedroigor: @RelationshipMember
  69. (12:28:00) pedroigor: @ManyToOne
  70. (12:28:02) pedroigor: private IdentityTypeEntity identityType;
  71. (12:28:06) pedroigor: @OwnerReference
  72. (12:28:08) pedroigor: @ManyToOne
  73. (12:28:10) pedroigor: private RelationshipTypeEntity owner;
  74. (12:29:09) xybrek: yes basically we copied your code: RelationshipIdentityTypeEntity
  75. (12:30:11) xybrek: pedroigor: could this be that IDMConfiguration did not startup?
  76. (12:30:56) pedroigor: probably ... to help you I really need the following things:
  77. (12:31:10) pedroigor: 1) how your PL dependencies looks like in your pom.xml
  78. (12:31:15) xybrek: pedroigor: we are using JBoss Errai and I am not sure if IDMConfiguration is starting up.
  79. (12:31:38) pedroigor: i think it is .. otherwise you would not get those errors ...
  80. (12:31:39) xybrek: vwjuicew: can you share with pedroigor? :-)
  81. (12:32:37) pedroigor: 2) if you are building the IdentityConfiguration manually, the code used to build it
  82. (12:32:52) pedroigor: 3) your persistence.xml
  83. (12:34:57) pedroigor: xybrek: it is pretty strange you get an error for org.picketlink.idm.jpa.schema.RelationshipIdentityObject. If you said that you're using your own entities ....
  84. (12:35:22) xybrek: pedroigor: http://www.pastekit.com/LgR
  85. (12:35:37) xybrek: that is the IDMConfiguration we have
  86. (12:36:16) xybrek: btw, can we ommit addContextInitializer(this.contextInitializer) ?
  87. (12:36:43) pedroigor: xybrek: I can not see in the mappedEntity list the entity RelationshipIdentityTypeEntity.class ... maybe this is the issue ..
  88. (12:37:33) pedroigor: xybrek: no you can't the context initializer is important to bridge the JPA store with your environment. So PL can get EntityManager instances automatically ..
  89. (12:40:51) xybrek: pedroigor: what about this: lass org.picketlink.idm.jpa.schema.PartitionObject] does not have any mapping. (new one)
  90. (12:41:28) pedroigor: same thing :) I think ...
  91. (12:42:19) pedroigor: btw, are you using the same package as simple schema to your custom entities ? org.picketlink.idm.jpa.schema
  92. (12:43:00) gSharma_dinner is now known as gSharma
  93. (12:45:20) vwjuicew: no
  94. (12:45:54) pedroigor: vwjuicew: wondering why you're getting thise org.picketlink.idm.jpa.schema.* errors ..
  95. (12:46:01) vwjuicew: I'm sorry I had to take a call, I'm back now, I'm reading the whole chat
  96. (12:46:13) vwjuicew: yeah let me try, I didn't even compile yet
  97. (12:48:04) pedroigor: vwjuicew: please, check if you have picketlink-idm-simple-schema in your pom as a dependency ..
  98. (12:48:13) pedroigor: you should not, as you're providing your own entities ..
  99. (12:48:22) vwjuicew: yeah I'm copying pom to pastebin just one sec
  100. (12:48:27) vwjuicew: pl
  101. (12:48:29) vwjuicew: ok*
  102. (12:49:11) vwjuicew: so in the jar that has the entities, we only have this
  103. (12:49:12) vwjuicew: <dependency>
  104. (12:49:12) vwjuicew: <groupId>org.jboss.errai</groupId>
  105. (12:49:12) vwjuicew: <artifactId>errai-security-picketlink</artifactId>
  106. (12:49:12) vwjuicew: <version>${errai.version}</version>
  107. (12:49:12) vwjuicew: </dependency>
  108. (12:50:07) pedroigor: what about your war ?
  109. (12:50:19) cvanball left the room (quit: ).
  110. (12:50:27) vwjuicew: no, we don't have that dep
  111. (12:51:02) pedroigor: can you do a mvn dependency:tree to check if the picketlink-idm-simple-schema is there ?
  112. (12:51:16) pedroigor: in your project as whole, if possible ..
  113. (12:51:19) vwjuicew: in out ui app we have this: http://pastebin.com/25Hc1g2L
  114. (12:51:30) vwjuicew: ok
  115. (12:52:51) vwjuicew: No, I only got this:
  116. (12:52:51) vwjuicew: [INFO] +- org.jboss.errai:errai-security-picketlink:jar:3.0-SNAPSHOT:compile
  117. (12:52:51) vwjuicew: [INFO] | +- org.picketlink:picketlink-api:jar:2.6.0.CR2:compile
  118. (12:52:51) vwjuicew: [INFO] | \- org.picketlink:picketlink-impl:jar:2.6.0.CR2:compile
  119. (12:52:51) vwjuicew: [INFO] +- org.picketlink:picketlink-idm-api:jar:2.6.0.CR2:compile
  120. (12:52:51) vwjuicew: [INFO] | \- org.picketlink:picketlink-common:jar:2.6.0.CR2:compile
  121. (12:52:51) vwjuicew: [INFO] +- org.picketlink:picketlink-idm-impl:jar:2.6.0.CR2:compile
  122. (12:53:03) pedroigor: i see ..
  123. (12:55:10) pedroigor: what is error you're getting now ?
  124. (12:55:13) pedroigor: vwjuicew: ^
  125. (12:56:33) vwjuicew: I never got any error haha xybrek was, I'm compiling app now, and I'll let you know
  126. (12:56:43) pedroigor: :)
  127. (12:56:52) pedroigor: xybrek: any news on that last change ?
  128. (12:57:16) vwjuicew: I think he went away, he said he'd be back in a couple of minutes
  129. (12:57:22) pedroigor: ok
  130. (12:58:21) vwjuicew: so, what I changed so far is the AccountTypeEntity with @IdentityManaged ({UserImpl.class, UserRoleImpl.class})
  131. (12:58:39) pedroigor: UserRoleImpl ?
  132. (12:59:11) vwjuicew: yeah, that's another custom class
  133. (12:59:39) pedroigor: for users ?
  134. (12:59:43) Hillkorn left the room (quit: Remote host closed the connection).
  135. (13:00:00) vwjuicew: for Roles
  136. (13:00:21) pedroigor: why not use a different entity to map your roles ?
  137. (13:01:39) vwjuicew: http://pastebin.com/284mWXJc
  138. (13:02:50) vwjuicew: mm I'm not sure what you mean
  139. (13:02:55) pedroigor: vwjuicew: i see. so you need to map the UserRoleImpl with its own Entity, agree ? Something like RoleTypeEntity ? And remove it from the AccountTypeEntity.
  140. (13:03:49) pedroigor: otherwise you are going to store users and roles in the same table.
  141. (13:05:07) vwjuicew: what do you mean by mapping ? out UserImpl is mapped ?
  142. (13:07:47) vwjuicew: (I got no errors, I'm checking db now)
  143. (13:08:29) pedroigor: AccountTypeEntity should be used to map Account types (User, your UserImpl type). In your case you should define only @IdentityManaged(UserImpl.class).
  144. (13:09:03) vwjuicew: oh ok
  145. (13:09:12) pedroigor: UserRoleImpl.class should be mapped by a different entity, like RoleTypeEntity. Which contains the columns to store the role name, etc ..
  146. (13:09:51) vwjuicew: yeah we have RoleTypeEntity
  147. (13:10:05) pedroigor: put it there ... the UserRoleImpl ..
  148. (13:10:05) vwjuicew: I've now chaged it to map UserImplRoel
  149. (13:10:21) vwjuicew: anyways, I checked db and no rows in the tables
  150. (13:10:50) vwjuicew: I added this to persistence.xml <class>com.magick.models.shared.UserImpl</class> <class>com.magick.models.shared.UserRoleImpl</class>
  151. (13:11:00) pedroigor: no you don't need them :)
  152. (13:11:05) vwjuicew: ok
  153. (13:11:06) pedroigor: those are not JPA entities ..
  154. (13:11:09) pedroigor: did you commit the changes ?
  155. (13:11:39) vwjuicew: mm commit? you have access to out repo ? haha
  156. (13:11:54) pedroigor: lol
  157. (13:12:00) pedroigor: i mean, the transaction ...
  158. (13:12:10) pedroigor: to your app ..
  159. (13:12:54) vwjuicew: the changes? yeah, I'm compiling again
  160. (13:13:25) vwjuicew: if you want to check out persistence, it's still as in my post. https://community.jboss.org/thread/241382.
  161. (13:14:36) pedroigor: you are using RESOURCE_LOCAL transactions ..
  162. (13:14:49) pedroigor: make you sure you are flushing/commiting the changes to the database ..
  163. (13:15:19) pedroigor: btw, did you configure Hibernate to print the SQL statements ?
  164. (13:16:12) vwjuicew: nop, Ill change that
  165. (13:17:33) vwjuicew: would this help ? <property name="hibernate.connection.autocommit" value="true" />
  166. (13:17:37) vwjuicew: I had it in false
  167. (13:17:49) pedroigor: not sure, try it out ...
  168. (13:27:47) vwjuicew: ok, im seeing hibernate queries now
  169. (13:29:31) vwjuicew: pedroigor: but I don't see any query after making identityManager.add(account);
  170. (13:29:58) vwjuicew: btw, do you think we need IDM ? maybe we don't even need it
  171. (13:30:06) pedroigor: vwjuicew: maybe you can try to inject the EntityManager and flush it after calling add ?
  172. (13:30:21) vwjuicew: ok
  173. (13:31:00) vwjuicew: oh and I saw this too: 13:26:35,245 WARN [org.hibernate.ejb.internal.EntityManagerFactoryRegistry] (pool-106-thread-1) HHH000436: Entity manager factory name (pu-magick) is already registered. If entity manager will be clustered or passivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name'
  174. (13:35:27) vwjuicew: hm seems I
  175. (13:35:43) vwjuicew: 'm getting an error when flushing
  176. (13:36:14) vwjuicew: I've injected it like this: @Inject @PicketLink EntityManager em;
  177. (13:36:39) vwjuicew: and I have this in other class : @Produces @PicketLink @PersistenceContext(unitName = "pu-magick") private EntityManager em;
  178. (13:39:12) pedroigor: what is the error ?
  179. (13:40:53) vwjuicew: don't know it didn't appear in console, just a min fixing that
  180. (13:43:02) mposolda left the room (quit: Quit: Odch?z?m).
  181. (13:46:13) jcacek left the room (quit: Quit: Ex-Chat).
  182. (13:47:18) vwjuicew: javax.persistence.TransactionRequiredException: no transaction is in progress
  183. (13:48:01) vwjuicew: whole stack trace http://pastebin.com/c5W37N84
  184. (13:48:04) vwjuicew: brb
  185. (13:58:06) vwjuicew: back
  186. (14:04:10) pedroigor: vwjuicew: why don't you use JTA transactions ?
  187. (14:14:20) vwjuicew: mm I think we tried once and it didn't work, let me try again
  188. (14:24:29) vwjuicew: yeap, it's failing with Servlet threw load() exception: java.lang.NullPointerException
  189. (14:24:29) vwjuicew: at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:73) [hibernate-core-4.1.8.Final.jar:4.1.8.Final]
  190. (14:24:29) vwjuicew: when deploying
  191. (14:37:07) kunjan left the room (quit: Ping timeout: 240 seconds).
Advertisement
Add Comment
Please, Sign In to add comment