We prove the generalized Ulam stability of ternary homomorphisms from commutative ternary semigroups into n-Banach spaces as well as into complete non-Archimedean normed spaces. Ternary algebraic structures appear in various domains of theoretical and mathematical physics, and p-adic numbers, which are the most important examples of non-Archimedean fields, have gained the interest of physicists for their research in some problems coming from quantum physics, p-adic strings and superstrings.