In my previous question, Weakly-compact cardinals, I was asking about weakly-compact cardinals and equivalent definitions to the basic one, which is $\kappa \to (\kappa)^2_2$.
One of which was that $\kappa$ is inaccessible and has the tree property (that is if any tree of cardinality $\kappa$ for which every level is of cardinality $<\kappa$ then it has a branch (i.e. a maximal chain) of cardinality $\kappa$).
I can understand the property itself and what it means. However, since $\aleph_1$ or $\aleph_\omega$ are clearly not weakly-compact cardinals, there should be a tree which contradicts this property.
How do you build this sort of tree?
What you are looking for is the concept of Aronszajn tree. You can read about constructions of Aronszajn trees in any graduate level set theory text, and meanwhile, the Wikipedia page lists a summary of the basic facts:
Kőnig's lemma states that $\aleph_0$-Aronszajn trees do not exist.
The existence of Aronszajn trees ($=\aleph_1$-Aronszajn trees) was proven by Nachman Aronszajn, and implies that the analogue of König's lemma does not hold for uncountable trees.
The existence of $\aleph_2$-Aronszajn trees is undecidable (assuming a certain large cardinal axiom): more precisely, the continuum hypothesis implies the existence of an $\aleph_2$-Aronszajn tree, and Mitchell and Silver showed that it is consistent (relative to the existence of a weakly compact cardinal) that no $\aleph_2$-Aronszajn trees exist.
Jensen proved that $V=L$ implies that there is a κ-Aronszajn tree (in fact a κ-Suslin tree) for every infinite successor cardinal κ.
Cummings & Foreman (1998) showed (using a large cardinal axiom) that it is consistent that no $\aleph_n$-Aronszajn trees exist for any finite n other than 1.
If κ is weakly compact then no κ-Aronszajn trees exist. Conversely if κ is inaccessible and no κ-Aronszajn trees exist then κ is weakly compact.
Finally, let me point out a small inaccuracy in your question. The equivalence is that $\kappa$ is weakly compact iff it is inaccessible and has the tree property. It is not correct to drop the inaccessibility part, as you did, since it is consistent that $\aleph_2$ has the tree property.