How do I set XAConnectionFactoryEnabled in WLST Offline Mode - jms

I am trying to set up a JMS queue in Weblogic to be transactional. This requires enabling XA on the connection factory I am using.
I know I can do this from the admin console once weblogic is up and running. However, I really need to do it in offline mode while the domain is being created. Right now I have this:
#*Setting up resources and JDBC*
cd('/')
create('JMSServer-0', 'JMSServer')
cd('/')
create('JMSQueues', 'JMSSystemResource')
cd('JMSSystemResource/JMSQueues/JmsResource/NO_NAME_0')
queue=create('AQueue', 'Queue')
queue.setJNDIName('jms/AQueue')
queue.setSubDeploymentName('subdeploymentA')
queue=create('BQueue', 'Queue')
queue.setJNDIName('jms/BQueue')
queue.setSubDeploymentName('subdeploymentB')
connFact=create('AConnFact', 'ConnectionFactory')
connFact.setJNDIName('jms/AConnFact')
connFact.setSubDeploymentName('subdeployment_fact_A')
connFact=create('BConnFact', 'ConnectionFactory')
connFact.setJNDIName('jms/BConnFact')
connFact.setSubDeploymentName('subdeployment_fact_B')
cd('/JMSSystemResource/JMSQueues/JmsResource/NO_NAME_0/ConnectionFactory/BConnFact')
tp=create('BConnFactTp', 'TransactionParam')
tp.setXAConnectionFactoryEnabled(true)
#TransactionParam does not show up here
print "\n" + pwd() + "\n"
ls()
#TransactionParam DOES show up here
cd('/JMSSystemResource/JMSQueues/JmsResource/NO_NAME_0/ConnectionFactory/AConnFact')
print "\n" + pwd() + "\n"
ls()
#Finalization follows here
Now, this is an existing script and AConnFact and AQueue have been around for awhile with XA disabled, so I'd prefer to leave them alone. So, how do I make it so that BConnFact is actually the one that gains the new TransactionParam settings?
I should note that I do have a "meh" fix to this. Create will place the TransactionParams in the order that the ConnectionFactories are created. I can just place them in the order I want. However, I would prefer not to do that.

See if something like the following example will work for you:
cd('/JMSSystemResources/MyModule/JMSResource/MyModule')
cmo.createConnectionFactory('MyConnFac')
cd('/JMSSystemResources/MyModule/JMSResource/MyModule/ConnectionFactories/MyConnFac')
cmo.setJNDIName('jms/MyConnFac')
cmo.setSubDeployment('my_sub')
cd('/JMSSystemResources/MyModule/JMSResource/MyModule/ConnectionFactories/MyConnFac/TransactionParams/MyConnFac')
cmo.setTransactionTimeout(3600)
cmo.setXAConnectionFactoryEnabled(true)
Works for us in 10.3.6
Edit: Ah probably. If you really need to do it offline and wlst isn't going to work you can manually edit your <domain home>/config/jms/<jms module>.xml file and add
<transaction-params>
<transaction-timeout>900</transaction-timeout>
<xa-connection-factory-enabled>true</xa-connection-factory-enabled>
</transaction-params>
under your connection factory.

This might be a bit outdated but in offline this works for 12.2.1:
connFact = create('PubSubSelectorsConnectionFactory','ConnectionFactory')
connFact.setJNDIName('jms/PubSubSelectorsConnectionFactory')
cd('/JMSSystemResource/PubSubSelectorsJMSModule/JmsResource/NO_NAME_0/ConnectionFactory/PubSubSelectorsConnectionFactory')
set('DefaultTargetingEnabled','true')
create('PubSubSelectorsConnectionFactoryTP', 'TransactionParams')
cd('TransactionParams/NO_NAME_0')
set('XAConnectionFactoryEnabled', 'true')

Related

How to save ADF file to a network share?

