I have some VF pages with a custom component that are working fine in my dev environment. However, when I try to deploy this to production, the deployment fails and each page that I am trying to deploy, which all have the same component, have the following error message:

Type mismatch for <apex:attribute assignTo>. Value binding to a property of type String is required, property specified (sessionId) is of type null.

This is the attribute element from the custom component:

<apex:attribute name="websession" description="Website Session"
                  type="String" required="required" assignTo="{!sessionId}"/>

This is the sessionId variable from the custom component controller:

public String sessionId {get; set;}

and this is how the component is being used in each of the VF pages:

<c:MyCustomComponent websession="{!sessionId}" /> 

I know that the session id being assigned to the custom component is not null. As I said, this is working fine in dev. Just a deployment issue I think. I'm not really sure from the error message exactly what is wrong either. Is it saying that the value being passed into the component is null?

I have run the tests for these pages' controllers and they run fine.

Any ideas what could be up here?


3 Answers 3


You say you are having issues when deploying correct? Any chance the controller already exists in the org you are deploying to? Any chance you missed the controller in the new deploy?

One scenario I have run into in the past is that the validation Salesforce runs can be a bit tricky when dealing with controllers and Visualforce. For instance:

  • You have two files in production, one for the controller and one for Visualforce.
  • You make changes to both files in a dev org/sandbox.
  • You deploy both files back to production, but validation fails on the Visualforce page. You get an error indicating a missing field, mismatched type, etc. indicating that the controller doesn't have that field.
  • You verify both files work fine in dev and are completely confused at this point. The problem I have found is (and this is completely speculating but I have seen it before). The issue is that the production org is validating the Visualforce against the old Apex code before it deploys the updated Apex code as part of the deploy.

To workaround this issue, if you can, you need to either delete the production instance of the code or comment out the Visualforce as part of the deploy and then uncomment it in production. There is no exact science to it, and this may not even be the real reason behind my issues in the past, but I have experienced some very strange things during deploys in the past. Good luck!

  • Eventually I deployed the controller for the custom component first and then the rest of the change set including all the VF pages that were failing. As, I think, you say the visualforce pages must be validated before the controller has been compiled. Thanks for your help.
    – Joe
    Commented Oct 15, 2013 at 15:00

Another reason this might be happening is because the controller that contains the AssignTo variables is not specified in the opening tag.

<apex:component controller="[controller_name_here]">

  • This answer addresses the error message and seems more correct to me. i.e. this worked for me. Thanks a_sdfc_developer! Commented Feb 9, 2016 at 13:47

Mmm for one in

<apex:attribute name="websession" description="Website Session"type="String" required="required" assignTo="{!sessionId}"/>

Required is a boolean value so it should be "True", but apart from that everything looks good. you are 100% that the value is not null?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .