Your app should not be in the lib directory, it should be in server/xxx/deploy.
The same code will work in a client if you provide a jndi.properties file - the client's JNDI code will load the properties from that file. Usually that is the best way to provide the properties because then you can easily change the host name or IP address.
What kind of app do you have?
You can provide a jboss-specific config file that includes a dependency on the queue's mbean - this way your app will not be deployed until the queue is deployed.