So, it looks like the best way to do this is with the exportAreaDefinitionFile() call. I thought I would just export the file to the local file system then manually send it to where I need it. However when I make the exportAreaDefinitionFile() call, I don't get a file in the local file system. When I handle the onActivityResult() for the export it gets a RESULT_CANCELED result every time. Does anyone know why this would occur? Everything I've seen online says it should work.
When I look at logcat I get these messages after the exportAreaDefinitionFile() Call:
I/tango_client_api: void TangoService_disconnect(): Disconnecting from Tango...
I/tango_client_api: void TangoService_disconnect(): Successfully disconnected from Tango.
Is this normal?
I figured it out!!
It turns out that the problem was I was using this:
String mapsFolder = getFilesDir() + File.separator + "ADFs";
When I should have been using this:
String mapsFolder = getFilesDir().getAbsolutePath() + File.separator + "ADFs";
This being my first ever Android app I have no idea why these two calls are functionally different. I still haven't wrapped my head around the Android file system.

rspec testing that api call increments a counter

I have a test that works right now but it's ugly and I can't help thinking there is a better way to do this. Basically I pick a record from the database and then make an api call which should affect that record. However the only way to make the test pass is to pull the record from the database a second time.
it "counts how many times a client has pulled its config" do
client = Endpoint.last
config_count = client.config_count
post '/api/config', node_key: client.node_key
same_client = Endpoint.find_by node_key: client.node_key
# expect(client.config_count).to eq(config_count + 1)
expect(same_client.config_count).to eq(config_count + 1)
end
The commented out line does not work. This fix is so ugly that it makes me think I'm doing it wrong. I also tried this:
expect {post '/api/config', node_key: client.node_key}.to change {client.config_count}.by(1)
So what is the proper way to test this?
Probably several ways to solve it. I tend to call .reload on my object if I want updated values for it and don't care what exactly is happening inside the object itself.
it "counts how many times a client has pulled its config" do
client = Endpoint.last
config_count = client.config_count
post '/api/config', node_key: client.node_key
client.reload
expect(client.config_count).to eq(config_count + 1)
end

Is there a way to disable fakeredis once it's loaded?

I'm working with some code that uses the fakeredis gem for specs, but whenever I run those specs from a REPL, fakeredis stays around and commands like Redis.new will just give me fakeredis. I need to be able to disable it to be able to access the real redis store again.
Is there a way to disable/enable it in the REPL?
Two solutions, either remove the fakeredis memory class:
Redis::Connection.drivers.delete_if {|d| d == Redis::Connection::Memory }
or append the Ruby adapter again:
Redis::Connection.drivers << Redis::Connection::Ruby
Source: https://github.com/guilleiguaran/fakeredis/issues/63

Language Service: ParseReason.Check never called after migrating to VS2010

I just migrated my language service from VS2008 to VS2010. Everything works fine except for one important thing: I no longer get LanguageService.ParseSource invoked for ParseReason.Check. It do get a single invoke after opening a file. But after editing code, it no longer gets invoked.
Any ideas what could be causing that?
I also migrated a language service from 2008 to 2010. Can you check if you've fallowed all of these steps?
http://msdn.microsoft.com/en-us/library/dd885475.aspx
I didn't have to do anything else, which I verified by diffing the important files in our depot before and after the change.
I don't know if you ever figured your question out, but have you tried making sure that your Source class' LastParseTime is set to 0 when creating it? I seem to recall some issues with Check not happening unless you manually set LastParseTime to 0 when creating your Source object.
Protip: If you use .NET Reflector, you can disassemble all of the base classes for the LanguageService framework and get a pretty good understanding of how it all works under the hood. The classes you'd be interested in live in Microsoft.VisualStudio.Package.LanguageService.10.0.dll, which should be installed in the GAC. I've found this to be unimaginably helpful when trying to figure out why things weren't working in my own Language Service, and being able to step through the source code in the debugger mitigates almost all the pain of working with these frameworks!
When your Source object is initialized, it starts off with a LastParseTime of Int32.MaxValue. The code that causes fires off a ParseRequest with ParseReason.Check checks the LastParseTime value to see if the time since the last change to the text is less than the time it takes to run a parse (or the CodeSenseDelay setting, whichever is greater).
The code that handles the response from ParseSource is supposed to set the LastParseTime, but as far as I can tell, it only does that if the ParseReason is Check.
You can get around this issue by setting Source.LastParseTime = 0 when you initialize your Source. This has the side-effect of setting CompletedFirstParse to true, even if the first parse hasn't finished yet.
Another way to fix this issue is to override Source.OnIdle to fire off the first call to BeginParse() This is the way I would recommend.
public override void OnIdle(bool periodic)
{
// Once first "Check" parse completes, revert to base implementation
if (this.CompletedFirstParse)
{
base.OnIdle(periodic);
}
// Same as base implementation, except we don't check lastParseTime
else if (!periodic || this.LanguageService == null || this.LanguageService.LastActiveTextView == null || (this.IsCompletorActive) || (!this.IsDirty || this.LanguageService.IsParsing))
{
this.BeginParse();
}
}

