Infinite wire, vector potential If I want to calculate the magnetic vector potential $\vec{A}$ of a infinite wire using the formula $$A(\textbf r)=\frac{\mu_0}{4\pi}\space \int \frac{\textbf j(\textbf r')\space d\textbf r'^3}{|\textbf r-\textbf r'|}$$ at a distance $a$ from the wire I get a integral that does not converge: $$A(| \textbf{r}|=a)=\frac{\mu_0 I}{4\pi}\ \int_{-\infty}^{\infty}\frac{dy}{\sqrt{(x+a)^2+y^2}}$$. 

Question: Is this a consequence of the fact that $\nabla\space \textbf j=0$, because of charge conservation, and an infinite wire wouldn't conserve charge, since the both ends never meet to form a "loop "?
 A: The divergence is a consequence of the fact that the vector potential is a sort of "energy", just like the scalar potential; it is an extensive quantity and it scales with the volume of the system.
The energy of something that is constant and infinite is (usually) divergent. Loosely speaking, we are in a situation where
$$
A=\rho_0 L+\text{finite}
$$
where $\rho_0$ is a certain constant and $L$ is the length of the wire, which is formally infinite. This term - in more complex situations - is sometimes called a zero-point energy: a constant shift in the energy which is not measurable and doesn't affect physical predictions.
On the other hand, the magnetic field $\boldsymbol B$ is the derivative of $\boldsymbol A$ with respect to $a$, which is finite, because the $\rho_0 L$ term doesn't depend on $a$ (its derivative vanishes). The magnetic field is finite, as it should be: this object is measurable, unlike $\boldsymbol A$.
The same situation appears when one considers an infinite sheet of charge: there the electric field is finite, but the scalar potential diverges:
$$
\phi=\rho_0 S+\text{finite}
$$
where $S$ is the area of the sheet, formally infinite $S\to\infty$. Again, this is a consequence of the fact that the potential is an extensive magnitude, and it scales with the volume of space.
Some day you'll learn QFT and all these ideas will prove essential in our understanding of Nature.
