Cannot set WrapTypes using wlconfig for JDBCConnectionPool - weblogic11g

I created JDBC connection pool using ant script.
<target name="create-cmifs-connpool">
<wlconfig username="${user}" password="${password}" url="${wls.url}">
<query domain="${domain.name}" type="Server" name="${servername}" property="x" />
<create type="JDBCConnectionPool" name="cmifsDBPool">
<set attribute="CapacityIncrement" value="1"/>
<set attribute="DriverName" value="oracle.jdbc.OracleDriver"/>
<set attribute="InitialCapacity" value="1"/>
<set attribute="MaxCapacity" value="10"/>
<set attribute="Password" value="${env.DB_PWD}"/>
<set attribute="Properties" value="user=${env.DB_USER}"/>
<set attribute="RefreshMinutes" value="0"/>
<set attribute="ShrinkPeriodMinutes" value="15"/>
<set attribute="ShrinkingEnabled" value="true"/>
<set attribute="TestConnectionsOnRelease" value="false"/>
<set attribute="TestConnectionsOnReserve" value="false"/>
<set attribute="TestTableName" value="DUAL"/>
<set attribute="URL" value="jdbc:oracle:thin:#${env.MACHINE}:1521:NOTXE"/>
<set attribute="Targets" value="${x}" />
</create>
<create type="JDBCDataSource" name="cmifsDBDS" >
<set attribute="JNDIName" value="jdbc/cmifsDBDS"/>
<set attribute="PoolName" value="cmifsDBPool"/>
<set attribute="Targets" value="${x}" />
</create>
</wlconfig>
</target>
Everything works good, until I try to retrieve an ARRAY from DB. I get the following error:
java.lang.ClassCastException: weblogic.jdbc.wrapper.Array_oracle_sql_ARRAY cannot be cast to oracle.sql.ARRAY
I got the solution for this problem in this link, which says that Wrap Data Types should be set to false for the connection pool. This fixed the problem.
But when I tried to add the attribute to my ant script
<set attribute="WrapTypes" value="false"/>
It doesnt work. I am getting the following error:
Error invoking MBean command: java.lang.IllegalArgumentException: Property Name and value not valid for the MBean. Value false for parameter[WrapTypes].java.lang.IllegalArgumentException: Unable to find the attribute: WrapTypes in the attribute list of the class: JDBCConnectionPool
How to solve this problem?

It seems you use common interface and script executor doesn't understand vendor specific flags in this case. Try to use concrete type. May be weblogic.jdbc.common.internal.ConnectionPool will help you.

Related

How can I get a key_value from a specific mapped_value in AIML?

I'm starting to learn some AIML and I'm quite lost at this point.
I'm working with maps but I can't think of an algorithm to solve this problem.
Let's say I have a map in which I'm storing my friends' hair color. Something like Markus:brown.
Now let's say I want to get all the names whose hair color is brown. Something like:
Human: Could you tell me the names of my friends whose hair color is brown?
Robot: Markus Kevin Thomas
Edit: Doing some research I found that many users create a the oposite map, I mean, person:hair, hair:person. But if I have different people with the same color, would the map return the first one? How could I get all of them?
How could I do that?
Thanks in advance.
You can't really do this using maps unless you set up a map like this:
[
["brown", "Markus, David, Thomas"],
["black", "Stephen, Paul"],
["blonde", "Simon"]
]
This could be a lot of manual work and not really practical. When I work with simple databases like this, I set up each entry in its own category:
<category>
<pattern>XFRIEND 1</pattern>
<template>
<think>
<set name="friend">Markus</set>
<set name="hair">brown</set>
<set name="eyes">blue</set>
<set name="likes">pizza</set>
</think>
</template>
</category>
<category>
<pattern>XFRIEND 2</pattern>
<template>
<think>
<set name="friend">Kevin</set>
<set name="hair">black</set>
<set name="eyes">brown</set>
<set name="likes">burgers</set>
</think>
</template>
</category>
<category>
<pattern>XFRIEND 3</pattern>
<template>
<think>
<set name="friend">Thomas</set>
<set name="hair">brown</set>
<set name="eyes">green</set>
<set name="likes">burgers</set>
</think>
</template>
</category>
<category>
<pattern>XFRIEND 4</pattern>
<template>
<think>
<set name="friend">David</set>
<set name="hair">black</set>
<set name="eyes">blue</set>
<set name="likes">burgers</set>
</think>
</template>
</category>
And then create a category which will scan and check each entry:
<category>
<pattern>XSCANFRIENDSDATABASE</pattern>
<template>
<think>
<set name="list">Results:<br/></set>
<srai>XFRIEND 1</srai>
<srai>XCHECKMATCH</srai>
<srai>XFRIEND 2</srai>
<srai>XCHECKMATCH</srai>
<srai>XFRIEND 3</srai>
<srai>XCHECKMATCH</srai>
<srai>XFRIEND 4</srai>
<srai>XCHECKMATCH</srai>
</think>
<get name="list"/>
</template>
</category>
Now we have our database set up, let's see how we can use it. I want to know, "Who has (whatever coloured) hair". We can do this with this category:
<category>
<pattern>WHO HAS * HAIR</pattern>
<template>
<think>
<set name="searchfor"><star/></set>
<learn>
<category>
<pattern>XCHECKMATCH</pattern>
<template>
<condition name="hair">
<li><value><get name="searchfor"/></value>
<set name="list"><get name="list"/><br/><get name="friend"/></set>
</li>
</condition>
</template>
</category>
</learn>
</think>
<srai>XSCANFRIENDSDATABASE</srai>
</template>
</category>
So in your query, "Who has brown hair", the predicate "searchfor" is set to "brown", as that is what we are searching for.
We then use the <learn> tag to set up a temporary category called "XCHECKMATCH" which looks at the value of "hair" in each of the entries in our database and compares it to "searchfor". If it matches, add it to the list.
Once set up, we scan the database and display the results.
Human - Who has brown hair?
Bot - Results:
Markus
Thomas
As an advanced use of this, we can also check for more than one item. For example, "Who has black hair and likes burgers?"
<category>
<pattern>WHO HAS * HAIR AND LIKES *</pattern>
<template>
<think>
<set name="searchfor"><star/> <star index="2"/></set>
<learn>
<category>
<pattern>XCHECKMATCH</pattern>
<template>
<think><set name="found"><get name="hair"/> <get name="likes"/></set></think>
<condition name="found">
<li><value><get name="searchfor"/></value>
<set name="list"><get name="list"/><br/><get name="friend"/></set>
</li>
</condition>
</template>
</category>
</learn>
</think>
<srai>XSCANFRIENDSDATABASE</srai>
</template>
</category>
In this example, "searchfor" becomes "black burgers". We set up a new predicate called "found" (what the database has found). This is made up of "<get name="hair"/> <get name="likes"/>" and once again we scan the database to see what matches:
Human - "Who has black hair and likes burgers?"
Bot - Results: Kevin
David
I use this database method regularly for answering crazy questions like "Is a train faster than a snail?". There's no point in creating categories for this one example and so a database method is far more useful and easier to maintain.
If this is beyond the level of what you are needing, you will need to use a map and a category like this:
[
["brown", "Markus, David, Thomas"],
["black", "Stephen, Paul"],
["blonde", "Simon"]
]
<category>
<pattern>WHO HAS * HAIR</pattern>
<template>
<map name="hair"><star/></map>
</template>
</category>
However, this has nowhere near the flexibility of using a database style structure.
Human - Who has brown hair?
Bot - Markus, David, Thomas
If you are planning on doing that though, you might as well just do:
<category>
<pattern>WHO HAS BROWN HAIR</pattern>
<template>
Markus, David, Thomas.
</template>
</category>
Hope that makes sense. Happy to clarify anything if you need me to.

configure continuation timeout in jboss fuse esb

