转到正文

宁静海

发现,理解,提升

存档

2014 年 12 月 的存档

 There are 2 ways to create datasource offline. The reason to create datasource offline, basically because we want to create those datasource durning create new domain. So that we don’t need to boot up domain before create datasource in online mode.

We offen can google the result to create datasource via WLST offline like following.

 

print 'create wlsbjmsrpDataSource'
create('wlsbjmsrpDataSource', 'JDBCSystemResource')
cd('/JDBCSystemResource/wlsbjmsrpDataSource')
set('Target','AdminServer,osb_server1')
 
cd('/JDBCSystemResource/wlsbjmsrpDataSource/JdbcResource/wlsbjmsrpDataSource')
cmo.setName('wlsbjmsrpDataSource')
 
print 'create JDBCDataSourceParams'
cd('/JDBCSystemResource/wlsbjmsrpDataSource/JdbcResource/wlsbjmsrpDataSource')
create('myJdbcDataSourceParams','JDBCDataSourceParams')
cd('JDBCDataSourceParams/NO_NAME_0')
set('JNDIName', java.lang.String('wlsbjmsrpDataSource'))
set('GlobalTransactionsProtocol', java.lang.String('None'))
 
print 'create JDBCDriverParams'
cd('/JDBCSystemResource/wlsbjmsrpDataSource/JdbcResource/wlsbjmsrpDataSource')
create('myJdbcDriverParams','JDBCDriverParams')
cd('JDBCDriverParams/NO_NAME_0')
set('DriverName','oracle.jdbc.OracleDriver')
set('URL','jdbc:oracle:thin:@wintermute:1521:mysid')
set('PasswordEncrypted', 'manager')
set('UseXADataSourceInterface', 'false')
 
print 'create JDBCDriverParams Properties'
create('myProperties','Properties')
cd('Properties/NO_NAME_0')
create('user','Property')
cd('Property')
cd('user')
set('Value', 'scott')
 
print 'create JDBCConnectionPoolParams'
cd('/JDBCSystemResource/wlsbjmsrpDataSource/JdbcResource/wlsbjmsrpDataSource')
create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams')
cd('JDBCConnectionPoolParams/NO_NAME_0')
set('TestTableName','SQL SELECT 1 FROM DUAL')

 

The refference: 

http://theheat.dk/blog/?p=565

But above code sample missing very important part, which would cause problems if you directly copy to use.

Check here:

 

cd('/JDBCSystemResource/wlsbjmsrpDataSource')
set('Target','AdminServer,osb_server1')

 

We know that each of datasource in weblogic require to assign a target, so that the datasource would be working.

But above code would be not working if you want to create datasource directly during using "readTemplate" to load default template to create your domain.

For example:

When you using the codes in first block to create datasource in WLST offline mode. You would write something like this:

 

readTemplate(templateDir)

#codes from first block create datasouce...

writeDomain(domainDir)
exit()

 

But if you using above code to create the datasource. The target cannot be assigned. Not sure the reason. To make it working you need to change as follows:

 

readTemplate(templateDir)

#Codes from block1 to create datasource offline

writeDomain(domainDir)  # This is very important, you need to create domain first

closeTemplate()

readDomain(domainDir)

cd('/JDBCSystemResource/'+dsName)
set('Targets',target)   #Notice, here set is "Targets" not "Target"

 

The basic idea to make it working is to create the datasource on the fly, but set the target after domain generated on the disk.

Of course, you can also create datasource after domain generated. 

But if you still insist on creating everything in one shot.

Try use another WLST function assign.

Refference:

http://docs.oracle.com/cd/E13222_01/wls/docs92/config_scripting/domains.html#wp1013450

 

readTemplate(templateDir)

# create datasource

cd('/')
assign('JDBCSystemResource', dsName, 'Target', target)

writeDomain(domainDir)
closeDomain()

 

Please note, the propertie we set here is "Target" not "Targets".

This artical just for a note for my refference in the future.

起因:

公司因为设置了外网的proxy,eclipse必须设置Proxy来访问一些plug-in的update site或者marketplace,但总是不稳定,常常刚开始能访问,但是突然又不能,也不是被端口禁用或者别的原因,因为报错的那些站点浏览器都能正常访问。 今天花了整整半天时间来想要彻底解决这个问题。

结果:

这是一个长达4年的Bug,从未被修复。但有work around的方法能解决。

Reference:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=364992#c5

https://bugs.eclipse.org/bugs/show_bug.cgi?id=281472

解决方法:

ht

-Djavax.net.ssl.trustStore 
-Dhttps.protocols=SSLv3 
-Djsse.enableSNIExtension=false //This is for JDK 7 SNI support, but need to be disabled.
-Djavax.net.debug=ssl
-Dweblogic.security.SSL.protocolVersion=SSL3
-Dweblogic.security.SSL.ignoreHostnameVerification=true

 

Reference

http://stackoverflow.com/questions/5507878/ssl-connection-reset

http://stackoverflow.com/questions/10188568/sslexception-during-handshake-while-resuming-cached-session

http://stackoverflow.com/questions/7615645/ssl-handshake-alert-unrecognized-name-error-since-upgrade-to-java-1-7-0

 

一句话概括,JDK升级到1.7后对于SSL的支持各种坑。