ResultSet.getString() on VARCHAR2 column returns empty string

Disclaimer: I don't actually know anything about nether Oracle nor Java. The issue is in a project that some other developer completed at some point in time and then left the company. Now I have to setup webserver, database and get it all up and running.
the code is approx this:
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:<user>/<password>#localhost:1521:xe");
OracleConnection ocon = (OracleConnection)ods.getConnection();
OracleStatement stmt = (OracleStatement)ocon.createStatement();
OracleResultSet rs = (OracleResultSet)stmt.executeQuery("SELECT POLLID, QUESTION, ISMULTISELECT FROM POLL WHERE POLLID = " + pollID);
if (!rs.next()) {
System.out.println("No rows found.");
return false;
}
this._PollID = rs.getInt("POLLID");
this._Question = rs.getString("QUESTION");
this._IsMultiSelect = rs.getBoolean("ISMULTISELECT");
The POLLID and ISMULTISELECT columns return correct values as expected. The QUESTION seem to always return empty string. The value in the DB is obviously not empty.
The rs.getAsciiStream("QUESTION").available() also returns zero.
Am I missing something completely obvious here?
EDIT:
sqlplus returns varchar2 value just fine
connecting via odbc (as opposed to thin) also makes things work
so no Exceptions, you are not using reserved words...maybe try to use other driver, or select into other table and experiment start with empty QUESTION column, then add some value and debug.
Thanks to everyone who replied. At this point it seems issue is between thin driver and XE version of Oracle. Unfortunately we don't have full version kickin' around (we are primarily ASP.NET/MS SQL developers), so we'll have to stick with ODBC driver for now and hope issue will magically resolve itself when we push it to live environment (hosted by third party). Very crappy assumption to make, but at this point I see no other options....
I had the same exact issue and found that the root of the problem comes from the orai18n.jar. once i removed this from my classpath, the issue went away.
I have the same problem. I do not have access to the driver that is used because the connection is taken from a Weblogic server using JNDI. I cannot remove any .jar from the server neither.
The workaround I found :
String value = new String(resultset.getBytes());
Make sure you use the right encoding if required :
String value = new String(resultset.getBytes(), [CHARSET])
I had this same issue with eclise GCJ ( Stock centos6 ) and mysql-connector with the same concatenated queries. The problem was solved with reverting back to openJDK.
I had the same issue. "getInt()" would return correct value from Oracle 9i DB, but using "getString()" would result into empty string, no matter how many times i ran, within eclipse or outside on seperate Tomcat or other servers.
After going through a lot of various threads, and quite a few trials, I came to the conclusion that the issue is with the version of ojdbc6.jar that I was using. Earlier, I was using ojdbc6.jar with Oracle version 12.1.0.1., which is not so good for connecting to OLD Oracle 9i DB. After realising, I switched on to ojdbc6.jar from Oracle 11.2.0.3 and it worked like a charm.
Hope it helps. cheers!

Resources