cancel
Showing results for 
Search instead for 
Did you mean: 

Lockservice : Bad Crendentials presented Exception

grégo
Champ in-the-making
Champ in-the-making
Hi,

I have, in fact, two problems.

I'm need to lock a document and to make a copy of it in an other space. For that, I began using the CheckOutCheckInService in my DialogBean. I configured my faces-config-custom.xml like this :


   <managed-bean>
      <managed-bean-name>NewEditionDialog</managed-bean-name>
      <managed-bean-class>com.alcatellucent.gerard.gdoc.bean.dialog.NewEditionDialog</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
         <property-name>browseBean</property-name>
         <value>#{BrowseBean}</value>
      </managed-property>
      <managed-property>
         <property-name>checkOutCheckInService</property-name>
         <value>#{CheckOutCheckInService}</value>
      </managed-property>
      <managed-property>
         <property-name>nodeService</property-name>
         <value>#{NodeService}</value>
      </managed-property>
   </managed-bean>

Then I use the CheckOutCheckInService in my NewEditionDialog like this:


this.workCopyRef = this.checkOutCheckInService.checkout(documentRef, destSpaceRef, ContentModel.ASSOC_CONTAINS, ContentModel.TYPE_CONTAINER);

But my checkOutCheckInService variable is null (I correctly declared my setter, of course). So my first question is : How to be sure that a service is instantiated? I can't figure out how can I get an instance of my service from a Factory or whatever. Maybe there is a thing in JSF that I don't understand.

Secont part :

Then I decide to do the "checkout" from myself. So I declare a copyService an a lockService in my faces-config-custom.xml :


<managed-bean>
      <managed-bean-name>NewEditionDialog</managed-bean-name>
      <managed-bean-class>com.alcatellucent.gerard.gdoc.bean.dialog.NewEditionDialog</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
         <property-name>browseBean</property-name>
         <value>#{BrowseBean}</value>
      </managed-property>
      <managed-property>
         <property-name>nodeService</property-name>
         <value>#{NodeService}</value>
      </managed-property>
      <managed-property>
      <managed-property>
         <property-name>copyService</property-name>
         <value>#{CopyService}</value>
      </managed-property>
      <managed-property>
         <property-name>lockService</property-name>
         <value>#{LockService}</value>
      </managed-property>
   </managed-bean>

The setters are correctly setted up too. I call both of the services :


this.lockService.lock(documentRef, LockType.READ_ONLY_LOCK);
this.workCopyRef = this.copyService.copy(documentRef, destSpaceRef, ContentModel.ASSOC_CONTAINS, ContentModel.TYPE_CONTAINER);

But each of them throw a BadCredentialsException, and I don't know why.

Somebody could help ?

Thanks.  :wink:
2 REPLIES 2

grégo
Champ in-the-making
Champ in-the-making
Ok, for the first problem, I found a solution five minutes after my post (after more or less three days trying to solve the problem).

I can get the instance of a CheckOutCheckInService this way :


FacesContext fc = FacesContext.getCurrentInstance();
this.checkOutCheckInService = Repository.getServiceRegistry(fc).getCheckOutCheckInService();

But now, this call throw me an BadCrendentialspresentedException too Smiley Sad

martihno
Champ in-the-making
Champ in-the-making
Hi,

did you solve your problem?

If you didn't, change your file faces-config.xml and put this:

<managed-property>
   <property-name>checkoutCheckinService</property-name>
   <value>#{CheckoutCheckinService}</value>
</managed-property>

Service name is CheckoutCheckinService, not CheckOutCheckInService..

Hope this will help you Smiley Happy