This is a huge question. So many wars have been fought for so many different reasons, I don't know if it is even possible to provide one answer for all cases.
But I would say that there are several wars that were avoidable. Certainly the US-Vietnam war, or the 2003 US-Iraq war were both avoidable, and could've been handled much better and more peacefully. Or the 4th Crusade, which contrary to the whole point of the war, was redirected to sacking the Christian city of Constantinople. The answer is 'yes' at least in some of these cases.
In other cases I'm not so sure. As has often been stated, war is the failure of diplomacy, and diplomacy is not always feasible. In some ways, war is a pressure release valve for when social or national problems build up beyond what governments can peacefully deal with.
But as the world becomes more globally intertwined, and our weapons become capable of slaughtering by the tens of millions, I'd say that we'd better start coming up with new ways to solve our problems, or else the future will be a very unpleasant place indeed.
Although I am not comfortable arguing that violence is never justified, I do think there is always an alternative. One of the reasons I have ambiguous feelings about it is that I think that when violence arrives and is unable to find an outlet it ends up being turned upon the self (such as acts of self-immolation by monks in Tibet or the quiet and desperate self-harm of a teenager in his bedroom) and that has the potential to be as harmful to society, as violence turned upon others.
The sort of brutal and dehumanising acts of violence, which represent the last resort, demean and degrade us (perpetrators as well as victims), and all that war signifies, in my humble opinion, is epic failure to make progress as a civilisation.
Granted, there are the baser aspects of our nature, starting with the greatest instinct of them all, survival, which are not easily bypassed or transcended, and for very good reasons, but, at this stage in the proceedings (knowing what we know, having been through the stuff we've been through), we ought to have learned certain lessons which would enable us to focus on diplomatic alternatives (it's sad and depressing that we have not and we seem doomed to repeat the mistakes of our ancestors).
Obviously, there are cases when diplomacy fails because dialogue is impossible with those who do not share any values (thinking of Islamist extremists, for instance) and violence ends up looking like the only way to protect those values we hold dear. I just happen to think we're smarter than that, we just need to start acting it start deploying more effective strategies which have Human Rights at their core. Yes, these would take time and a great deal of effort on a grand scale but would, in the long term, be extremely worthwhile. The cost of war is too high, it makes us regress rather than progress, collectively-speaking.
If we think back in time to the Civil War, when both the North and the South had so many disagreements, there wasn't any other way than war to battle the situation out. Humans, in general, have to release their angry in some form, and unfortunately, many take it out on violence. Burning villages, breaking into homes, a big old fashioned brawl. It's in our nature. World War 1 or World War 2 for that matter, were bound to end up happening with people shooting at each other. Yes there are peaceful ways, expect how often does that ever turn out? People are too stubborn to give up easily, and honestly, if it weren't for all those wars, our future would be no where near what it is today.
Preemption is attacking the threat before it becomes one. This should have happened instead of just letting opposing forces attack our homes. War will stop threats from emerging. Almost like whack a mole. As soon as a threat arises, you must stop it. If war is the answer, then sound the alarms. Peaceful negotiating doesn't exist in a world this corrupt. War silences the voices of the oppressors.