Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (11:57:07) xybrek: hi anyone around here?
- (11:57:07) pedroigor: this APP is about using a signed token to authenticate user between different request
- (11:57:22) pedroigor: xybrek: yes :)
- (11:57:26) xybrek: what is this error mea "IdentityObject] does not have any mapping"
- (11:57:59) pedroigor: you probably did not provide a JPA entity that maps a specific IdentityType
- (11:59:06) pedroigor: check your persistence.xml or the code you have to build the IdentityConfiguration
- (11:59:23) vwjuicew: pedroigor: Hi, sorry to bother you, could you take a look at https://community.jboss.org/thread/241382.
- (12:00:28) pedroigor: vwjuicew: that is easy, I think :)
- (12:00:43) pedroigor: vwjuicew: you just copied the entities from the simple schema, right ?
- (12:00:47) xybrek: pedroigor: yes, we have JPA entities
- (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:01:49) xybrek: pedroigor: do we need this: IdentityConfigurationBuilder ?
- (12:02:17) vwjuicew: pedroigor: mm xybrek can tell where he copied them from specifically, but yes we copied them from some example.
- (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.
- (12:02:59) pedroigor: ok
- (12:03:04) pedroigor: so here is ..
- (12:03:11) pedroigor: let me give you an example ..
- (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
- (12:04:03) pedroigor: look at the @IdentityManaged annotation
- (12:04:49) pedroigor: accordingly with the docs, this annotation is important to tell PL which IdentityType type is related with an entity.
- (12:05:04) pedroigor: if you just copied from simple scheme, you probably have the User/Role types defined there.
- (12:05:17) pedroigor: but you need to change to reflect your custom types, instead.
- (12:05:28) xybrek: pedroigor: yup we have @IdentityManaged (IdentityType.class)
- (12:05:28) xybrek: @Entity
- (12:05:29) xybrek: @Inheritance(strategy = InheritanceType.JOINED)
- (12:05:29) xybrek: public class IdentityTypeEntity extends AttributedTypeEntity { ... }
- (12:05:47) pedroigor: this one is a base entity class ...
- (12:05:52) pedroigor: look at the AccountTypeEntity
- (12:06:12) pedroigor: you should define your custo type there using the annotation above
- (12:06:32) xybrek: pedroigor: yup we also have:
- (12:06:32) xybrek: @IdentityManaged ({User.class, Agent.class})
- (12:06:32) xybrek: @Entity
- (12:06:32) xybrek: public class AccountTypeEntity extends IdentityTypeEntity { ... }
- (12:06:42) pedroigor: exactly
- (12:06:59) iandow [[email protected]] entered the room.
- (12:07:10) xybrek: pedroigor: ?
- (12:07:20) pedroigor: see ... you are still mapping User and Agent.
- (12:07:32) pedroigor: can you try changing to your custom type ?
- (12:08:31) pedroigor: you can even take a look at the following application:
- (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 ?
- (12:09:09) pedroigor: yes
- (12:09:20) xybrek: pedroigor: I would put, @IdentityManaged ({UserImpl.class, Agent.class}) ?
- (12:09:30) pedroigor: you can remove Agent if you don't use it ..
- (12:09:41) xybrek: Ok great let me try that
- (12:09:45) matzew left the room (quit: Quit: Textual IRC Client: www.textualapp.com).
- (12:10:15) iandow left the room (quit: Remote host closed the connection).
- (12:11:29) pedroigor: xybrek: vwjuicew: we have an user contributing with this quickstart. we hope to get this soon in our repository:
- (12:11:31) pedroigor: https://github.com/filipeferraz/picketlink-authorization-idm-jpa-custom
- (12:11:41) pedroigor: it is a great example about how to provide custom types, even relationships.
- (12:12:17) vwjuicew: ok thanks Ill take a look at that one too
- (12:12:28) xybrek: cool!
- (12:12:29) jcacek left the room (quit: Quit: Ex-Chat).
- (12:12:50) jcacek [jcacek@nat/redhat/x-uyfjmzwexwwvgqsp] entered the room.
- (12:13:28) jcacek left the room (quit: Client Quit).
- (12:13:42) iandow [[email protected]] entered the room.
- (12:13:47) jcacek [jcacek@nat/redhat/x-pdksyemiqeutxtro] entered the room.
- (12:16:35) pedroigor: xybrek: i hope this can help.
- (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
- (12:20:22) xybrek: Entity [class org.picketlink.idm.jpa.schema.RelationshipIdentityObject] does not have any mapping.
- (12:23:44) pedroigor: xybrek: did you change the RelationshipIdentityObject to reflect your entity type ?
- (12:25:41) xybrek: pedroigor: we only have
- (12:25:41) xybrek: @Entity
- (12:25:41) xybrek: public class RelationshipIdentityTypeEntity implements Serializable {}
- (12:27:14) gSharma is now known as gSharma_dinner
- (12:27:50) pedroigor: do you have this fields on that entity ?
- (12:27:52) pedroigor: @RelationshipDescriptor
- (12:27:54) pedroigor: private String descriptor;
- (12:27:58) pedroigor: @RelationshipMember
- (12:28:00) pedroigor: @ManyToOne
- (12:28:02) pedroigor: private IdentityTypeEntity identityType;
- (12:28:06) pedroigor: @OwnerReference
- (12:28:08) pedroigor: @ManyToOne
- (12:28:10) pedroigor: private RelationshipTypeEntity owner;
- (12:29:09) xybrek: yes basically we copied your code: RelationshipIdentityTypeEntity
- (12:30:11) xybrek: pedroigor: could this be that IDMConfiguration did not startup?
- (12:30:56) pedroigor: probably ... to help you I really need the following things:
- (12:31:10) pedroigor: 1) how your PL dependencies looks like in your pom.xml
- (12:31:15) xybrek: pedroigor: we are using JBoss Errai and I am not sure if IDMConfiguration is starting up.
- (12:31:38) pedroigor: i think it is .. otherwise you would not get those errors ...
- (12:31:39) xybrek: vwjuicew: can you share with pedroigor? :-)
- (12:32:37) pedroigor: 2) if you are building the IdentityConfiguration manually, the code used to build it
- (12:32:52) pedroigor: 3) your persistence.xml
- (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 ....
- (12:35:22) xybrek: pedroigor: http://www.pastekit.com/LgR
- (12:35:37) xybrek: that is the IDMConfiguration we have
- (12:36:16) xybrek: btw, can we ommit addContextInitializer(this.contextInitializer) ?
- (12:36:43) pedroigor: xybrek: I can not see in the mappedEntity list the entity RelationshipIdentityTypeEntity.class ... maybe this is the issue ..
- (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 ..
- (12:40:51) xybrek: pedroigor: what about this: lass org.picketlink.idm.jpa.schema.PartitionObject] does not have any mapping. (new one)
- (12:41:28) pedroigor: same thing :) I think ...
- (12:42:19) pedroigor: btw, are you using the same package as simple schema to your custom entities ? org.picketlink.idm.jpa.schema
- (12:43:00) gSharma_dinner is now known as gSharma
- (12:45:20) vwjuicew: no
- (12:45:54) pedroigor: vwjuicew: wondering why you're getting thise org.picketlink.idm.jpa.schema.* errors ..
- (12:46:01) vwjuicew: I'm sorry I had to take a call, I'm back now, I'm reading the whole chat
- (12:46:13) vwjuicew: yeah let me try, I didn't even compile yet
- (12:48:04) pedroigor: vwjuicew: please, check if you have picketlink-idm-simple-schema in your pom as a dependency ..
- (12:48:13) pedroigor: you should not, as you're providing your own entities ..
- (12:48:22) vwjuicew: yeah I'm copying pom to pastebin just one sec
- (12:48:27) vwjuicew: pl
- (12:48:29) vwjuicew: ok*
- (12:49:11) vwjuicew: so in the jar that has the entities, we only have this
- (12:49:12) vwjuicew: <dependency>
- (12:49:12) vwjuicew: <groupId>org.jboss.errai</groupId>
- (12:49:12) vwjuicew: <artifactId>errai-security-picketlink</artifactId>
- (12:49:12) vwjuicew: <version>${errai.version}</version>
- (12:49:12) vwjuicew: </dependency>
- (12:50:07) pedroigor: what about your war ?
- (12:50:19) cvanball left the room (quit: ).
- (12:50:27) vwjuicew: no, we don't have that dep
- (12:51:02) pedroigor: can you do a mvn dependency:tree to check if the picketlink-idm-simple-schema is there ?
- (12:51:16) pedroigor: in your project as whole, if possible ..
- (12:51:19) vwjuicew: in out ui app we have this: http://pastebin.com/25Hc1g2L
- (12:51:30) vwjuicew: ok
- (12:52:51) vwjuicew: No, I only got this:
- (12:52:51) vwjuicew: [INFO] +- org.jboss.errai:errai-security-picketlink:jar:3.0-SNAPSHOT:compile
- (12:52:51) vwjuicew: [INFO] | +- org.picketlink:picketlink-api:jar:2.6.0.CR2:compile
- (12:52:51) vwjuicew: [INFO] | \- org.picketlink:picketlink-impl:jar:2.6.0.CR2:compile
- (12:52:51) vwjuicew: [INFO] +- org.picketlink:picketlink-idm-api:jar:2.6.0.CR2:compile
- (12:52:51) vwjuicew: [INFO] | \- org.picketlink:picketlink-common:jar:2.6.0.CR2:compile
- (12:52:51) vwjuicew: [INFO] +- org.picketlink:picketlink-idm-impl:jar:2.6.0.CR2:compile
- (12:53:03) pedroigor: i see ..
- (12:55:10) pedroigor: what is error you're getting now ?
- (12:55:13) pedroigor: vwjuicew: ^
- (12:56:33) vwjuicew: I never got any error haha xybrek was, I'm compiling app now, and I'll let you know
- (12:56:43) pedroigor: :)
- (12:56:52) pedroigor: xybrek: any news on that last change ?
- (12:57:16) vwjuicew: I think he went away, he said he'd be back in a couple of minutes
- (12:57:22) pedroigor: ok
- (12:58:21) vwjuicew: so, what I changed so far is the AccountTypeEntity with @IdentityManaged ({UserImpl.class, UserRoleImpl.class})
- (12:58:39) pedroigor: UserRoleImpl ?
- (12:59:11) vwjuicew: yeah, that's another custom class
- (12:59:39) pedroigor: for users ?
- (12:59:43) Hillkorn left the room (quit: Remote host closed the connection).
- (13:00:00) vwjuicew: for Roles
- (13:00:21) pedroigor: why not use a different entity to map your roles ?
- (13:01:39) vwjuicew: http://pastebin.com/284mWXJc
- (13:02:50) vwjuicew: mm I'm not sure what you mean
- (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.
- (13:03:49) pedroigor: otherwise you are going to store users and roles in the same table.
- (13:05:07) vwjuicew: what do you mean by mapping ? out UserImpl is mapped ?
- (13:07:47) vwjuicew: (I got no errors, I'm checking db now)
- (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).
- (13:09:03) vwjuicew: oh ok
- (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 ..
- (13:09:51) vwjuicew: yeah we have RoleTypeEntity
- (13:10:05) pedroigor: put it there ... the UserRoleImpl ..
- (13:10:05) vwjuicew: I've now chaged it to map UserImplRoel
- (13:10:21) vwjuicew: anyways, I checked db and no rows in the tables
- (13:10:50) vwjuicew: I added this to persistence.xml <class>com.magick.models.shared.UserImpl</class> <class>com.magick.models.shared.UserRoleImpl</class>
- (13:11:00) pedroigor: no you don't need them :)
- (13:11:05) vwjuicew: ok
- (13:11:06) pedroigor: those are not JPA entities ..
- (13:11:09) pedroigor: did you commit the changes ?
- (13:11:39) vwjuicew: mm commit? you have access to out repo ? haha
- (13:11:54) pedroigor: lol
- (13:12:00) pedroigor: i mean, the transaction ...
- (13:12:10) pedroigor: to your app ..
- (13:12:54) vwjuicew: the changes? yeah, I'm compiling again
- (13:13:25) vwjuicew: if you want to check out persistence, it's still as in my post. https://community.jboss.org/thread/241382.
- (13:14:36) pedroigor: you are using RESOURCE_LOCAL transactions ..
- (13:14:49) pedroigor: make you sure you are flushing/commiting the changes to the database ..
- (13:15:19) pedroigor: btw, did you configure Hibernate to print the SQL statements ?
- (13:16:12) vwjuicew: nop, Ill change that
- (13:17:33) vwjuicew: would this help ? <property name="hibernate.connection.autocommit" value="true" />
- (13:17:37) vwjuicew: I had it in false
- (13:17:49) pedroigor: not sure, try it out ...
- (13:27:47) vwjuicew: ok, im seeing hibernate queries now
- (13:29:31) vwjuicew: pedroigor: but I don't see any query after making identityManager.add(account);
- (13:29:58) vwjuicew: btw, do you think we need IDM ? maybe we don't even need it
- (13:30:06) pedroigor: vwjuicew: maybe you can try to inject the EntityManager and flush it after calling add ?
- (13:30:21) vwjuicew: ok
- (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'
- (13:35:27) vwjuicew: hm seems I
- (13:35:43) vwjuicew: 'm getting an error when flushing
- (13:36:14) vwjuicew: I've injected it like this: @Inject @PicketLink EntityManager em;
- (13:36:39) vwjuicew: and I have this in other class : @Produces @PicketLink @PersistenceContext(unitName = "pu-magick") private EntityManager em;
- (13:39:12) pedroigor: what is the error ?
- (13:40:53) vwjuicew: don't know it didn't appear in console, just a min fixing that
- (13:43:02) mposolda left the room (quit: Quit: Odch?z?m).
- (13:46:13) jcacek left the room (quit: Quit: Ex-Chat).
- (13:47:18) vwjuicew: javax.persistence.TransactionRequiredException: no transaction is in progress
- (13:48:01) vwjuicew: whole stack trace http://pastebin.com/c5W37N84
- (13:48:04) vwjuicew: brb
- (13:58:06) vwjuicew: back
- (14:04:10) pedroigor: vwjuicew: why don't you use JTA transactions ?
- (14:14:20) vwjuicew: mm I think we tried once and it didn't work, let me try again
- (14:24:29) vwjuicew: yeap, it's failing with Servlet threw load() exception: java.lang.NullPointerException
- (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]
- (14:24:29) vwjuicew: when deploying
- (14:37:07) kunjan left the room (quit: Ping timeout: 240 seconds).
Advertisement
Add Comment
Please, Sign In to add comment