To start I have already referenced the following posts
VS2010 Database project deploy - "SqlDeployTask" task failed unexpectedly, NullReferenceException
http://social.msdn.microsoft.com/Forums/en/vstsdb/thread/e848f09f-5d5d-46d5-b27a-c7769b188c78
I have a Database project which is connected to Team Foundation Server. I have been successfully creating/modifying tables and procedures and deploying to the database. At one point I think there was a sync issue between my local project and TFS (I probably forgot to check in changes before checking out) Since this happened I have been unable to deploy the project. I receive the following error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.TSqlTasks.targets(120,5): Error MSB4018: The "SqlDeployTask" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Data.Schema.Sql.SchemaModel.SqlScriptDomGenerator.AlterStatementGenerator.GenerateStatement(IModelElement modelElement)
at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.AlterStatementGeneratorBase.GenerateAlterProcedureStatement(IModelElement oldElement, IModelElement newElement)
at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.AlterStatementGeneratorBase.GenerateStatement(IModelElement oldElement, IModelElement newElement)
at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.AlterStatementGeneratorBase.GenerateScriptDom(IModelElement oldElement, IModelElement newElement)
at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.DeploymentScriptDomGenerator.GenerateFragment(Int32 operation, IModelElement element)
at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.DeploymentScriptDomGenerator.GenerateSteps(Int32 operation, IModelElement element)
at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.OrderedStepGenerator.Add(DeploymentScriptDomGenerator scriptDom, IModelElement element, Int32 operation)
at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.PlanMediator.BuildDependencyOrderedSteps(Int32 operation, List`1 classOrder, List`1 operationOrder, Dictionary`2 changes, Boolean preserveGraphs, Dictionary`2& relating, Dictionary`2& related)
at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.PlanMediator.BuildOperations()
at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.OnGeneratePlan()
at Microsoft.Data.Schema.Build.DeploymentPlanGenerator.GeneratePlan()
at Microsoft.Data.Schema.Build.SchemaDeployment.BuildPlan()
at Microsoft.Data.Schema.Build.SchemaDeployment.Execute(Boolean executeDeployment)
at Microsoft.Data.Schema.Build.SchemaDeployment.Execute()
at Microsoft.Data.Schema.Tasks.DBDeployTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
Done executing task "SqlDeployTask" -- FAILED.
Done building target "DspDeploy" in project "Ched 10.dbproj" -- FAILED.
Done executing task "CallTarget" -- FAILED.
Done building target "DBDeploy" in project "Ched 10.dbproj" -- FAILED.
Done building project "Ched 10.dbproj" -- FAILED.
In the SO post above it looks like the issue was an issue with a function. I have only one function that I have created on my project and have tried removing it from the DB and re-deploying the project with failure. I continued troubleshooting, trying all of the following steps that were listed on the MSDN post above:
1. Unloaded the project, deleted the *.dbmdl files, and reloaded project.
2. Switch project properties to just create a deploy script
3. Switch back to creating a deploy script and deploy
4. Cleaned the project
None of these have worked, I am still getting the failure when I set the project to only create a deployment script and not actually deploy.
I have done schema comparisons and have mirrored the data on the DB to the data in my project. Looking at the solution on the MSDN article, the user ended up finding an error in the refactor log. I have looked through the refactor log and see where there could be an issue, however I cannot find how to resolve it. The refactor log has entries that do not exist in either the DB or the project (these were tables or procedures that have been completely removed from the project)
Any ideas on how I could resolve this?
Not sure if this helps or not, but here is my refactor log:
<?xml version="1.0" encoding="utf-8"?>
<Operations Version="1.0">
<Operation Name="Rename Refactor" Key="b38ad5f3-ed84-4796-aaa6-4021ae32238e" ChangeDateTime="01/31/2012 19:11:11">
<Property Name="ElementName" Value="[dbo].[GetModule]" />
<Property Name="ElementType" Value="ISql100Procedure" />
<Property Name="ParentElementName" Value="[dbo]" />
<Property Name="ParentElementType" Value="ISql90Schema" />
<Property Name="NewName" Value="[GetModuleOutline]" />
</Operation>
<Operation Name="Rename Refactor" Key="7e984a2d-8251-4a78-9926-c11e9d3771a3" ChangeDateTime="01/31/2012 20:58:24">
<Property Name="ElementName" Value="[dbo].[GetModuleOutline]" />
<Property Name="ElementType" Value="ISql100Procedure" />
<Property Name="ParentElementName" Value="[dbo]" />
<Property Name="ParentElementType" Value="ISql90Schema" />
<Property Name="NewName" Value="[GetModuleOutlineByID]" />
</Operation>
<Operation Name="Rename Refactor" Key="62d05d8a-1c45-4b32-94b2-2f0640e48c55" ChangeDateTime="01/31/2012 20:58:35">
<Property Name="ElementName" Value="[dbo].[GetSectionOutline]" />
<Property Name="ElementType" Value="ISql100Procedure" />
<Property Name="ParentElementName" Value="[dbo]" />
<Property Name="ParentElementType" Value="ISql90Schema" />
<Property Name="NewName" Value="[GetSectionOutlineByID]" />
</Operation>
<Operation Name="Rename Refactor" Key="26fd6cbf-9a72-431b-8399-de3780150f1e" ChangeDateTime="02/01/2012 21:14:35">
<Property Name="ElementName" Value="[dbo].[Tracker]" />
<Property Name="ElementType" Value="ISql100Table" />
<Property Name="ParentElementName" Value="[dbo]" />
<Property Name="ParentElementType" Value="ISql90Schema" />
<Property Name="NewName" Value="[StudentSlideProgress]" />
</Operation>
<Operation Name="Rename Refactor" Key="c1286fdd-08a7-43a0-b9ac-5137b08bc783" ChangeDateTime="02/01/2012 22:52:45">
<Property Name="ElementName" Value="[dbo].[TrackerActionType]" />
<Property Name="ElementType" Value="ISql100Table" />
<Property Name="ParentElementName" Value="[dbo]" />
<Property Name="ParentElementType" Value="ISql90Schema" />
<Property Name="NewName" Value="[SlideActionType]" />
</Operation>
<Operation Name="Rename Refactor" Key="3d1fbdbb-9290-4400-9fba-04924f1ac5fd" ChangeDateTime="03/05/2012 22:37:51">
<Property Name="ElementName" Value="[dbo].[GetStudentAuthentication]" />
<Property Name="ElementType" Value="ISql100Procedure" />
<Property Name="ParentElementName" Value="[dbo]" />
<Property Name="ParentElementType" Value="ISql90Schema" />
<Property Name="NewName" Value="[GetStudentVerification]" />
</Operation>
<Operation Name="Rename Refactor" Key="5d40b8e2-6466-4050-90be-d28d16ac2d86" ChangeDateTime="03/13/2012 18:38:58">
<Property Name="ElementName" Value="[dbo].[SetStudentBegin]" />
<Property Name="ElementType" Value="ISql100Procedure" />
<Property Name="ParentElementName" Value="[dbo]" />
<Property Name="ParentElementType" Value="ISql90Schema" />
<Property Name="NewName" Value="[SetStudentSlideBegin]" />
</Operation>
<Operation Name="Rename Refactor" Key="5f2d4bd5-95d9-4b8f-91c5-46e89673c93b" ChangeDateTime="03/13/2012 19:01:55">
<Property Name="ElementName" Value="[dbo].[SetStudentSlideBegin]" />
<Property Name="ElementType" Value="ISql100Procedure" />
<Property Name="ParentElementName" Value="[dbo]" />
<Property Name="ParentElementType" Value="ISql90Schema" />
<Property Name="NewName" Value="[SetStudentSlideStart]" />
</Operation>
<Operation Name="Rename Refactor" Key="f4b2ad86-46af-41e8-9d66-4f61bf78e481" ChangeDateTime="03/13/2012 19:14:27">
<Property Name="ElementName" Value="[dbo].[SetStudentSlideEnd]" />
<Property Name="ElementType" Value="ISql100Procedure" />
<Property Name="ParentElementName" Value="[dbo]" />
<Property Name="ParentElementType" Value="ISql90Schema" />
<Property Name="NewName" Value="[SetStudentSlideStop]" />
</Operation>
</Operations>
Related
I have written spring-web-flow in my project.When i hit the flow it showing an error as
Caused by:org.springframework.webflow.engine.model.builder.FlowModelBuilderException : Could not access the XML flow definition at ServletContext resource /WEB-INF/webapp/xxx-webflow.xml
am getting the above error and showing as Unable to get the model for this flow when i trying to access my flow,
find my below code for the reference.
<webflow:flow-executor id="flowExecutor" />
<webflow:flow-registry id="flowRegistry"
flow-builder-services="flowBuilderServices" base-path="/WEB-INF">
<!-- here the id is mapped to invoke this flow -->
<webflow:flow-location id="forgotPasswordFlow" path="/webapp/xxx-webflow.xml" />
</webflow:flow-registry>
<webflow:flow-builder-services id="flowBuilderServices"
view-factory-creator="viewFactoryCreator" />
<bean id="viewFactoryCreator"
class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers">
<list>
<ref bean="viewResolver" />
</list>
</property>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/templates/" />
<property name="suffix" value=".html" />
</bean>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter"><property name="flowExecutor" ref="flowExecutor" />
</bean>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry" />
<property name="order" value="0" />
</bean>
and my xxx.xml file is
<view-state id="viewForgotPasswordForm" view="/templates/casForgetPasswordView.html"
model="forgotPasswordCredential">
<binder>
<binding property="userId" required="true" />
<binding property="tenantId" required="true" />
</binder>
<transition on="submit" bind="true" validate="true"
to="forgotPasswordWebflowInitialization" />
</view-state>
Your configuration seems to be looking for WEB-INF/webapp/xxx-webflow.xml. If your file is indeed located at webapp/webflow/xxx--webflow.xml you should use the following configuration:
<webflow:flow-registry id="flowRegistry"
flow-builder-services="flowBuilderServices" base-path="/webflow">
<!-- here the id is mapped to invoke this flow -->
<webflow:flow-location id="forgotPasswordFlow" path="xxx-webflow.xml" />
</webflow:flow-registry>
Skip exception class functionality is not working properly when MongoItemreader is being used.
Issues:
1. Spring batch is stuck at a particular data row (in my case 15). It calls MessageContextReadConverter and onReadError for same row number 15 -- 3 times.
2. skiplistener is never invoked.
Scenario:
Suppose 20 rows are fetched from MongoDB and at row number 15 configurable exception ".ConversionFailedException" is thrown from a custom class derived from Converter, (MessageContextReadConverter implements Converter)
. MessageContextReadConverter is set during mongoTemplate creation,.
Now, exception thrown at row number 15 is received in custom readlistener (public void onReadError(Exception ex)).
Configuration XML:
<context:property-placeholder location="classpath:application.properties" />
<context:component-scan base-package="com.XXX.YYY.batch.kernel" />
<context:component-scan base-package="com.XXX.YYY.batch.dao" />
<context:annotation-config />
<!-- Enable Annotation based Declarative Transaction Management -->
<tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager" />
<!-- Creating TransactionManager Bean, since JDBC we are creating of type DataSourceTransactionManager -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<batch:job id="txnLogJob" restartable="false">
<batch:step id="txnload">
<tasklet allow-start-if-complete="true" transaction-manager="transactionManager">
<chunk reader="txnLogReader" processor="txnLogProcessor"
writer="txnLogItemWriter" commit-interval="10" skip-limit="3">
<skippable-exception-classes>
<include class="org.springframework.core.convert.ConversionFailedException" />
</skippable-exception-classes>
</chunk>
<listeners>
<listener ref="stepListener" />
<listener ref="chunklistener" />
<listener ref="readlistener" />
<listener ref="skiplistener" />
</listeners>
</tasklet>
</batch:step>
<batch:listeners>
<batch:listener ref="completionListener" />
</batch:listeners>
</batch:job>
<bean id="txnLogReader" class="org.springframework.batch.item.data.MongoItemReader"
scope="step">
<property name="template" ref="mongoTemplate" />
<property name="query" value=" { }" />
<property name="pageSize" value="50" />
<property name="sort">
<map>
<entry key="audit_info.created_on"
value="#{T(org.springframework.data.domain.Sort.Direction).ASC}" />
</map>
</property>
<property name="collection" value="txnlog" />
<property name="targetType" value="com.XXX.YYY.kernel.msg.MessageContext" />
</bean>
<bean id="completionListener"
class="com.XXX.YYY.batch.listeners.JobCompletionNotificationListener" />
<bean id="stepListener"
class="com.XXX.YYY.batch.listeners.StepExecutionListener" />
<bean id="chunklistener"
class="com.XXX.YYY.batch.listeners.ChunkExecutionListener" />
<bean id="readlistener"
class="com.XXX.YYY.batch.listeners.ReadExecutionListener" />
<bean id="skiplistener"
class="com.XXX.YYY.batch.listeners.SkipExecutionListener" />
<bean id="jobParametersDAOImpl" class="com.XXX.YYY.batch.dao.JobParametersDAOImpl" />
<bean id="batchLoader" class="com.XXX.YYY.batch.kernel.BatchLoader" />
<bean id="batchjobParameter" class="com.XXX.YYY.batch.dao.Batch_Job_Parameters" />
<!-- <bean id="reportWriter" class="org.springframework.batch.item.data.MongoItemWriter">
<property name="template" ref="mongoTemplate" /> <property name="collection"
value="txnlog" /> name of the collection to write </bean> -->
<bean id="txnLogItemWriter" class="org.springframework.batch.item.file.FlatFileItemWriter"
scope="step">
<property name="shouldDeleteIfExists" value="true" />
<property name="resource" value="file:target/test-outputs/output.txt" />
<property name="lineAggregator">
<bean
class="org.springframework.batch.item.file.transform.PassThroughLineAggregator" />
</property>
</bean>
<bean id="txnLogProcessor"
class="com.XXX.YYY.batch.processor.MessageContextItemProcessor" />
<bean id="jobLauncher"
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
<bean id="jobRepository"
class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<property name="databaseType" value="MYSQL" />
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
</bean>
<bean id="dataSource" class="com.XXX.YYY.common.DataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="connectionProperties" value="${jdbc.connectionProperties}" />
<property name="initialSize" value="${jdbc.initialSize}" />
<property name="maxTotal" value="${jdbc.maxTotal}" />
<property name="maxIdle" value="${jdbc.maxIdle}" />
<property name="minIdle" value="${jdbc.minIdle}" />
<property name="maxWaitMillis" value="${jdbc.maxWaitMillis}" />
<property name="testOnBorrow" value="${jdbc.testOnBorrow}" />
<property name="testWhileIdle" value="${jdbc.testWhileIdle}" />
<property name="testOnReturn" value="${jdbc.testOnReturn}" />
<property name="validationQuery" value="${jdbc.validationQuery}" />
</bean>
I have a camel, activeMQ, spring based app and running into a peculiar problem w.r.t performance.
When i call producerTemplate.sendBody() it takes anywhere between 40ms and 900ms for the call to return. There is no pattern - its all over the place. The message itself is tiny - less that 100 bytes. Note; Other than these tests, nothing else is going on in the system - no memory issue, no cpu issue etc.
I have tried the following steps:
1) Replaced oracle as my store and used KahaDB - no difference
2) In the activeMQ config i set useAsyncSend to true, alwaysSessionAsync to false - no difference
3) Just for fun i set persistent=false in the - no difference
Till now i was suspecting that the persistence was somehow the culprit - it appears that it is not so
With all the above changes still in place i invoked producerTemplate.sendBody() twice - this is where it gets really interesting - the first invocation takes the same amt of time (between 40 and 800ms) - the second invocation takes less than 1ms. Now that is the kind of performance that i was expecting :-)
I am a little lost - i am suspecting that the for some reason the call to producerTemplate.sendBody() does not return till the consumer thread STARTS, which is why the second call to sendBody returns extremely quickly. It almost makes no sense but i have run out of theories.
Any help and pointers will be really helpful - right now my throughput is looking terrible.
My config file looks like: (i am sending to a queue jmsP1EndPoint)
<broker:broker id="hexgenBroker" brokerName="hexgenBroker"
persistent="false" useJmx="false" start="true">
<broker:transportConnectors>
<broker:transportConnector uri="vm://hexgenBroker" />
</broker:transportConnectors>
<broker:managementContext>
<broker:managementContext createConnector="false" />
</broker:managementContext>
<broker:persistenceAdapter>
<broker:kahaDB directory="activemq-data" journalMaxFileLength="32mb" />
</broker:persistenceAdapter>
<broker:systemUsage>
<broker:systemUsage>
<broker:memoryUsage>
<broker:memoryUsage limit="20 mb"/>
</broker:memoryUsage>
<broker:storeUsage>
<broker:storeUsage limit="1 gb"/>
</broker:storeUsage>
<broker:tempUsage>
<broker:tempUsage limit="200 mb"/>
</broker:tempUsage>
</broker:systemUsage>
</broker:systemUsage>
</broker:broker>
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="jmsDataSource">
<property name="driverClassName" value="${driverClassName}"/>
<property name="url" value="${url}"/>
<property name="username" value="${dbusername}"/>
<property name="password" value="${password}"/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="true"/>
<property name="testWhileIdle" value="true"/>
<property name="timeBetweenEvictionRunsMillis" value="1800000"/>
<property name="numTestsPerEvictionRun" value="3"/>
<property name="minEvictableIdleTimeMillis" value="1800000"/>
<property name="validationQuery" value="SELECT 1 FROM DUAL"/>
</bean>
<camel:camelContext id="hexContext" depends-on="hexgenBroker jms">
<camel:endpoint id="p0EndPoint" pattern="InOut" uri="direct:p0" />
<camel:endpoint id="jmsP1EndPoint" pattern="InOnly" uri="jms:queue:p1" />
<camel:endpoint id="dlq" pattern="InOnly" uri="jms:queue:ActiveMQ.DLQ" />
<camel:endpoint id="directP1EndPoint" pattern="InOnly" uri="direct:p1"/>
<camel:route>
<camel:from ref="p0EndPoint" />
<camel:onException>
<camel:exception>java.lang.Throwable</camel:exception>
<camel:redeliveryPolicy logRetryStackTrace="false" logStackTrace="false"/>
</camel:onException>
<camel:to uri="class:com.hexgen.core.job.P0ContextHolder"/>
<camel:to uri="bean:jobFactory"/>
<camel:to uri="bean:jobPayloadTranslator"/>
<camel:to uri="bean:jobPayloadEnricher"/>
<camel:to uri="bean:jobPropertyValidator"/>
<camel:to uri="bean:jobManager"/>
<camel:to uri="bean:jobBusinessValidator"/>
<camel:to uri="bean:jobInflightDataManager"/>
<camel:to uri="bean:jobComplianceManager"/>
<camel:to uri="bean:jobPayloadPersister"/>
<camel:to uri="bean:jobEventTranslator"/>
</camel:route>
<camel:route>
<camel:from ref="jmsP1EndPoint"/>
<camel:to uri="bean:p1EntryPoint"/>
<camel:transacted />
<camel:to uri="class:com.hexgen.core.job.P1ContextHolder"/>
<camel:to ref="directP1EndPoint" />
</camel:route>
<camel:route>
<camel:from ref="dlq"/>
<camel:to uri="bean:dlqEntryPoint"/>
</camel:route>
<camel:route>
<camel:from ref="directP1EndPoint" />
<camel:onException>
<camel:exception>java.lang.Throwable</camel:exception>
<camel:redeliveryPolicy logRetryStackTrace="false" logStackTrace="false"/>
<camel:to uri="bean:p1Exception"/>
</camel:onException>
<camel:choice>
<camel:when>
<camel:jxpath>in/body/translationNeededAndIsNotReRouted</camel:jxpath>
<camel:bean ref="eventToEventTranslator"/>
<camel:to ref="directP1EndPoint"/>
</camel:when>
<camel:otherwise>
<camel:dynamicRouter>
<camel:method ref="hexgenComponentRouter" method="route" />
</camel:dynamicRouter>
</camel:otherwise>
</camel:choice>
</camel:route>
</camel:camelContext>
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
<property name="brokerURL" value="vm://hexgenBroker" />
<property name="redeliveryPolicy" ref="redeliveryPolicy" />
<property name="prefetchPolicy" ref="prefetchPolicy" />
<property name="alwaysSessionAsync" value="false" />
<property name="useAsyncSend" value="true" />
</bean>
<bean id="prefetchPolicy" class="org.apache.activemq.ActiveMQPrefetchPolicy">
<property name="all" value="0" />
</bean>
<bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
<property name="maximumRedeliveries" value="0"/>
</bean>
<bean id="pooledConnectionFactory" class="com.atomikos.jms.AtomikosConnectionFactoryBean" init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="hexjms" />
<property name="xaConnectionFactory" ref="jmsConnectionFactory" />
<property name="minPoolSize" value="10"/>
<property name="maxPoolSize" value="30"/>
<property name="borrowConnectionTimeout" value="600"/>
</bean>
<bean id="jmsConfig"
class="org.apache.activemq.camel.component.ActiveMQConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory" />
<property name="maxConcurrentConsumers" value="30"/>
<property name="concurrentConsumers" value="15" />
<property name="transacted" value="true" />
<property name="transactionManager" ref="transactionManager" />
<property name="cacheLevelName" value="CACHE_NONE"/>
<property name="errorHandlerLogStackTrace" value="false"/>
<property name="asyncStartListener" value="true"/>
<property name="asyncConsumer" value="true"/>
<property name="deliveryPersistent" value="false"/>
</bean>
<bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig" />
</bean>
<bean class="com.hexgen.p1.core.exceptions.P1ExceptionHandler" id="p1Exception">
</bean>
I'm trying to configure connection pooling in servcemix 4.4.1. I've created a oracle datasource object and set the properties like user, password,url. I deployed the following xml as osgi service in my smx.
Here's my datasource configuration:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource">
<property name="URL" value="jdbc:oracle:thin:#connection:url"/>
<property name="user" value="****"/>
<property name="password" value="*****"/>
</bean>
<service interface="javax.sql.DataSource" ref="dataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="oracleds"/>
</service-properties>
</service>
</blueprint>
The datasource object is created succesfully and I'm able to retrieve the object using jndi lookup in my bundle.
Now I want to apply connection pooling for which I need to declare "maximum connections". Please suggest me how can I declare max no. of connections in the above xml
Thanks in advance.
Here is an example of my blueprint.xml:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xsi:schemaLocation=
"http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"
default-activation="eager">
<cm:property-placeholder id="server.placeholder" persistent-id="test.datasource">
<cm:default-properties>
<cm:property name="driverClassName" value="oracle.jdbc.pool.OracleDataSource" />
<cm:property name="validationQuery" value="SELECT 1 FROM DUAL" />
<cm:property name="defaultReadOnly" value="false" />
<cm:property name="defaultAutoCommit" value="true" />
<cm:property name="maxActive" value="100" />
<cm:property name="whenExhaustedAction" value="2" />
<cm:property name="maxWait" value="-1" />
<cm:property name="maxIdle" value="8" />
<cm:property name="minIdle" value="1" />
<cm:property name="testOnBorrow" value="true" />
<cm:property name="testOnReturn" value="true" />
<cm:property name="timeBetweenEvictionRunsMillis" value="-1" />
<cm:property name="numTestsPerEvictionRun" value="3" />
<cm:property name="minEvictableIdleTimeMillis" value="1800000" />
<cm:property name="testWhileIdle" value="false" />
<cm:property name="softMinEvictableIdleTimeMillis" value="-1" />
<cm:property name="lifo" value="true" />
</cm:default-properties>
</cm:property-placeholder>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value= "${driverClassName}" />
<property name="url" value="jdbc:oracle:thin:#${db.host}:${db.port}:${db.instance}" />
<property name="username" value="${db.user}" />
<property name="password" value="${db.password}" />
<property name="maxIdle" value="1" />
</bean>
<bean id="connectionFactory" class="org.apache.commons.dbcp.DataSourceConnectionFactory">
<argument ref="dataSource" />
</bean>
<bean id="connectionPool" class="org.apache.commons.pool.impl.GenericObjectPool" >
<argument><null/></argument>
<argument value="${maxActive}" />
<argument value="${whenExhaustedAction}" />
<argument value="${maxWait}" />
<argument value="${maxIdle}" />
<argument value="${minIdle}" />
<argument value="${testOnBorrow}" />
<argument value="${testOnReturn}" />
<argument value="${timeBetweenEvictionRunsMillis}" />
<argument value="${numTestsPerEvictionRun}" />
<argument value="${minEvictableIdleTimeMillis}" />
<argument value="${testWhileIdle}" />
<argument value="${softMinEvictableIdleTimeMillis}" />
<argument value="${lifo}" />
</bean>
<bean id="pooledConnectionFactory" class="org.apache.commons.dbcp.PoolableConnectionFactory" >
<argument ref="connectionFactory" />
<argument ref="connectionPool" />
<argument><null/></argument>
<argument value="${validationQuery}" />
<argument value="${defaultReadOnly}" />
<argument value="${defaultAutoCommit}" />
</bean>
<bean id="poolingDataSource" class="org.apache.commons.dbcp.PoolingDataSource" depends-on="pooledConnectionFactory">
<argument ref="connectionPool" />
</bean>
<service interface="javax.sql.DataSource" ref="poolingDataSource"> <!--ref="oracleDataSource"-->
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/testdb"/>
<entry key="datasource.name" value="jdbc/testdb" />
</service-properties>
</service>
</blueprint>
This datasource work fine.
I think the attribute "maxActive" close to what you need.
You can choose between two ways:
use oracle.jdbc.pool.OracleConnectionPoolDataSource as datasource class
use commons-dbcp https://gist.github.com/splatch/2d631ec09f9be0730b1e (this is fork of somebody else gist)
I want to use Spring Web Flow along with Thymeleaf, which was previously configured with Spring MVC. It works, however I get "org.springframework.webflow.definition.registry.NoSuchFlowDefinitionException" on every page. I want to use SWF on certain pages and leave the rest as it was - handled by controllers without flow. Is it possible?
Here's my view config:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oxm="http://www.springframework.org/schema/oxm"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="http://www.springframework.org/schema/oxm
http://www.springframework.org/schema/oxm/spring-oxm.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="templateResolver"
class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
<property name="prefix" value="/WEB-INF/thymeleaf/" />
<property name="suffix" value=".html" />
<property name="templateMode" value="HTML5" />
<!-- Template cache is set to false (default is true). -->
<property name="cacheable" value="false" />
</bean>
<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
<property name="templateResolver" ref="templateResolver" />
<property name="additionalDialects">
<set>
<bean class="org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect" />
</set>
</property>
</bean>
<webflow:flow-executor id="flowExecutor"></webflow:flow-executor>
<bean name="/*"
class="org.springframework.webflow.mvc.servlet.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<webflow:flow-registry id="flowRegistry"
flow-builder-services="flowBuilderServices">
<webflow:flow-location-pattern value="/**/*-flow.xml" />
</webflow:flow-registry>
<webflow:flow-builder-services id="flowBuilderServices"
view-factory-creator="mvcViewFactoryCreator" />
<bean
class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="contentNegotiationManager" ref="cnManager" />
<property name="viewResolvers">
<list>
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver">
<property name="order" value="1" />
</bean>
<bean id="thymeleafViewResolver" class="org.thymeleaf.spring4.view.AjaxThymeleafViewResolver">
<property name="viewClass"
value="org.thymeleaf.spring4.view.FlowAjaxThymeleafView" />
<property name="templateEngine" ref="templateEngine" />
<property name="order" value="2" />
</bean>
</list>
</property>
</bean>
<bean id="mvcViewFactoryCreator"
class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers" ref="thymeleafViewResolver" />
</bean>
<bean id="thymeleafViewResolver" class="org.thymeleaf.spring4.view.AjaxThymeleafViewResolver">
<property name="viewClass"
value="org.thymeleaf.spring4.view.FlowAjaxThymeleafView" />
<property name="templateEngine" ref="templateEngine" />
</bean>
<!-- Simple strategy: only path extension is taken into account -->
<bean id="cnManager"
class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorPathExtension" value="true" />
<property name="ignoreAcceptHeader" value="true" />
<property name="defaultContentType" value="text/html" />
<property name="mediaTypes">
<map>
<entry key="html" value="text/html" />
<entry key="xml" value="application/xml" />
<entry key="atom" value="application/atom+xml" />
</map>
</property>
</bean>