Picking up from http://awgjournal.blogspot.com/2017/04/testing-wtc-endpoint.html where I successfully set up the samples to connect from a local Tuxedo to the TOLOWER ejb service, I now wanted to unit test the ToLower EJB via another WebLogic instance as described at https://community.oracle.com/thread/817839?db=5 This is so that I can test using a Java client as opposed to a C++ Tuxedo client.
I made a copy of C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpapp as C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpappwl2wl
Then went in and made changes:
1) change files to point the ToLower remote service rather than the ToUpper
2) change paths to point to a different instance -- a WebLogic 11G instance instead of the 12C instance that's hosting the ToLower service.
3) remove references to Tuxedo since this client app will not use it
The diffs are at https://gist.github.com/awgtek/fa6241219b085799574cf3d4f80ea3e9
I changed to and ran
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpappwl2wl>setExamplesEnv.cmd
> ant ejb
I needed to install the EJB jar from the console because autodeploy didn't pick it up from C:\Oracle\Middleware\user_projects\domains\base_domain\autodeploy.
> ant compile.client
Then I set up the WTC access points. I had already started the WL 11G server from eclipse. I loaded http://localhost:7003/console/ created a new WTC Server. Created a local access point: Access Point Name: LocalAccessPoint-0 Access Point ID: TDOM3 network address: //192.168.56.1:5671
created a remote access point: Access Point: RemoteAccessPoint-0 Access Point ID: TDOM2 Local access Point: LocalAccessPoint-0 network Address: //192.168.56.1:5678 (which is the TDOM2 acess point configured on the 12C server).
Created an Imported resource: TOLOWER Local access Point: LocalAccessPoint-0 Remote Access Point List: RemoteAccessPoint-0 (remote name: blank)
Then on the WebLogic 12C server localhost:7001/console, I added another remote access point: Access Point: RemoteAccessPoint-0 Access Point ID: TDOM3 local access point: MyLclAccessPt network address: //192.168.56.1:5671 (192.168.56.1 is a localhost virtual IP)
Then I added the TDOM3 local access point name of the other server as a user just as I had added the TDOM1 Tuxedo domain name as a user under Security Realms, Users and Groups, assigning it the administrators group.
back in the command prompt:
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\exampl
es\wtc\atmi\simpappwl2wl>ant simpapp
Buildfile: build.xml
simpapp:
run_client:
[java]
[java] Beginning statefulSession.Client...
[java]
[java] Creating Toupper
[java]
[java] converting HelloWorld
[java] converted to: helloworld
[java]
[java] End statefulSession.Client...
[java]
BUILD SUCCESSFUL
Total time: 4 seconds
And Eclipse outputted in the console:
tolower called, converting HelloWorld
About to call tpcall
tpcall successfull!
Sunday, April 9, 2017
Saturday, April 8, 2017
Testing WTC Endpoint
Following samples in https://docs.oracle.com/middleware/1212/wls/WTCCF/samples.htm#WTCCF300 to gain an understanding of what's required.
Downloaded wtc_90.jar and extracted wtc folder to C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples
(note: needed to quickstart again to install the samples to wlserver. Should have selected "with samples" when initially installing WebLogic).
Started weblogic 12.2.1.1 via eclipse (with Oracle WebLogic Server Tools but could have also used oepe eclipse download from Oracle) server config with domain home set to C:\Oracle\12c\Middleware\Oracle_Home\user_projects\domains\wl_server.
Downloaded Tuxedo and updated C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\samples\atmi\simpapp\setenv.cmd to be:
set TUXDIR=C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010
rem set WSNADDR=<address of the server; only if this is a workstation client>
set APPDIR=C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\samples\atmi\simpapp
set PATH=%TUXDIR%\bin;%APPDIR%;%PATH%
set TUXCONFIG=%APPDIR%\tuxconfig
change to and ran C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\setExamplesEnv.cmd
changed to C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpserv
ran ant. got error: C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpserv\build.xml:6: java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
Updated C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples.properties replacing \ with / for properties examples.home.dir and examples.domain.dir.
ran ant got error:
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpserv\build.xml:129: Problem: failed to create task or type wlappc
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
Inserted a task def above the appc target - at line 124:
<property name="wls_root" value="C:/Oracle/12c/Middleware/Oracle_Home" />
<property name="wls_home" value="${wls_root}/wlserver" />
<path id="wls.classpath">
<fileset dir="${wls_home}/modules">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="wlappc" classpathref="wls.classpath" classname="weblogic.ant.taskdefs.j2ee.Appc"/>
Ran ant.
This time it got pas the deploy task and failed at the buildclient.
opened http://localhost:7001/console/ and clicked deployments. There were four pages of sample deploymets. Went to last page and verified that wtc_tolower was deployed.
The fail messages was:
compile.client:
[copy] Copying 4 files to C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\sampl
es\wtc\simpserv
[exec] 'cl' is not recognized as an internal or external command,
[exec] operable program or batch file.
[exec] NLS:4: Cannot open message catalog TUXNT_CAT, set 1, num 77; check T
UXDIR=C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010, LANG=English_United States.12
52
BUILD FAILED
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\exampl
es\wtc\atmi\simpserv\build.xml:153: exec returned: 1
Installed Visual Studio 2007 Community selecting C++ options, then ran "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
Ran ant. Build Successful.
in simpserv, modified both CreateWTCResources.py and DeleteWTCResources.py to have:
servermb=getMBean("Servers/AdminServer")
Downloaded wtc_90.jar and extracted wtc folder to C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples
(note: needed to quickstart again to install the samples to wlserver. Should have selected "with samples" when initially installing WebLogic).
Started weblogic 12.2.1.1 via eclipse (with Oracle WebLogic Server Tools but could have also used oepe eclipse download from Oracle) server config with domain home set to C:\Oracle\12c\Middleware\Oracle_Home\user_projects\domains\wl_server.
Downloaded Tuxedo and updated C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\samples\atmi\simpapp\setenv.cmd to be:
set TUXDIR=C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010
rem set WSNADDR=<address of the server; only if this is a workstation client>
set APPDIR=C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\samples\atmi\simpapp
set PATH=%TUXDIR%\bin;%APPDIR%;%PATH%
set TUXCONFIG=%APPDIR%\tuxconfig
Opened command window to C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\samples\atmi\simpapp\.
Ran setenv.cmd.change to and ran C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\setExamplesEnv.cmd
changed to C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpserv
ran ant. got error: C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpserv\build.xml:6: java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
Updated C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples.properties replacing \ with / for properties examples.home.dir and examples.domain.dir.
ran ant got error:
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpserv\build.xml:129: Problem: failed to create task or type wlappc
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
Inserted a task def above the appc target - at line 124:
<property name="wls_root" value="C:/Oracle/12c/Middleware/Oracle_Home" />
<property name="wls_home" value="${wls_root}/wlserver" />
<path id="wls.classpath">
<fileset dir="${wls_home}/modules">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="wlappc" classpathref="wls.classpath" classname="weblogic.ant.taskdefs.j2ee.Appc"/>
This time it got pas the deploy task and failed at the buildclient.
opened http://localhost:7001/console/ and clicked deployments. There were four pages of sample deploymets. Went to last page and verified that wtc_tolower was deployed.
The fail messages was:
compile.client:
[copy] Copying 4 files to C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\sampl
es\wtc\simpserv
[exec] 'cl' is not recognized as an internal or external command,
[exec] operable program or batch file.
[exec] NLS:4: Cannot open message catalog TUXNT_CAT, set 1, num 77; check T
UXDIR=C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010, LANG=English_United States.12
52
BUILD FAILED
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\exampl
es\wtc\atmi\simpserv\build.xml:153: exec returned: 1
Installed Visual Studio 2007 Community selecting C++ options, then ran "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
Ran ant. Build Successful.
in simpserv, modified both CreateWTCResources.py and DeleteWTCResources.py to have:
servermb=getMBean("Servers/AdminServer")
where "AdminServer" is what's matched in the Targets dropdown for WTC Servers.
changed the port from 1234 to 5679 in build-run.xml
Then ran ant wtcmbeans
Verified the WTC Servers and TDOM1 user was created.
At this point I installed a new Tuxedo and updated its setenv.bat.
copied the dom1config.template to C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp\dom2config and modified it setting:
DMTLOGDEV="C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp\tlog"
...and
TDOM1 NWADDR="//192.168.56.1:5679"
TDOM2 NWADDR="//192.168.56.1:5678"
copied simpserv\tuxfiles\ubbdomain.template to C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp\ubbmydomain and modified:
replaced "@HOST@" with the hostname of my machine with it being uppercase!
updated vars:
APPDIR = "C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp"
TUXCONFIG = "C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp\tuxconfig"
TUXDIR = "C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015"
copied tolower.c from tuxfiles to C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp
opened a Developer Command Prompt for VS 2017 and changed to C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp
ran:
setenv.cmd
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
tmloadcf -y ubbmydomain
dmloadcf -y dom2config
buildclient -f tolower.c o tolower
tmboot -y
verified that port 5679 was opened and listening now in tcpview
ran
tolower.exe ALLSMALL
got back "Returned string is: allsmall"
Saturday, April 2, 2016
API query for stock quote
stripped down to select columns: https://query.yahooapis.com/v1/public/yql?q=select Bid,Symbol from yahoo.finance.quotes where symbol in ("GLD,VTI")&format=json&env=store://datatables.org/alltableswithkeys&callback=
Other columns are Ask, Volume, or * to get all columns.
Sample ways to query with JAX-RS and GSON: http://www.skbh.in/restful-webservices/consuming-restful-web-services-with-the-jersey-client-api/
Other columns are Ask, Volume, or * to get all columns.
Sample ways to query with JAX-RS and GSON: http://www.skbh.in/restful-webservices/consuming-restful-web-services-with-the-jersey-client-api/
Tuesday, March 29, 2016
AWS EC2, RoR, ruby...
Created an Ubuntu EC2 instance, then followed https://gorails.com/setup/ubuntu/14.04 to install and setup ruby on rails.
Also, https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres
for the postgres setup:
in config/database.yml set:
production:
<<: *default
database: myrailsapp_production
username: <linux user account here, also create user with same user name in postgres db for "create role" command>
password: <db password from "create role" command>
Added a security group "custom tcp rule" to permit port 3000 inbound. Wasn't getting a response from ruby on rails after running 'rails server'. netstat -tulpn showed it was listening on 127.0.0.1. To make listen on all ports followed https://fullstacknotes.com/make-rails-4-2-listen-to-all-interface/ , i.e. do instead: rails server -b 0.0.0.0
should try this later.
Also, https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres
for the postgres setup:
in config/database.yml set:
production:
<<: *default
database: myrailsapp_production
username: <linux user account here, also create user with same user name in postgres db for "create role" command>
password: <db password from "create role" command>
should try this later.
Sunday, March 6, 2016
Hadoop, Avro experimentation
Followed http://hadooptutorial.info/avro-mapreduce-word-count-example/ but caution: I need to set the javac CLASSPATH instead to
export CLASSPATH="$HADOOP_HOME/share/hadoop/tools/lib/*"
export CLASSPATH="$HADOOP_HOME/share/hadoop/mapreduce/*:$CLASSPATH"
export CLASSPATH="$HADOOP_HOME/share/hadoop/tools/lib/*"
export CLASSPATH="$HADOOP_HOME/share/hadoop/mapreduce/*:$CLASSPATH"
when I used the jar command it failed at first. This post helped to get it into alternatives: http://johnglotzer.blogspot.in/2012/09/alternatives-install-gets-stuck-failed.html
Used hadoop fs -put command to put the test.txt file onto the hadoop filesystem per http://hortonworks.com/hadoop-tutorial/using-commandline-manage-files-hdfs/
when running the MapReduceAvroWordCount application get errors similar to as described http://stackoverflow.com/questions/20586920/hadoop-connecting-to-resourcemanager-failed
Added yarn.resourcemanager.address per answer.
jps command (see http://stackoverflow.com/questions/11738070/hadoop-cannot-use-jps-command) says hadoop services appear to be running.
this time didn't get same error, but job seems stuck.
issue stop-all.sh and modifying hadoop config files to match single-node installation.
tests under single-node Testing section gave same error as before: INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032.
Reinstalling to local user dir per alexjf blog.
Still attempts to connect to 0.0.0.0/0.0.0.0:8032
Reinstall Fedora, and set static ip address, Install JdK per http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/
enable ssh per https://docs.fedoraproject.org/en-US/Fedora/16/html/System_Administrators_Guide/s2-ssh-configuration-sshd.html
tried tests got error this time
Attempt to disable ipv6 using http://www.itsprite.com/linuxhow-to-disable-ipv6-networking-on-redhatcentosfedoraubuntu-linux-system/ but resulted in OS instability. Forced reboot.
could not login.
try reinstall OS.
install jdk, enable ssh. Tried enabling passwordless ssh per http://allthingshadoop.com/2010/04/20/hadoop-cluster-setup-ssh-key-authentication/
but would not work.
tried the hadoop installation and test from alexjf blog. It failed the test, pulling up the url, shows memory limit exceeded as cause of failure.
removed all settings from yarn-site.xml and stopped restarted using $HADOOP_PREFIX/sbin/stop-yarn.sh stop-dfs.sh start etc. but got seeming infinite running.
used https://coderwall.com/p/a5kbtw/installing-apache-hadoop-on-linux first set of instructions to enable passwordless ssh.
restart hadoop services and didn't ask for password this time. test still fails.
modified command set --num_containers 1 --master_memory 512 and says completed successfully.
Trying on a Mac now per http://amodernstory.com/2014/09/23/installing-hadoop-on-mac-osx-yosemite/ works.
Back on Fedora setup; retried MapReduceAvroWordCount and it worked. Next try writing schema based on Java class: https://gist.github.com/QwertyManiac/4724582. How to convert schema to json representation (avsc file?) and use that instead of java class?
Back on Fedora setup; retried MapReduceAvroWordCount and it worked. Next try writing schema based on Java class: https://gist.github.com/QwertyManiac/4724582. How to convert schema to json representation (avsc file?) and use that instead of java class?
Monday, January 18, 2016
Setting up Authentication
Had an opendj installed on a Debian64 machine, just needed to reset the password for cn=Directory Manager
Followed http://allidm.com/blog/2012/09/change-password-for-directory-manager-in-forgerock-opendj/ just make sure when you copy into vi you ensure to delete the trailing white space heh.
Then I could run /opt/opendj/bin/status and enter the credentials successfully.
Tested connecting with Ldap admin using cn=Directory Manager
Connected. To set a user password under ou=Users, right click set Password, chose plain text and enter the password. Right click user again and select "copy dn to clipboard." Open another instance of the LDAP Admin tool, new connection, enter the IP and paste the dn of the user, enter the password, and verify with test connection.
In Java project create test class to connect following http://www.codejava.net/coding/connecting-to-ldap-server-using-jndi-in-java
Test same using and verify connected using dn and "simple" for the java.naming.security.authentication.
Installed MySQL and created a database and user on the Debian Wheezy VM per https://www.rackspace.com/knowledge_center/article/installing-mysql-server-on-debian
Following http://people.cis.ksu.edu/~hankley/d764/tut07/Nigusse_Spring.pdf now to populate a user info object from session. Get right maven dependencies from http://www.mkyong.com/spring/maven-spring-jdbc-example/ and http://examples.javacodegeeks.com/enterprise-java/spring/jdbc/spring-jdbctemplate-example/
Modify my.cnf to set bind-address to static ip. then /etc/init.d/mysql restart
Followed http://allidm.com/blog/2012/09/change-password-for-directory-manager-in-forgerock-opendj/ just make sure when you copy into vi you ensure to delete the trailing white space heh.
Then I could run /opt/opendj/bin/status and enter the credentials successfully.
Tested connecting with Ldap admin using cn=Directory Manager
Connected. To set a user password under ou=Users, right click set Password, chose plain text and enter the password. Right click user again and select "copy dn to clipboard." Open another instance of the LDAP Admin tool, new connection, enter the IP and paste the dn of the user, enter the password, and verify with test connection.
In Java project create test class to connect following http://www.codejava.net/coding/connecting-to-ldap-server-using-jndi-in-java
Test same using and verify connected using dn and "simple" for the java.naming.security.authentication.
Installed MySQL and created a database and user on the Debian Wheezy VM per https://www.rackspace.com/knowledge_center/article/installing-mysql-server-on-debian
Following http://people.cis.ksu.edu/~hankley/d764/tut07/Nigusse_Spring.pdf now to populate a user info object from session. Get right maven dependencies from http://www.mkyong.com/spring/maven-spring-jdbc-example/ and http://examples.javacodegeeks.com/enterprise-java/spring/jdbc/spring-jdbctemplate-example/
Modify my.cnf to set bind-address to static ip. then /etc/init.d/mysql restart
Wednesday, December 30, 2015
SharePoint Emails
Send email per https://www.collaboris.com/blogs/collaboris-blog/mark-jones/2012/11/06/code-sample-how-to-programmatically-send-an-email-in-sharepoint#.VoH5A_krLak or using straight smtpclient per http://sharepoint.stackexchange.com/questions/98192/issue-when-setting-from-in-the-sputility-sendemail. In the end used this: http://www.sharepointbriefing.com/spcode/article.php/3840566/How-To-Send-Email-with-SPUtility.htm slightly modified:
private static Boolean SendEmail(SPWeb web, string email, string subject, string body)
{
try
{
bool flag = false;
SPSecurity.RunWithElevatedPrivileges(
delegate ()
{
flag = SPUtility.SendEmail(web, true, true,
email,
subject,
body);
});
return flag;
}
catch (System.Exception exp)
{
// Do some error logging
return false;
}
}
private static Boolean SendEmail(SPWeb web, string email, string subject, string body)
{
try
{
bool flag = false;
SPSecurity.RunWithElevatedPrivileges(
delegate ()
{
flag = SPUtility.SendEmail(web, true, true,
email,
subject,
body);
});
return flag;
}
catch (System.Exception exp)
{
// Do some error logging
return false;
}
}
Subscribe to:
Posts (Atom)