I am using jboss fuse esb 6.2.0. I would like change the jetty continuation timeout at server level(i.e single configuration for all apis continuation timeout), can any one help me to do this. I tried a lot at the end I found setting at http endpoint level like one explained in configure-timeout-for-apache-camel-jetty-component.
Please find the jetty.xml configuration
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host">
<Property name="jetty.host"/>
</Set>
<!-- We explicitly set port to 0 to avoid port conflicts, then a real port will be picked
from org.ops4j.pax.web pid, which is PortService aware
-->
<Set name="port">
<Property name="jetty.port" default="0"/>
</Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
<Set name="name">karaf</Set>
<Set name="loginModuleName">karaf</Set>
<Set name="roleClassNames">
<Array type="java.lang.String">
<Item>org.apache.karaf.jaas.boot.principal.RolePrincipal</Item>
</Array>
</Set>
</New>
</Arg>
</Call>

How to pull all available query fields for an SOQL object?

So, I'm seeing Stackoverflow is more responsive than the actual Salesforce community and I'm reposting my question from here:
How can I pull a list of all of the available query fields for an SOQL object? I have my DataLoader script ready to go, but I need a way to pull all the query fields for specific SOQL data objects and feed them into my process-conf.xml file in DataLoader to pull the values of all those fields to a separate location. I have the DataLoader value pulling already setup, but I need a way to get all the available query fields as they continue to change. The ANT Migration Tool does not appear to be able to pull the query fields itself.
ANT Tool configuration:
# build.properties
# Specify the login credentials for the desired Salesforce organization
sf.username = <test user acct>
sf.password = <password>
#sf.sessionId = <Insert your Salesforce session id here. Use this or username/password above. Cannot use both>
#sf.pkgName = <Insert comma separated package names to be retrieved>
#sf.zipFile = <Insert path of the zipfile to be retrieved>
#sf.metadataType = <Insert metadata type name for which listMetadata or bulkRetrieve operations are to be performed>
sf.serverurl = https://na3.salesforce.com
sf.maxPoll = 20
# If your network requires an HTTP proxy, see http://ant.apache.org/manual/proxy.html for configuration.
#
logType=Detail
build.xml
<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">
<property file="build.properties"/>
<property environment="env"/>
<!-- Setting default value for username, password and session id properties to empty string
so unset values are treated as empty. Without this, ant expressions such as ${sf.username}
will be treated literally.
-->
<condition property="sf.username" value=""> <not> <isset property="sf.username"/> </not> </condition>
<condition property="sf.password" value=""> <not> <isset property="sf.password"/> </not> </condition>
<condition property="sf.sessionId" value=""> <not> <isset property="sf.sessionId"/> </not> </condition>
<taskdef resource="com/salesforce/antlib.xml" uri="antlib:com.salesforce">
<classpath>
<pathelement location="ant-salesforce.jar" />
</classpath>
</taskdef>
<!-- See what happens here -->
<target name="retrieveSOQL">
<sf:retrieve
username="${sf.username}"
password="${sf.password}"
sessionId="${sf.sessionId}"
serverurl="${sf.serverurl}"
retrieveTarget="output"
unpackaged="package.xml"/>
</target>
</project>
Package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Account</members>
<members>Opportunity</members>
<members>Lead</members>
<members>Event</members>
<members>Project__c</members>
<name>CustomObject</name>
</types>
<version>41.0</version>
</Package>
process-conf.xml
<beans>
<bean id="AccountExtract"
class="com.salesforce.dataloader.process.ProcessRunner"
singleton="false">
<description>csvAccountExtract job</description>
<property name="name" value="csvAccountExtract"/>
<property name="configOverrideMap">
<map>
<entry key="sfdc.debugMessages" value="false"/>
<entry key="sfdc.debugMessagesFile" value="C:\Users\user\Desktop\salesforce_backup\sfdcSoapTrace.log"/>
<entry key="sfdc.endpoint" value="https://na3.salesforce.com"/>
<entry key="sfdc.username" value="<username>"/>
<!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile
the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->
<entry key="sfdc.password" value="<password>"/>
<entry key="process.encryptionKeyFile" value="key.txt"/>
<entry key="sfdc.timeoutSecs" value="600"/>
<entry key="sfdc.loadBatchSize" value="200"/>
<entry key="sfdc.entity" value="Account"/>
<entry key="sfdc.extractionRequestSize" value="500"/>
<entry key="sfdc.extractionSOQL" value="Select Id, IsDeleted, MasterRecordId, Name, Type, RecordTypeId, ParentId, BillingStreet FROM Account"/>
<entry key="process.operation" value="extract"/>
<entry key="dataAccess.type" value="csvWrite"/>
<entry key="dataAccess.name" value="C:\Users\user\Desktop\account.csv"/>
</map>
</property>
</bean>
...
</beans>

