ANSWER - During holidays, many recipes circulate that recommend baking breads and cakes in canning jars. Consumers like to do this because the jar makes an attractive package for their favorite recipe. However, many do not think about the safety of this practice. These products are not shelf-stable and so cannot be stored at room temperature. If they are stored at room temperature, harmful bacteria could grow in them and make the product unsafe to eat.
Typical instructions to bake bread or cake in a canning jar are as follows: batter is poured in the jar and then baked in an oven. As soon as it is done, it is taken out of the oven while the steam is still exhausting. The jar is immediately sealed to create a vacuum seal. The jars are then stored without refrigeration, for sometimes over one year.
Some cakes or breads prepared in this manner have shown a water activity of 0.93 and a pH of 7.2. Harmful bacteria can grow under these conditions. Furthermore, the oxygen-free environment due to the vacuum seal is ideal for the growth of Clostridium botulinum, the bacteria that causes botulism. Therefore, baking bread or cake in a canning jar and storing it at room temperature is not a safe practice.
If breads or cakes are baked in canning jars, seal them after they are completely cooled so that a vacuum seal is not created. This will prevent the growth of Clostridium botulinum. Also, immediately refrigerate. Refrigeration temperatures will prevent the growth of other harmful bacteria that can grow at the water activity and pH typically found in these types of products. The shelf-life in the refrigerator is several weeks.
Additionally, there is always the risk of having the jar break in the oven or upon removal from the oven. Also, the jars can be very hot so use oven mitts to prevent burns.
from: Dr. Angie Fraser, Food Safety Specialist, North Carolina State University.