Several dozen migrants have clashed with Bosnian police while trying to cross the border into neighbouring Croatia, a member of the European Union.