How come this code works when I run it normally in Android Studio as Java, but as soon as I run it as an app it shows me a NullPointerExcception? The 2019 Stack Overflow Developer Survey Results Are InException: com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2009How to make an MQ app exe to run continously?java code to catch mqrc 2009 and 2059 errorsError when running .NET app from AutoSysBouncing Out Of Method In IBM Websphere Studio Enterprise Developer - Java CodeWebsphere MQ asynchronous put not workingWebSphere MQ error MQRC_NOT_AUTHORIZED 2035 even with CHLAUTH(DISABLED)How to set message expiry in WebSphere MQ (queue) by Java code ( not by JMS API - time to Live )How to show MQ client list by Java?Accessing IBM MQ 8 using JMS with user but without passwordHow MQ Client like Java Client listen messages from MQ Server running ServerConn Channel
Why not take a picture of a closer black hole?
I am an eight letter word. What am I?
Is it safe to harvest rainwater that fell on solar panels?
Straighten subgroup lattice
Accepted by European university, rejected by all American ones I applied to? Possible reasons?
How to obtain a position of last non-zero element
What do hard-Brexiteers want with respect to the Irish border?
Likelihood that a superbug or lethal virus could come from a landfill
Cooking pasta in a water boiler
Mathematics of imaging the black hole
For what reasons would an animal species NOT cross a *horizontal* land bridge?
Pokemon Turn Based battle (Python)
Keeping a retro style to sci-fi spaceships?
How to notate time signature switching consistently every measure
Can you cast a spell on someone in the Ethereal Plane, if you are on the Material Plane and have the True Seeing spell active?
The phrase "to the numbers born"?
How to type a long/em dash `—`
Is there a way to generate a uniformly distributed point on a sphere from a fixed amount of random real numbers?
Falsification in Math vs Science
Is Cinnamon a desktop environment or a window manager? (Or both?)
Loose spokes after only a few rides
Can a flute soloist sit?
Geography at the pixel level
Button changing its text & action. Good or terrible?
How come this code works when I run it normally in Android Studio as Java, but as soon as I run it as an app it shows me a NullPointerExcception?
The 2019 Stack Overflow Developer Survey Results Are InException: com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2009How to make an MQ app exe to run continously?java code to catch mqrc 2009 and 2059 errorsError when running .NET app from AutoSysBouncing Out Of Method In IBM Websphere Studio Enterprise Developer - Java CodeWebsphere MQ asynchronous put not workingWebSphere MQ error MQRC_NOT_AUTHORIZED 2035 even with CHLAUTH(DISABLED)How to set message expiry in WebSphere MQ (queue) by Java code ( not by JMS API - time to Live )How to show MQ client list by Java?Accessing IBM MQ 8 using JMS with user but without passwordHow MQ Client like Java Client listen messages from MQ Server running ServerConn Channel
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
It works perfectly fine when it's run normally as a java code, but as soon as it's run as an app, the queueManager shows NULL. All this code is put inside onCreate(Bundle savedInstanceState). When it's run as java, the debugger actually shows a queueManager value.
void init()
int openOptions = CMQC.MQOO_INQUIRE
ibm-mq
add a comment |
It works perfectly fine when it's run normally as a java code, but as soon as it's run as an app, the queueManager shows NULL. All this code is put inside onCreate(Bundle savedInstanceState). When it's run as java, the debugger actually shows a queueManager value.
void init()
int openOptions = CMQC.MQOO_INQUIRE
ibm-mq
add a comment |
It works perfectly fine when it's run normally as a java code, but as soon as it's run as an app, the queueManager shows NULL. All this code is put inside onCreate(Bundle savedInstanceState). When it's run as java, the debugger actually shows a queueManager value.
void init()
int openOptions = CMQC.MQOO_INQUIRE
ibm-mq
It works perfectly fine when it's run normally as a java code, but as soon as it's run as an app, the queueManager shows NULL. All this code is put inside onCreate(Bundle savedInstanceState). When it's run as java, the debugger actually shows a queueManager value.
void init()
int openOptions = CMQC.MQOO_INQUIRE
ibm-mq
ibm-mq
edited Mar 8 at 11:20
integrationworker
asked Mar 8 at 11:07
integrationworkerintegrationworker
166
166
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Is the MQEnvironment a external library? If yes, have you imported it to your android project?
Yes, otherwise I wouldn't even be able to run it
– integrationworker
Mar 8 at 11:14
add a comment |
(1) As I have posted here many times, do NOT use MQEnvironment class as it is not thread safe. Put the connection information into a Hashtable and pass the Hastable to the MQQueueManager class. See here for an example of what I'm talking about.
(2) Putting "System.exit(2);" in the middle of your code is bad form and that means the finally clause will not be called. Hence, the code will leave open the queue and connection to queue manager.
(3) In your finally clause, you have the "disconnect" and "close" backwards. You must close the queue before you disconnect from the queue manager.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061922%2fhow-come-this-code-works-when-i-run-it-normally-in-android-studio-as-java-but-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is the MQEnvironment a external library? If yes, have you imported it to your android project?
Yes, otherwise I wouldn't even be able to run it
– integrationworker
Mar 8 at 11:14
add a comment |
Is the MQEnvironment a external library? If yes, have you imported it to your android project?
Yes, otherwise I wouldn't even be able to run it
– integrationworker
Mar 8 at 11:14
add a comment |
Is the MQEnvironment a external library? If yes, have you imported it to your android project?
Is the MQEnvironment a external library? If yes, have you imported it to your android project?
answered Mar 8 at 11:10
HasBertHasBert
435
435
Yes, otherwise I wouldn't even be able to run it
– integrationworker
Mar 8 at 11:14
add a comment |
Yes, otherwise I wouldn't even be able to run it
– integrationworker
Mar 8 at 11:14
Yes, otherwise I wouldn't even be able to run it
– integrationworker
Mar 8 at 11:14
Yes, otherwise I wouldn't even be able to run it
– integrationworker
Mar 8 at 11:14
add a comment |
(1) As I have posted here many times, do NOT use MQEnvironment class as it is not thread safe. Put the connection information into a Hashtable and pass the Hastable to the MQQueueManager class. See here for an example of what I'm talking about.
(2) Putting "System.exit(2);" in the middle of your code is bad form and that means the finally clause will not be called. Hence, the code will leave open the queue and connection to queue manager.
(3) In your finally clause, you have the "disconnect" and "close" backwards. You must close the queue before you disconnect from the queue manager.
add a comment |
(1) As I have posted here many times, do NOT use MQEnvironment class as it is not thread safe. Put the connection information into a Hashtable and pass the Hastable to the MQQueueManager class. See here for an example of what I'm talking about.
(2) Putting "System.exit(2);" in the middle of your code is bad form and that means the finally clause will not be called. Hence, the code will leave open the queue and connection to queue manager.
(3) In your finally clause, you have the "disconnect" and "close" backwards. You must close the queue before you disconnect from the queue manager.
add a comment |
(1) As I have posted here many times, do NOT use MQEnvironment class as it is not thread safe. Put the connection information into a Hashtable and pass the Hastable to the MQQueueManager class. See here for an example of what I'm talking about.
(2) Putting "System.exit(2);" in the middle of your code is bad form and that means the finally clause will not be called. Hence, the code will leave open the queue and connection to queue manager.
(3) In your finally clause, you have the "disconnect" and "close" backwards. You must close the queue before you disconnect from the queue manager.
(1) As I have posted here many times, do NOT use MQEnvironment class as it is not thread safe. Put the connection information into a Hashtable and pass the Hastable to the MQQueueManager class. See here for an example of what I'm talking about.
(2) Putting "System.exit(2);" in the middle of your code is bad form and that means the finally clause will not be called. Hence, the code will leave open the queue and connection to queue manager.
(3) In your finally clause, you have the "disconnect" and "close" backwards. You must close the queue before you disconnect from the queue manager.
answered Mar 8 at 23:23
RogerRoger
4,859714
4,859714
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061922%2fhow-come-this-code-works-when-i-run-it-normally-in-android-studio-as-java-but-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown