Castle ActiveRecord Integration w/ multiple databases - castle-windsor

There is a way to use Castle ActiveRecord Integration (Castle.Facilities.ActiveRecordIntegration.dll) with multiple databases?
I'm already aware of using NHibernate with multiple database and ActiveRecord as well. But applied to integration facility i don't found anything.
Any suggestions?
Tks!!

It's pretty much the same as accessing multiple databases without the facility. You define a <config> element for each database (as detailed in the AR docs), e.g.:
<facility id="arfacility">
<assemblies>
<item>MyAssembly</item>
</assemblies>
<config>
<add key="connection.driver_class" value="NHibernate.Driver.SQLite20Driver" />
<add key="dialect" value="NHibernate.Dialect.SQLiteDialect" />
<add key="connection.provider" value="Castle.ActiveRecord.Testing.InMemoryConnectionProvider,Castle.ActiveRecord" />
<add key="connection.connection_string" value="Data Source=:memory:;Version=3;New=True" />
<add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" />
</config>
<config type="My.Secondary.Database.BaseClass, MyAssembly">
<add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="dialect" value="NHibernate.Dialect.MsSql2000Dialect" />
<add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="connection.connection_string" value="Data Source=.;Initial Catalog=test;Integrated Security=SSPI" />
<add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" />
</config>
</facility>
You can also use DifferentDatabaseScope as an alternative.

Related

REP-56132 Access is denied to the report definition file

I have been researching this problem for a couple weeks now and at a dead end.
Running 12c form and reports, Linux OEL 6, WebLogic 12c. Also, this is a 6i to 12c migration of all objects. This fails when sending the report directly across in the URL and with web.show_document.
Have added the COMPONENT_CONFIG_PATH, added the suggested changes to rwserver.conf and the rwservlet.properties, all folders and objects are wide open at 0777. I've tried a number of different users with various privileges but all have resulted in the same error. I have tried with RUN_REPORT_OBJECT and that also results in an error of FRM-41219. Here is the rwserver.confg:
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="http://xmlns.oracle.com/reports/server" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<cache class="oracle.reports.cache.RWCache">
<property name="cacheSize" value="50"/>
</cache>
<engine class="oracle.reports.engine.EngineImpl" engLife="1" id="rwEng" maxEngine="1" minEngine="1" maxIdle="3" callbackTime="90000">
<property name="sourceDir" value="/app01/bcis/forms"/>
<property name="tempDir" value="/app01/oracle/tmp"/>
<property name="keepConnection" value="yes"/>
</engine>
<engine class="oracle.reports.urlengine.URLEngineImpl" engLife="50" id="rwURLEng" maxEngine="1" minEngine="0"/>
<!--
<destination class="oracle.reports.server.DesFile" destype="file"/>
<destination class="oracle.reports.server.DesCache" destype="cache"/>
<destination class="oracle.reports.server.DesPrint" destype="printer"/>
-->
<destination class="oracle.reports.plugin.destination.ftp.DesFTP" destype="ftp"/>
<destination class="oracle.reports.plugin.destination.webdav.DesWebDAV" destype="WebDav"/>
<!--job engineId="rwEng" jobType="report" securityId="Empty"/-->
<!--job engineId="rwURLEng" jobType="rwurl" securityId="Empty"/-->
<notification class="oracle.reports.server.MailNotify" id="mailNotify">
<property name="succnotefile" value="succnote.txt"/>
<property name="failnotefile" value="failnote.txt"/>
</notification>
<jobRepository>
<property name="dbuser" value="rwadmin"/>
<property name="dbpassword" value="csf:reports:repo"/>
<property name="dbconn" value="dcis2d01.mlgw.org:1522:CISDB12"/>
</jobRepository>
<connection idleTimeOut="30" maxConnect="250"/>
<queue maxQueueSize="1000"/>
<folderAccess>
<read>/app01/bcis/forms:/app01/bcis/reports:/app01/bcis/dev/exe:/app01/bcis/exe:/app01/oracle/tmp</read>
<write>/app01/bcis/forms:/app01/bcis/reports:/app01/bcis/dev/exe:/app01/bcis/exe:/app01/oracle/tmp</write>
<defaultWriteFolder>/app01/bcis/forms</defaultWriteFolder>
</folderAccess>
<identifier encrypted="yes">QgZSFEalKUbL0t/KwwqSEg0=</identifier>
<proxyInfo>
<proxyServers>
<proxyServer name="$$Self.proxyHost$$" port="$$Self.proxyPort$$" protocol="all"/>
</proxyServers>
<bypassProxy>
<domain>$$Self.proxyByPass$$</domain>
</bypassProxy>
</proxyInfo>
<pluginParam value="%MAILSERVER_NAME%" name="mailServer"/>
</server>
The naming service:
<namingService name="Cos" host="10.211.212.164" port="14021"/>
I have checked the spelling of all paths, so they are right and they do run under rwrun and I can bring them up in rwbuilder.
If there is anything else that would be helpful, please let me know.
Any suggestions at this point will be helpful and I would appreciate as many quick responses as possible.
Have you added the report as an object in the calling form? (Similar to adding a new canvas or new datablock)
The find_report_object call should be passed the name of the report object as it was added to the form. The FRM-41219 makes me think you haven't added the report object. This did not need to be done in 6i.
Have you tried to verify that the reports are generated? You could try trigger generation of a report directly from a curl command on the reports server. I use something like the below URL to verify that the reportsserver is running:
http://reportsserver:port/reports/rwservlet?userid=user/password#tnsname&destype=cache&report=reportnam.rdf&desformat=PDF&argument1=123&argument2=456

Unable to get flow variable inside exception-strategy

Unable to get flow variable inside exception. In below code I am trying to use centirofilename inside default-exception-strategy. It gives Exception
<set-variable value="#[xpath('//soap/filename/text()').text]"
variableName="centirofilename" doc:name="Variable" />
<default-exception-strategy>
<rollback-transaction exception-pattern="*" /> <!-- [1] -->
<processor-chain>
<logger level="INFO" category="ProTSP Logger"
message="#[centirofilename]" doc:name="Logger" />
</processor-chain>
</default-exception-strategy>
You should be using rollback-exception-strategy instead of the one you're using. The exception strategy you're using is legacy and it's use is not recommended.

org.hibernate.MappingException: Unknown entity when trying to save POJO

I get the below error when I invoke the method to save an entity to the database.
ERROR: org.aggu.sramam.exceptions.SramamException - Exception thrown:
org.hibernate.MappingException: Unknown entity: org.aggu.sramam.pojo.SramaSangham
at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:1096)
at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1443
The POJO object is there in the package, and I also have the below entry in my hibernate-cfg.xml file
<hibernate-configuration>
<!-- List out the entities (i.e POJO linked to DB table) here -->
<session-factory>
<mapping class="org.aggu.sramam.pojo.SramaSangham" />
</session-factory>
</hibernate-configuration>
Below is the entry in the servlet-config.xml file, which gives the code base links
<!-- The below is the base package for all Sramam apps -->
<context:component-scan base-package="org.aggu.sramam" />
What have I missed here? I have added the #Entity, #Table, #Id tags etc. in the POJO object. There is an Unqiue ID column (Primary key), but I have not written any explicit code to generate the ID automatically. Would that be a problem?
Okay. Figured this out myself. The issue was that in my servlet-context.xml file, I had NOT given a reference/link to the hibernate.cfg.xml. Once this was given, the error got resolved and records started getting inserted.
<beans:bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<beans:property name="dataSource" ref="dataSource" />
<beans:property name="hibernateProperties">
<beans:props>
<beans:prop key="hibernate.show_sql">true</beans:prop>
<beans:prop key="hibernate.hbm2ddl.auto">create</beans:prop>
<beans:prop key="hibernate.dialect">${jdbc.dialect}</beans:prop>
</beans:props>
</beans:property>
**<!- This line did the trick -->
<beans:property name="configLocation">
<beans:value>WEB-INF/classes/hibernate.cfg.xml</beans:value>
</beans:property>**
</beans:bean>

How to split up the url?

I use Mule Studio.
When I run for example localhost:8080/?first=value1&second=value2 I would like to get two variables and their values:
first: value1
second: value2
I use splitter to delete first '/' like this:
[regex('/(.*?)', message.payload)]
but now I get:
?first=value1&second=value2
You can extract the parameters by using message.inboundProperties['parameter'].
For example:
<logger level="WARN" message="#[message.inboundProperties['first']]" />
<logger level="WARN" message="#[message.inboundProperties['second']]" />
You may extract the parameters in three ways:
Directly from the message's inbound properties
As a Map by accessing the inbound property keyed with http.query.params
Using http:body-to-parameter-map-transformer and have the map conveniently placed on the payload.
Consider running the following flow:
<flow name="mule-configFlow1" doc:name="mule-configFlow1">
<http:inbound-endpoint address="http://localhost:8082/app" />
<http:body-to-parameter-map-transformer />
<logger level="ERROR" />
<logger level="ERROR" message="Payload is: #[payload]" />
<json:object-to-json-transformer />
</flow>

How do I configure log4net for a different level for some classes?

I want INFO for everything and DEBUG for one package. I've tried numerous variations of:
<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="C:/temp/AutoTag.log"/>
<param name="AppendToFile" value="true"/>
<param name="MaxSizeRollBackups" value="2"/>
<param name="MaximumFileSize" value="100KB"/>
<param name="RollingStyle" value="Size"/>
<param name="StaticLogFileName" value="true"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] ac.server %-5p %c - %m%n"/>
</layout>
</appender>
<root>
<level value="INFO"/>
<appender-ref ref="RollingFileAppender"/>
</root>
<logger name="AutoTagCore.net.windward.autotag.utils">
<level value="DEBUG"/>
</logger>
</log4net>
But nothing works. If I remove the <root/> part, I get the detailed in the one package. Otherwise it's as though the <logger/> part is not there.
How can I accomplish this? (Updated to show full log4net part).
Update2: I'm an idiot - I had the wrong package name in there.
Logger will inherit all appenders from root. You need to specify level only:
<root>
<level value="INFO"/>
<appender-ref ref="RollingFileAppender"/>
</root>
<logger name="AutoTagCore.net.windward.autotag.utils">
<level value="DEBUG"/>
</logger>
BTW Verify appender settings - it could be restricted to INFO level:
<threshold value="INFO"/>
And last possible issue - you can have different type namespace and logger name (maybe some typo).