Pokazywanie postów oznaczonych etykietą interoperability. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą interoperability. Pokaż wszystkie posty
czwartek, marca 31, 2016
Ubuntu na Windows
Microsoft w Windows 10 dodaje Windows Subsystem for Unix Linux. Polega to na natywnym czytaniu formatu plików wykonywalnych ELF oraz implementacji wywołań systemowych Linuksa. Podsystem linuksowy może używać zwykłych paczek Ubuntu na AMD64. Plusy? Dewelopment zbliżony do LAMP będzie można robić docelowo bez różnicy na systemach Linux i Windows oraz deployować bez różnicy na jednym z dwóch systemów w chmurze. Hostile takeover? Po Microsofcie można spodziewać się wszystkiego.
czwartek, maja 14, 2015
org.xml.sax.SAXException: validation error: xsi:type "null" is not validly derived from the allowed type definition - how to communicate with SalesForce from Tibco BW
WSDL defining base object and extensions and using base object with xsi:type in definitions of 'generic' operations is not compliant with standards. Let's try to do some workaround in WSDL:
1. Define on base object. Please not that name "xsi:type" is also not compliant but works in BW.
2. Change type of element in operation definition from base type to xsd:anyType.
and in BW:
3. Create mapper with derived object. Fill it. Inside @type put 'distinguishedNamespacePrefix:TypeName'. Please note that after this attribute BW will need to add empty @xsi:type - do not fill it, this is going to work this way.
4. In process 'Namespace Registry' redefine namespace of derived object using prefix name changed to 'distinguishedNamespacePrefix'. This ensures that our @xsi:type value will have valid namespace prefix.
5. On mapper top level input and also on SOAP call activity click exclamation mark 'Edit Statement'. Check 'Exclude result prefixes'. This in runtime moves all namespace definitions to the XML root. This makes our @xsi:type working due to the fact that xsi is visible from the top to bottom of the XML teee.
6. In SOAP call input mapping use 'Copy-Contents-Of' of derivative object.
Quick note about project validation: Error 'Syntactic error in data: /schema/complexType/attribute/@name: data "xsi:type" is not a valid NCName. A valid example is "_NCname.has-no_colons".' is legitimate and looks bad, but hey - we avoided writing proxy or buying SalesForce adapter!
1. Define
2. Change type of element in operation definition from base type to xsd:anyType.
and in BW:
3. Create mapper with derived object. Fill it. Inside @type put 'distinguishedNamespacePrefix:TypeName'. Please note that after this attribute BW will need to add empty @xsi:type - do not fill it, this is going to work this way.
4. In process 'Namespace Registry' redefine namespace of derived object using prefix name changed to 'distinguishedNamespacePrefix'. This ensures that our @xsi:type value will have valid namespace prefix.
5. On mapper top level input and also on SOAP call activity click exclamation mark 'Edit Statement'. Check 'Exclude result prefixes'. This in runtime moves all namespace definitions to the XML root. This makes our @xsi:type working due to the fact that xsi is visible from the top to bottom of the XML teee.
6. In SOAP call input mapping use 'Copy-Contents-Of' of derivative object.
Quick note about project validation: Error 'Syntactic error in data: /schema/complexType/attribute/@name: data "xsi:type" is not a valid NCName. A valid example is "_NCname.has-no_colons".' is legitimate and looks bad, but hey - we avoided writing proxy or buying SalesForce adapter!
czwartek, stycznia 15, 2015
How to add support for StartTls in Spring LDAP
import com.sun.jndi.ldap.LdapClient;
public class Binding extends LdapContextSource {
private SearchControls sc = new SearchControls();
private String base = null;
private static boolean requireServerCertInTrustedStore = false;
private static boolean traceAttributesModification = !true;
private boolean useStartTlsAuth = false;
private final static String[] CLEAR_PARAMS_FOR_STARTTLS = { ".security",
"java.naming.ldap.factory.socket", "com.sun.jndi.ldap.connect.pool"
};
private Hashtable<String,Object> prepareParamsForStartTls(@SuppressWarnings("rawtypes") Hashtable env) {
Hashtable<String,Object> props = new Hashtable<String, Object>();
for (Object k : env.keySet()) {
String key = k.toString();
int hitCount = 0;
for (int i = 0; i < CLEAR_PARAMS_FOR_STARTTLS.length; i++) {
if (key.contains(CLEAR_PARAMS_FOR_STARTTLS[i])) {
hitCount++;
break;
}
}
if (hitCount == 0)
props.put(key, env.get(key));
}
props.put("java.naming.ldap.version", "3");
props.put(Context.SECURITY_PROTOCOL, "plain");
return props;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected DirContext getDirContextInstance(Hashtable env)
throws NamingException {
Hashtable<String,Object> params = prepareParamsForStartTls(env); /* strip pooling and security */
params.put("java.naming.ldap.attributes.binary", "objectSid objectGUID");
final LdapContext ctx = (LdapContext) NamingManager.getInitialContext(params);
StartTlsResponse tlsResp = null;
if (useStartTlsAuth) {
tlsResp = (StartTlsResponse) ctx.extendedOperation(new StartTlsRequest());
tlsResp.setHostnameVerifier(TolerantSSLSocketFactory.TOLERANT_HOSTNAME_VERIFIER);
try {
tlsResp.negotiate(TolerantSSLSocketFactory.INSTANCE);
}
catch (Throwable t) {
throw new NamingException("SSL negotiation for LDAP StartTLS failed: "+t);
}
}
ctx.getEnvironment().putAll(env); /* do not use addToEnvironment because it would reconnect without StartTls */
try {
Field fClient = ctx.getClass().getDeclaredField("clnt");
fClient.setAccessible(true);
LdapClient cli = (LdapClient) fClient.get(ctx);
/* We are over secure channel, need to authenticate now */
Method mAuthenticate = cli.getClass().getDeclaredMethod("authenticate", new Class[] {
boolean.class, String.class, Object.class, int.class, String.class, Control[].class, Hashtable.class
});
mAuthenticate.setAccessible(true);
mAuthenticate.invoke(cli, false, env.get(Context.SECURITY_PRINCIPAL).toString(),
env.get(Context.SECURITY_CREDENTIALS), 3, "simple", null, env);
}
catch (Exception e) {
Throwable t = e;
while (t.getCause() != null)
t = t.getCause();
throw new NamingException("Cannot authenticate due to error: "+t.getMessage());
}
return new InitialLdapContext(env, null) {
@Override
protected Context getDefaultInitCtx() throws NamingException {
/* cache context */
return ctx;
}
};
}
public static boolean isRequiredServerCertInTrustedStore() {
return requireServerCertInTrustedStore;
}
public static void setRequireServerCertInTrustedStore(
boolean requireServerCertInTrustedStore) {
Binding.requireServerCertInTrustedStore = requireServerCertInTrustedStore;
}
public static void setTraceAttributesModification(
boolean traceAttributesModification) {
Binding.traceAttributesModification = traceAttributesModification;
}
public static boolean getTraceAttributesModification() {
return traceAttributesModification;
}
public Binding(String userLogin, String userPassword, String serverUrl, String searchBase) throws Exception {
useStartTlsAuth = serverUrl.startsWith("ldap(s)");
if (useStartTlsAuth) {
serverUrl = "ldap"+serverUrl.substring(7);
setPooled(false);
}
setUserDn(userLogin);
setPassword(userPassword);
setBase(searchBase);
setReferral("follow");
setUrl(serverUrl);
setPooled(true);
HashMap<String,String> props = new HashMap<String, String>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
props.put(Context.SECURITY_AUTHENTICATION, "none");
props.put(Context.SECURITY_AUTHENTICATION, "simple");
props.put(Context.SECURITY_CREDENTIALS, userLogin);
props.put(Context.SECURITY_PRINCIPAL, userPassword);
if (!requireServerCertInTrustedStore) {
props.put("java.naming.ldap.factory.socket", TolerantSSLSocketFactory.class.getName());
}
setCacheEnvironmentProperties(true);
setBaseEnvironmentProperties(props);
setAuthenticationStrategy(new SimpleDirContextAuthenticationStrategy());
afterPropertiesSet();
sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
sc.setCountLimit(0);
sc.setReturningAttributes(null);
sc.setReturningObjFlag(true);
}
public SearchControls getSearchControls() {
return sc;
}
public String getSearchBase() {
return this.base != null ? base : "";
}
}
public class Binding extends LdapContextSource {
private SearchControls sc = new SearchControls();
private String base = null;
private static boolean requireServerCertInTrustedStore = false;
private static boolean traceAttributesModification = !true;
private boolean useStartTlsAuth = false;
private final static String[] CLEAR_PARAMS_FOR_STARTTLS = { ".security",
"java.naming.ldap.factory.socket", "com.sun.jndi.ldap.connect.pool"
};
private Hashtable<String,Object> prepareParamsForStartTls(@SuppressWarnings("rawtypes") Hashtable env) {
Hashtable<String,Object> props = new Hashtable<String, Object>();
for (Object k : env.keySet()) {
String key = k.toString();
int hitCount = 0;
for (int i = 0; i < CLEAR_PARAMS_FOR_STARTTLS.length; i++) {
if (key.contains(CLEAR_PARAMS_FOR_STARTTLS[i])) {
hitCount++;
break;
}
}
if (hitCount == 0)
props.put(key, env.get(key));
}
props.put("java.naming.ldap.version", "3");
props.put(Context.SECURITY_PROTOCOL, "plain");
return props;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected DirContext getDirContextInstance(Hashtable env)
throws NamingException {
Hashtable<String,Object> params = prepareParamsForStartTls(env); /* strip pooling and security */
params.put("java.naming.ldap.attributes.binary", "objectSid objectGUID");
final LdapContext ctx = (LdapContext) NamingManager.getInitialContext(params);
StartTlsResponse tlsResp = null;
if (useStartTlsAuth) {
tlsResp = (StartTlsResponse) ctx.extendedOperation(new StartTlsRequest());
tlsResp.setHostnameVerifier(TolerantSSLSocketFactory.TOLERANT_HOSTNAME_VERIFIER);
try {
tlsResp.negotiate(TolerantSSLSocketFactory.INSTANCE);
}
catch (Throwable t) {
throw new NamingException("SSL negotiation for LDAP StartTLS failed: "+t);
}
}
ctx.getEnvironment().putAll(env); /* do not use addToEnvironment because it would reconnect without StartTls */
try {
Field fClient = ctx.getClass().getDeclaredField("clnt");
fClient.setAccessible(true);
LdapClient cli = (LdapClient) fClient.get(ctx);
/* We are over secure channel, need to authenticate now */
Method mAuthenticate = cli.getClass().getDeclaredMethod("authenticate", new Class[] {
boolean.class, String.class, Object.class, int.class, String.class, Control[].class, Hashtable.class
});
mAuthenticate.setAccessible(true);
mAuthenticate.invoke(cli, false, env.get(Context.SECURITY_PRINCIPAL).toString(),
env.get(Context.SECURITY_CREDENTIALS), 3, "simple", null, env);
}
catch (Exception e) {
Throwable t = e;
while (t.getCause() != null)
t = t.getCause();
throw new NamingException("Cannot authenticate due to error: "+t.getMessage());
}
return new InitialLdapContext(env, null) {
@Override
protected Context getDefaultInitCtx() throws NamingException {
/* cache context */
return ctx;
}
};
}
public static boolean isRequiredServerCertInTrustedStore() {
return requireServerCertInTrustedStore;
}
public static void setRequireServerCertInTrustedStore(
boolean requireServerCertInTrustedStore) {
Binding.requireServerCertInTrustedStore = requireServerCertInTrustedStore;
}
public static void setTraceAttributesModification(
boolean traceAttributesModification) {
Binding.traceAttributesModification = traceAttributesModification;
}
public static boolean getTraceAttributesModification() {
return traceAttributesModification;
}
public Binding(String userLogin, String userPassword, String serverUrl, String searchBase) throws Exception {
useStartTlsAuth = serverUrl.startsWith("ldap(s)");
if (useStartTlsAuth) {
serverUrl = "ldap"+serverUrl.substring(7);
setPooled(false);
}
setUserDn(userLogin);
setPassword(userPassword);
setBase(searchBase);
setReferral("follow");
setUrl(serverUrl);
setPooled(true);
HashMap<String,String> props = new HashMap<String, String>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
props.put(Context.SECURITY_AUTHENTICATION, "none");
props.put(Context.SECURITY_AUTHENTICATION, "simple");
props.put(Context.SECURITY_CREDENTIALS, userLogin);
props.put(Context.SECURITY_PRINCIPAL, userPassword);
if (!requireServerCertInTrustedStore) {
props.put("java.naming.ldap.factory.socket", TolerantSSLSocketFactory.class.getName());
}
setCacheEnvironmentProperties(true);
setBaseEnvironmentProperties(props);
setAuthenticationStrategy(new SimpleDirContextAuthenticationStrategy());
afterPropertiesSet();
sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
sc.setCountLimit(0);
sc.setReturningAttributes(null);
sc.setReturningObjFlag(true);
}
public SearchControls getSearchControls() {
return sc;
}
public String getSearchBase() {
return this.base != null ? base : "";
}
}
środa, marca 26, 2014
Run Apache Kafka on Windows
Install Cygwin and modify Unix script kafka-run-class.sh:
export KAFKA_HOME="/cygdrive/c/infrastructure/kafka_2.9.2-0.8.1"
base_dir=$KAFKA_HOME
CLASSPATH="."
...
if [ -z "$SCALA_VERSION" ]; then
SC_JAR=$(realpath `find $KAFKA_HOME/libs -name scala-library*.jar` --relative-to $KAFKA_HOME/libs)
SCALA_VERSION=$(echo $SC_JAR | cut -d- -f3 | sed -e 's/\.jar//')
echo "SCALA_VERSION is $SCALA_VERSION"
fi
...
# Log4j settings
if [ -z "$KAFKA_LOG4J_OPTS" ]; then
LOG4J_FILE=`cygpath -p -w $base_dir/config/tools-log4j.properties`
KAFKA_LOG4J_OPTS="-Dlog4j.configuration=$LOG4J_FILE"
fi
...
CLASSPATH=`cygpath -w -p $CLASSPATH`
echo "CLASSPATH is $CLASSPATH"
# Which java to use
if [ -z "$JAVA_HOME" ]; then
JAVA="java"
else
JAVA="$JAVA_HOME/bin/java"
fi
...
else
cmd /c $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@"
fi
export KAFKA_HOME="/cygdrive/c/infrastructure/kafka_2.9.2-0.8.1"
base_dir=$KAFKA_HOME
CLASSPATH="."
...
if [ -z "$SCALA_VERSION" ]; then
SC_JAR=$(realpath `find $KAFKA_HOME/libs -name scala-library*.jar` --relative-to $KAFKA_HOME/libs)
SCALA_VERSION=$(echo $SC_JAR | cut -d- -f3 | sed -e 's/\.jar//')
echo "SCALA_VERSION is $SCALA_VERSION"
fi
...
# Log4j settings
if [ -z "$KAFKA_LOG4J_OPTS" ]; then
LOG4J_FILE=`cygpath -p -w $base_dir/config/tools-log4j.properties`
KAFKA_LOG4J_OPTS="-Dlog4j.configuration=$LOG4J_FILE"
fi
...
CLASSPATH=`cygpath -w -p $CLASSPATH`
echo "CLASSPATH is $CLASSPATH"
# Which java to use
if [ -z "$JAVA_HOME" ]; then
JAVA="java"
else
JAVA="$JAVA_HOME/bin/java"
fi
...
else
cmd /c $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@"
fi
środa, sierpnia 28, 2013
Tracing Oracle connectivity problem (connection timed out on socket)
tcpdump -nnvvXS host oracle-db-prd
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
11:33:13.433097 IP (tos 0x0, ttl 64, id 36655, offset 0, flags [DF], proto TCP (6), length 60)
192.168.100.3.36283 > 192.168.1.10.1521: Flags [S], cksum 0x7cab (correct), seq 3238343368, win 14600, options [mss 1460,sackOK,TS val 678084071 ecr 0,nop,wscale 7], length 0
0x0000: 4500 003c 8f2f 4000 4006 870c 0af3 025e E..<./@.@......^
0x0010: 0acb 0c65 8dbb 05f1 c105 32c8 0000 0000 ...e......2.....
0x0020: a002 3908 7cab 0000 0204 05b4 0402 080a ..9.|...........
0x0030: 286a bde7 0000 0000 0103 0307 (j..........
11:33:13.434046 IP (tos 0x0, ttl 63, id 0, offset 0, flags [DF], proto TCP (6), length 52)
192.168.1.10.1521 > 192.168.100.3.36283: Flags [S.], cksum 0xacc3 (correct), seq 4037414683, ack 3238343369, win 5840, options [mss 1380,nop,nop,sackOK,nop,wscale 7], length 0
0x0000: 4500 0034 0000 4000 3f06 1744 0acb 0c65 E..4..@.?..D...e
0x0010: 0af3 025e 05f1 8dbb f0a6 0f1b c105 32c9 ...^..........2.
0x0020: 8012 16d0 acc3 0000 0204 0564 0101 0402 ...........d....
0x0030: 0103 0307 ....
11:33:13.434153 IP (tos 0x0, ttl 64, id 36656, offset 0, flags [DF], proto TCP (6), length 40)
192.168.100.3.36283 > 192.168.1.10.1521: Flags [.], cksum 0x03a3 (correct), seq 3238343369, ack 4037414684, win 115, length 0
0x0000: 4500 0028 8f30 4000 4006 871f 0af3 025e E..(.0@.@......^
0x0010: 0acb 0c65 8dbb 05f1 c105 32c9 f0a6 0f1c ...e......2.....
0x0020: 5010 0073 03a3 0000 P..s....
11:33:13.434506 IP (tos 0x0, ttl 64, id 36657, offset 0, flags [DF], proto TCP (6), length 321)
192.168.100.3.36283 > 192.168.1.10.1521: Flags [P.], cksum 0x25b4 (incorrect -> 0x00d9), seq 3238343369:3238343650, ack 4037414684, win 115, length 281
0x0000: 4500 0141 8f31 4000 4006 8605 0af3 025e E..A.1@.@......^
0x0010: 0acb 0c65 8dbb 05f1 c105 32c9 f0a6 0f1c ...e......2.....
0x0020: 5018 0073 25b4 0000 0119 0000 0100 0000 P..s%...........
0x0030: 0136 012c 0e41 2000 7fff 4f98 0000 0001 .6.,.A....O.....
0x0040: 00df 003a 0000 0000 8181 0000 0000 0000 ...:............
0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0060: 0000 2844 4553 4352 4950 5449 4f4e 3d28 ..(DESCRIPTION=(
0x0070: 4144 4452 4553 533d 2850 524f 544f 434f ADDRESS=(PROTOCO
0x0080: 4c3d 5443 5029 2848 4f53 543d 3130 2e32 L=TCP)(HOST=orac
0x0090: 3033 2e31 322e 3130 3129 2850 4f52 543d le-db-prd)(PORT=
0x00a0: 3135 3231 2929 2843 4f4e 4e45 4354 5f44 1521))(CONNECT_D
0x00b0: 4154 413d 2843 4944 3d28 5052 4f47 5241 ATA=(CID=(PROGRA
0x00c0: 4d3d 4a44 4243 2054 6869 6e20 436c 6965 M=JDBC.Thin.Clie
0x00d0: 6e74 2928 484f 5354 3d5f 5f6a 6462 635f nt)(HOST=__jdbc_
0x00e0: 5f29 2855 5345 523d 7469 6263 6f29 2928 _)(USER=tibco))(
0x00f0: 5345 5256 4943 455f 4e41 4d45 3d71 786c SERVICE_NAME=crm
0x0100: 6477 6829 2843 4944 3d28 5052 4f47 5241 001)(CID=(PROGRA
0x0110: 4d3d 4a44 4243 2054 6869 6e20 436c 6965 M=JDBC.Thin.Clie
0x0120: 6e74 2928 484f 5354 3d5f 5f6a 6462 635f nt)(HOST=__jdbc_
0x0130: 5f29 2855 5345 523d 7469 6263 6f29 2929 _)(USER=tibco)))
0x0140: 29 )
11:33:13.435530 IP (tos 0x0, ttl 63, id 15716, offset 0, flags [DF], proto TCP (6), length 40)
192.168.1.10.1521 > 192.168.100.3.36283: Flags [.], cksum 0x02c7 (correct), seq 4037414684, ack 3238343650, win 54, length 0
0x0000: 4500 0028 3d64 4000 3f06 d9eb 0acb 0c65 E..(=d@.?......e
0x0010: 0af3 025e 05f1 8dbb f0a6 0f1c c105 33e2 ...^..........3.
0x0020: 5010 0036 02c7 0000 0000 0000 0000 P..6..........
11:33:13.435660 IP (tos 0x0, ttl 63, id 15717, offset 0, flags [DF], proto TCP (6), length 117)
192.168.1.10.1521 > 192.168.100.3.36283: Flags [P.], cksum 0x8f72 (correct), seq 4037414684:4037414761, ack 3238343650, win 54, length 77
0x0000: 4500 0075 3d65 4000 3f06 d99d 0acb 0c65 E..u=e@.?......e
0x0010: 0af3 025e 05f1 8dbb f0a6 0f1c c105 33e2 ...^..........3.
0x0020: 5018 0036 8f72 0000 004d 0000 0500 0000 P..6.r...M......
0x0030: 0043 2844 4553 4352 4950 5449 4f4e 3d28 .C(DESCRIPTION=(
0x0040: 4144 4452 4553 533d 2850 524f 544f 434f ADDRESS=(PROTOCO
0x0050: 4c3d 5443 5029 2848 4f53 543d 3130 2e32 L=TCP)(HOST=orac
0x0060: 3033 2e31 322e 3429 2850 4f52 543d 3135 le-prd1)(PORT=15
0x0070: 3231 2929 29 21)))
11:33:13.435682 IP (tos 0x0, ttl 64, id 36658, offset 0, flags [DF], proto TCP (6), length 40)
192.168.100.3.36283 > 192.168.1.10.1521: Flags [.], cksum 0x023d (correct), seq 3238343650, ack 4037414761, win 115, length 0
0x0000: 4500 0028 8f32 4000 4006 871d 0af3 025e E..(.2@.@......^
0x0010: 0acb 0c65 8dbb 05f1 c105 33e2 f0a6 0f69 ...e......3....i
0x0020: 5010 0073 023d 0000 P..s.=..
11:33:13.435700 IP (tos 0x0, ttl 63, id 15718, offset 0, flags [DF], proto TCP (6), length 40)
192.168.1.10.1521 > 192.168.100.3.36283: Flags [F.], cksum 0x0279 (correct), seq 4037414761, ack 3238343650, win 54, length 0
0x0000: 4500 0028 3d66 4000 3f06 d9e9 0acb 0c65 E..(=f@.?......e
0x0010: 0af3 025e 05f1 8dbb f0a6 0f69 c105 33e2 ...^.......i..3.
0x0020: 5011 0036 0279 0000 0000 0000 0000 P..6.y........
11:33:13.436176 IP (tos 0x0, ttl 64, id 36659, offset 0, flags [DF], proto TCP (6), length 40)
192.168.100.3.36283 > 192.168.1.10.1521: Flags [F.], cksum 0x023b (correct), seq 3238343650, ack 4037414762, win 115, length 0
0x0000: 4500 0028 8f33 4000 4006 871c 0af3 025e E..(.3@.@......^
0x0010: 0acb 0c65 8dbb 05f1 c105 33e2 f0a6 0f6a ...e......3....j
0x0020: 5011 0073 023b 0000 P..s.;..
11:33:13.437033 IP (tos 0x0, ttl 63, id 15719, offset 0, flags [DF], proto TCP (6), length 40)
192.168.1.10.1521 > 192.168.100.3.36283: Flags [.], cksum 0x0278 (correct), seq 4037414762, ack 3238343651, win 54, length 0
0x0000: 4500 0028 3d67 4000 3f06 d9e8 0acb 0c65 E..(=g@.?......e
0x0010: 0af3 025e 05f1 8dbb f0a6 0f6a c105 33e3 ...^.......j..3.
0x0020: 5010 0036 0278 0000 0000 0000 0000 P..6.x........
caused by: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
at oracle.jdbc.driver.PhysicalConnection.
at oracle.jdbc.driver.T4CConnection.
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.tibco.pe.core.JDBCPool.getConnectionEntry(Unknown Source)
at com.tibco.pe.core.JDBCPool.getConnectionEntry(Unknown Source)
at com.tibco.pe.core.JDBCPoolManager.getConnectionEntry(Unknown Source)
at com.tibco.plugin.jdbc.JDBCActivity.eval(Unknown Source)
at com.tibco.pe.plugin.Activity.eval(Unknown Source)
at com.tibco.pe.core.TaskImpl.eval(Unknown Source)
at com.tibco.pe.core.Job.a(Unknown Source)
at com.tibco.pe.core.Job.k(Unknown Source)
at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source)
at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:392)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:434)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:687)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:343)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
... 16 more
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
środa, marca 20, 2013
MSSQL Server 2008 and Tibco BW: Connection closed.
MSSQL Server 2008 is using Start TLS on plain socket, but Tibco old Entrust security provider doesn't support it.
Set java.property.TIBCO_SECURITY_VENDOR=j2se.
Set java.property.TIBCO_SECURITY_VENDOR=j2se.
sobota, grudnia 01, 2012
HornetQAIO64.dll
piątek, września 02, 2011
ESB obok EAI
EAI tradycyjnie i historycznie jest zbudowane wokół JMS-a, ale starzeje się lub inaczej - nie nadąża za standardami: WS-Addressing, WS-Transactions, interoperacyjność z .NET. Do integracji platformy integracyjnej z resztą świata paradoksalnie potrzebna staje się nowa warstwa. Warstwą okalającą EAI może być nowoczesne lekkie ESB realizujące routing i transformacje z WebService-ów na JMS-a. Innymi słowy: channel na ESB, broker na EAI. ESB dodatkowo może realizować logowanie komunikatów, wirtualizację usług i QoS (service registry, load balancing, failover, powtarzanie wywołań w przypadku błędów technicznych, wymuszanie SLA), gdzie te ostatnie to kwestia konfiguracji a nie dewelopmentu.piątek, sierpnia 19, 2011
Klient Java 1.5 do WebLogic-a 11g działającego na Javie 1.6
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/client/jarbuilder.htmlpiątek, listopada 26, 2010
SQL Server Integration Services nie umie HTTPS-a
Używanie WebService-ów po protokole HTTPS z autoryzacją certyfikatem klienta to upowszechniona praktyka. Niestety produkt Microsoftu nie trzyma się ogólnie przyjętych standardów. Jest na to obejście. Należy na maszynie z SQL Serverem postawić lokalnie Apache-a 2.2. Certyfikaty klienta i serwera (ten ostatni można wygodnie wyjąć Firefoksem) należy przekonwertować do formatu PEM narzędziem XCA (napisane w Javie, dostępne na SourceForge-u). Następnie modyfikujemy httpd.conf:SSLProxyEngine On
SSLProxyCheckPeerCN off
ProxyPass /ws https://host/ws
ProxyPassReverse /ws https://host/ws
SSLProxyCACertificatePath D:/cert/
SSLProxyMachineCertificateFile D:/cert/cert_client_with_key.pem
SSLCertificateChainFile D:/cert/cert_server.pem
Trzeba pamiętać o odhaszowaniu modułów ssl i proxy. Do certyfikatu klienta należy dokleić klucz prywatny. W SSIS jako url podajemy http://localhost/ws.
Produkty MS są do bani, a opensource-owy Apache kolejny raz udowadnia, że jest wszechstronnym i niezawodnym narzędziem.
poniedziałek, sierpnia 30, 2010
.NET HTTPS WS client
An error occurred while making the HTTP request to https://host:443/ws/op. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
Workaround:
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
A wyjęcie tekstu z rozbudowanego SOAPFault-a wygląda tak:
try {
resp = cli.enterOrder(eo);
}
catch (Exception ex)
{
if (ex is FaultException)
{
this.richTextBox1.Text = (ex as FaultException).CreateMessageFault()
.GetDetail<string>();
}
else
this.richTextBox1.Text = ex.Message;
}
czwartek, czerwca 24, 2010
.NET WSDL import: These members may not be derived

Mamy ładnego WSDL-a, który działa z Eclipse-em, SOAPUI, waliduje się w narzędziu XMLSpy, próbujemy stworzyć klienta .NET-owego do tego serwisu i... nie da rady. Cannot import wsdl:portType. An exception was thrown while running a WSDL import extension: Error: These members may not be derived. Workaround: trzeba zmienić atrybuty name elementów message/part na unikalne.
czwartek, maja 20, 2010
Workaround na alteona
Alteon to sprzętowy balancer. Źle działający (źle skonfigurowany) powoduje objawy w postaci SocketException: Connection reset. Workaround to napisanie proxy poprzedzającego alteona (po ServerSocket.accept() tworzymy wątek do obsługi klienta):BufferedInputStream bis = new BufferedInputStream(cli.getInputStream());Co jest tutaj ważne? Keep-alive. Ponadto po zapisaniu całej wiadomości wychodzącej nie zamykamy strumienia wyjściowego, a przed czytaniem ze strumienia od alteona, śpimy przez kilka sekund.
dst = new Socket();
dst.setKeepAlive(true);
dst.setReceiveBufferSize(1024);
dst.setSendBufferSize(1024);
dst.setReuseAddress(true);
dst.setSoLinger(true, 3000);
dst.setTcpNoDelay(true);
dst.setSoTimeout(30000);
int n = bis.read(buff);
System.out.println("---- outgoing ----");
System.out.println(new String(buff, 0, n));
dst.connect(new InetSocketAddress(dstHost, dstPort), 10000);
OutputStream os = dst.getOutputStream();
InputStream is = dst.getInputStream();
os.write(buff, 0, n);
os.flush();
Thread.sleep(10000);
int m = is.read(buff);
System.out.println("---- incoming ----");
System.out.println(new String(buff, 0, m));
cli.getOutputStream().write(buff, 0, m);
cli.close();
dst.close();
Z dokumentacji: Preventing Denial of Service: Alteon Web Switches can thwart Denial of Service (DoS) attacks or TCP SYN attacks without blocking valid session requests. Through “delayed binding” Alteon Web OS intercepts client SYN requests before they reach the server. The Web Switch then responds to the client with a SYN ACK that contains embedded client information and does not allocate a session until a valid SYN ACK is received from the client or the three-way handshake is complete. By temporarily terminating each TCP connection until content has been received, Alteon Web Switches prevent the server from being inundated with SYN requests. Half-open sessions are a result of an incomplete three-way handshake between the server and client. To detect SYN attacks, Alteon Web OS enables tracking of the number of new half-open sessions over a set period of time. If the value exceeds a specified threshold, then the Alteon Web Switch triggers a trap to notify the administrator.
piątek, kwietnia 16, 2010
środa, marca 24, 2010
Certyfikaty klienta na IIS 6.0
Na IIS-ie w celu autoryzacji klienta certyfikatem nie należy używać Certificate Trust List. Przeważnie certyfikat klienta będzie podpisany certyfikatem nadrzędnej jednostki a na najwyższym poziomie certyfikatem CA. IIS do Certificate Trust List akceptuje tylko certyfikat self-signed, czyli w tym wypadku CA. Uaktywniając CTL spowodujemy, że do serwera zautentykuje się każdy dysponujący dowolnym certyfikatem, który w ścieżce certyfikacji ma to samo CA!Żeby rozwiązać problem uaktywniamy mapowanie certyfikatu do użytkownika lokalnego.

Na zasobie IIS ustawiamy ACL tak, żeby dostęp miał tylko zamapowany użytkownik (pozostałe wpisy uprawnień to SYSTEM, NETWORK_SERVICE, NETWORK, IIS_WPG i Administrators).

Teraz jeszcze jedna kwestia: certyfikat klienta podaje jako adres CRL hosta z sieci wewnętrznej. Można wyłączyć sprawdzanie, czy certyfikat został wycofany, za pomocą narzędzia IIS Metabase Explorer z pakietu IIS Resource Kit - dodając wpis CertCheckMode=1 (user: Server, attributes: Inheritable).

Należy pamiętać o wyłączeniu anonimowego dostępu.
środa, sierpnia 19, 2009
Metro Sun-a nie działa z Sharepointem MS
Na końcu metody getElementPropertyAccessor w klasie JAXBContextImpl z pakietu com.sun.xml.bind.v2.runtime nie należy rzucać wyjątku tylko zwrócić dodatkowy Accessor, który bierze pod uwagę, że klasy MS mogą mieć nazwy zaczynające się od Get i Set...public GetSetAccessor(ClassNo i gdzie to interoperability out of box?...
piątek, sierpnia 14, 2009
Plugin do Jiry wywołujący WebService Sharepoint-a
Jira używana jest do prowadzenia zgłoszeń, a Sharepoint do przechowywania dokumentów. Plugin typu "post-function" tworzy stronę Sharepointa dla danego zgłoszenia. Klient WebService'u został wygenerowany Metrem (z założenia Metro umie rozmawiać z WS Microsoftu wymagającymi autoryzacji, z ISA Serverem pomiędzy). Pliki źródłowe klienta się nie kompilują i mają błąd tworzenia URL-a dla WSDL-a umieszczonego w pliku jar:baseUrl = Clazz.class.getResource(".");
url = new URL(baseURL, "clazz.wsdl");należy zamienić na:url = Clazz.class.getResource("clazz.wsdl");Dla CreateSite konieczne jest wykonanie: stsadm -o addpath http://site -type wildcardinclusion.
Dla CreateWorkspace możemy użyć własnego template'u.
czwartek, kwietnia 24, 2008
DBLink do Oracle'a z MSSQL
Wchodzimy na stronę Wyroczni i szukamy do ściągnięcia 'Developer Tools fo VS.NET' i znajdujemy Oracle Data Access Components (ODAC). Konkretny produkt to 'Oracle 11g ODAC 11.1.0.6.21 with Oracle Developer Tools for Visual Studio'.
Konfigurujemy parametry dostępu do bazy w pliku tnsnames.ora (w razie potrzeby przerestartowujemy listener).

Na wszelki wypadek możemy sprawdzić, czy dostęp do Oracle'a działa z windowsowych Źródeł Danych ODBC.
Gdy nie instalowaliśmy na serwerze VisualStudia 2005 możemy
nie mieć bibliotek msv*71.dll w %WINDIR%\system32,
wtedy pojawia się błąd 126 - do zdobycia ze stacji roboczej.

Test connection - podajemy hasło dla użytkownika dostępowego.

Teraz w MSSQL Management Studio dodajemy zlinkowany serwer. Należy pamiętać, żeby wybrać providera od Oracle'a. Nie robimy mapowania użytkowników, podajemy dane dla jednego użytkownika dostępowego.

Możemy teraz wykonać jakieś zapytanie, żeby sprawdzić czy dblink działa.

Jeśli nie chcemy używać openquery/openrowset i nie potrzebujemy składni specyficznej
dla Oracle'a możemy użyć składni MSSQL (select * from DB..USER.TABLE),
ale musimy wtedy pamiętać o używaniu DUŻYCH LITER.
Subskrybuj:
Posty (Atom)


