Characteristic function and dominated convergence theorem

Let $f_n:\mathbb{R}\rightarrow\mathbb{R}$ be $1/n$ for $x\in(0,n)$ and be $0$ otherwise. Then $f_n\rightarrow 0$ pointwise, and it is dominated by the function $g=1$, and $\int f_nd\mu=1$. So we have $\lim_{n\rightarrow\infty} \int f_nd\mu=1$ but $\int 0d\mu=0$. Why does this not violate the dominated convergence theorem?

I presume you mean the function that is $1/n$ on $(0,n)$ (otherwise this is not going to $0$ pointwise). The constant function $g=1$ is not integrable: it has integral $\infty$.
The functions $f_n$ are dominated by $g(x) = 1$, but $g$ is not integrable, i.e. $\int g \not< \infty$.