gzip compression not working in Solr 5.1

I'm trying to apply gzip compression in Solr 5.1. I understand that Running Solr on Tomcat is no longer supported from Solr 5.0, so I've tried to implement it in Solr.
I've downloaded jetty-servlets-9.3.0.RC0.jar and placed it in my webapp\WEB-INF folder, and have added the following in webapp\WEB-INF\web.xml:
<filter>
<filter-name>GzipFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
<init-param>
<param-name>methods</param-name>
<param-value>GET,POST</param-value>
<param-name>mimeTypes</param-name>
<param-value>text/html,text/plain,text/xml,text/json,text/javascript,text/css,application/xhtml+xml,application/javascript,image/svg+xml,application/json,application/xml; charset=UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>GzipFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
However, when I start Solr and check the browser, there's no gzip compression, and I only get the following at the Response Headers output:
Content-Type:text/plain;charset=UTF-8
Transfer-Encoding:chunked
Is there anything which I configure wrongly or might have missed out? I'm also running zookeeper-3.4.6.
Download a kosher version of Jetty that closely matches what is currently in Solr: http://www.eclipse.org/jetty/download.html
Extract that .zip to a location you will discard.
Copy out these files to your copy of jetty in Solr (located in path-to-solr/server/):
modules/gzip.mod
etc/gzip.xml
Modify modules/gzip.mod:
#
# GZIP module
# Applies GzipHandler to entire server
#
[depend]
server
[xml]
etc/jetty-gzip.xml
[ini-template]
## Minimum content length after which gzip is enabled
jetty.gzip.minGzipSize=2048
## Check whether a file with *.gz extension exists
jetty.gzip.checkGzExists=false
## Gzip compression level (-1 for default)
jetty.gzip.compressionLevel=-1
## User agents for which gzip is disabled
jetty.gzip.excludedUserAgent=.*MSIE.6\.0.*
Modify etc/gzip.xml:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<!-- =============================================================== -->
<!-- Mixin the GZIP Handler -->
<!-- This applies the GZIP Handler to the entire server -->
<!-- If a GZIP handler is required for an individual context, then -->
<!-- use a context XML (see test.xml example in distribution) -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="insertHandler">
<Arg>
<New id="GzipHandler" class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
<Set name="minGzipSize">
<Property name="jetty.gzip.minGzipSize" deprecated="gzip.minGzipSize" default="2048"/>
</Set>
<Set name="checkGzExists">
<Property name="jetty.gzip.checkGzExists" deprecated="gzip.checkGzExists" default="false"/>
</Set>
<Set name="compressionLevel">
<Property name="jetty.gzip.compressionLevel" deprecated="gzip.compressionLevel" default="-1"/>
</Set>
<Set name="excludedAgentPatterns">
<Array type="String">
<Item>
<Property name="jetty.gzip.excludedUserAgent" deprecated="gzip.excludedUserAgent" default=".*MSIE.6\.0.*"/>
</Item>
</Array>
</Set>
<Set name="includedMethods">
<Array type="String">
<Item>GET</Item>
<Item>POST</Item>
</Array>
</Set>
<Set name="includedPaths"><Array type="String"><Item>/*</Item></Array></Set>
<Set name="excludedPaths"><Array type="String"><Item>*.gz</Item></Array></Set>
<Call name="addIncludedMimeTypes"><Arg><Array type="String">
<Item>text/html</Item>
<Item>text/plain</Item>
<Item>text/xml</Item>
<Item>application/xml</Item><!-- IMPORTANT - DO NOT FORGET THIS LINE -->
<Item>application/xhtml+xml</Item>
<Item>text/css</Item>
<Item>application/javascript</Item>
<Item>image/svg+xml</Item>
</Array></Arg></Call>
<!--
<Call name="addExcludedMimeTypes"><Arg><Array type="String"><Item>some/type</Item></Array></Arg></Call>
-->
</New>
</Arg>
</Call>
</Configure>
Here's the part that should make you cringe a bit.
Modify bin\solr.cmd
...
set "SOLR_JETTY_CONFIG=--module=http,gzip"
...
set "SOLR_JETTY_CONFIG=--module=https,gzip"
...
Notice that --module=http was already there. Just add ",gzip" so it matches the lines above.
I would prefer finding a better way of specifying the gzip module to load, but I don't know how. If you know how, please reply to this answer and tell me how because I hate modifying a script that comes with a product--it's a maintenance nightmare and, well, I think you get the picture.
After this, restart the solr server and gzip should now be enabled--at least for &wt=xml, which is sent back as Content-Type: application/xml.
You can add what you need to the etc/gzip.xml and restart the solr server for it to recognize your changes.
I tested with and without compression of 1000 documents. For me, it was the difference between 3.8 MB and 637 KB.

Restricting IP addresses for Jetty and Solr

I'm setting up Solr using Jetty. I would like to restrict access to only a few IP addresses. It doesn't seem immediately obvious that this can be done using Jetty. Is it possible and if so, how?
Solr 4.2.1 uses Jetty 8.1.8. Jetty 8 (as noted by jonas789) doesn't support .htaccess. Instead, it uses IPAccessHandler, which doesn't have great documentation available. I had to play with it quite a bit to get it work, so I'm posting an updated solution here.
IPAccessHandler manages a blacklist and a whitelist, accepts arbitrary ranges of IPs, and supports attaching specific URI paths to each white/black -list entry. IPAccessHandler also subclasses HandlerWrapper, which turns out to be important.
The solr app still lives in a WebAppContext (as in Lyndsay's solution), but a WebAppContext is now governed by a ContextHandler, which resides in a ContextHandlerCollection occupying the first handler slot in the server. To stop requests from the wrong IP from getting to the app, we need to wrap it inside an IPAccessHandler somewhere along that path. IPAccessHandler behaves oddly if it's in the wrong spot: I tried inserting it before the context handlers and it gave 403 Forbidden to the wrong machines, threw NullPointerException tantrums with no additional error messages, all sorts of nonsense. I finally got it to work by wrapping the ContextHandlerCollection itself, at the server level.
Go to etc/jetty.xml and scroll to the handlers section. Then wrap the existing ContextHandlerCollection item as follows:
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<!-- here begins the new stuff -->
<New class="org.eclipse.jetty.server.handler.IPAccessHandler">
<Call name="addWhite">
<Arg>xxx.xxx.xxx.xxx</Arg>
</Call>
<Set name="handler">
<!-- here's where you put what was there before: -->
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Set>
</New>
<!-- here ends the new stuff -->
</Item>
<Item>
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
<Item>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
Resources:
http://comments.gmane.org/gmane.comp.java.jetty.support/6066
http://wiki.eclipse.org/Jetty#Configuration_Reference
http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax
http://download.eclipse.org/jetty/stable-8/apidocs/org/eclipse/jetty/server/handler/IPAccessHandler.html
I found the solution.
Firstly, extract the contents of solr.war in the example/webapps folder.
Then create a file called .htaccess and place it in the example/webapps/solr folder (the one you just extracted) containing the following:
<Limit>
satisfy all
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx
</Limit>
In example/etc/ edit the jetty.xml file and comment out the org.mortbay.jetty.deployer.WebAppDeployer part. Then finally create a folder in example/ called contexts (if one does not yet exist) and add a file called solr.xml to it containing:
<Configure id="solr" class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/webapps/solr</Set>
<Set name="contextPath">/solr</Set>
<Call name="setSecurityHandler">
<Arg>
<New class="org.mortbay.jetty.security.HTAccessHandler">
<Set name="protegee">
<Ref id="solr"/>
</Set>
</New>
</Arg>
</Call>
</Configure>
Then start up your new secure solr!

Resources