Tomcat context.xml resource password not allow special charcaters - tomcat6

I have been trying for add data source in tomcat conf/context.xml as below.
<Resource name="jdbc/DS1"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://121.111.11.91;databaseName=DB_NAME"
username="testUanme"
password="TT&123$"
maxPoolSize="50"
removeAbandoned="true"
removeAbandonedTimeout="1000"
logAbandoned="true"
/>
After set Data Source entry in config file i m restarting tomcat and it gives error like:
The reference to entity "TT" must end with the ';' delimiter.
Password not allowing special characters which i have used & and $.
Please suggest what should be there which allows me to enter special characters in password..
Thanks in advance.

If you replace & in your password with & you should be fine.

Related

How to encrypt oracle ucp database connection in tomcat config?

I want to encrypt my database connection in tomcat 7 config (server.xml). I'm using the connectionProperties to provide encryption algorithm, but somehow, these properties are not working.
Here is the chunk from my config file:
<Resource
name="jdbc/TestDb" auth="Container"
type="oracle.ucp.jdbc.PoolDataSource"
description="UCP Pool in Tomcat"
factory="oracle.ucp.jdbc.PoolDataSourceImpl"
connectionFactoryClassName="oracle.jdbc.pool.OracleDataSource"
minPoolSize="10"
maxPoolSize="100"
inactiveConnectionTimeout="20"
user="******"
password="*****"
connectionProperties="oracle.net.encryption_client=REQUIRED,
oracle.net.encryption_types_client=AES256,
oracle.net.crypto_checksum_client=REQUIRED,
oracle.net.crypto_checksum_types_client=SHA512"
url="jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=***)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=***)))"
connectionPoolName="UCPPool"
sqlForValidateConnection="select 1 from DUAL"
validateConnectionOnBorrow="true" />
Tried with semicolon in connectionProperties in place of comma. But nothing is working.
Please see, if someone can help.
Try entering values in below format -
{prop1=val1, prop2=val2, ..., propN=valN}
All key value pairs should be separated by ", " (comma and space char)and should be placed within {}.
For example in your case, it should be -
connectionProperties="{oracle.net.encryption_client=REQUIRED, oracle.net.encryption_types_client=AES256, oracle.net.crypto_checksum_client=REQUIRED, oracle.net.crypto_checksum_types_client=SHA512}"

Unable to start Kafka Server using SASL_PLAINTEXT authentication

I'm trying to run Apache Kafka on Windows Server 2016 with the following configurations
server.propertiers:
delete.topic.enable=true
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=PLAIN
sasl.enabled.mechanisms=PLAIN
authorizer.class.name=kafka.security.auth.SimpleAclAuthorizer
allow.everyone.if.no.acl.found=true
security.protocol=SASL_PLAINTEXT
listeners=SASL_PLAINTEXT://127.0.0.1:9092
advertised.listeners=SASL_PLAINTEXT://localhost:9092
listener.security.protocol.map=SASL_PLAINTEXT:SASL_PLAINTEXT
kafka_server_jaas.conf:
KafkaServer {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="username"
password="password"
user_kafkaadmin="password2";
};
Client {};
start-kafka.bat:
#echo off
SET KAFKA_OPTS = "-Djava.security.auth.login.config=C:\Kafka\config\kafka_server_jaas.conf"
C:\Kafka\bin\windows\kafka-server-start.bat C:\Kafka\config\server.properties
However I'm getting the following error
ERROR [KafkaServer id=0] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
java.lang.IllegalArgumentException: Could not find a 'KafkaServer' or 'sasl_plaintext.KafkaServer' entry in the JAAS configuration. System property 'java.security.auth.login.config' is not set
at org.apache.kafka.common.security.JaasContext.defaultContext(JaasContext.java:133)
at org.apache.kafka.common.security.JaasContext.load(JaasContext.java:98)
at org.apache.kafka.common.security.JaasContext.loadServerContext(JaasContext.java:70)
at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:121)
at org.apache.kafka.common.network.ChannelBuilders.serverChannelBuilder(ChannelBuilders.java:85)
at kafka.network.Processor.<init>(SocketServer.scala:747)
at kafka.network.SocketServer.newProcessor(SocketServer.scala:394)
at kafka.network.SocketServer$$anonfun$kafka$network$SocketServer$$addDataPlaneProcessors$1.apply$mcVI$sp(SocketServer.scala:279)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:160)
at kafka.network.SocketServer.kafka$network$SocketServer$$addDataPlaneProcessors(SocketServer.scala:278)
at kafka.network.SocketServer$$anonfun$createDataPlaneAcceptorsAndProcessors$1.apply(SocketServer.scala:241)
at kafka.network.SocketServer$$anonfun$createDataPlaneAcceptorsAndProcessors$1.apply(SocketServer.scala:238)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at kafka.network.SocketServer.createDataPlaneAcceptorsAndProcessors(SocketServer.scala:238)
at kafka.network.SocketServer.startup(SocketServer.scala:121)
at kafka.server.KafkaServer.startup(KafkaServer.scala:263)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
at kafka.Kafka$.main(Kafka.scala:84)
at kafka.Kafka.main(Kafka.scala)
Am I missing something in the configuration?
Thank you,
Try to remove spaces before and after the equal sign:
SET KAFKA_OPTS=-Djava.security.auth.login.config=C:\Kafka\config\kafka_server_jaas.conf
Because normally you should not put a space on either side of the equal sign. A space before the equal sign will become part of the name; a space after the equal sign will become part of the value.

Mule - how to get the name of the file created in an outbound endpoint

I have a Mule application that is writing a file in an outbound endpoint, with the config below:
<file:outbound-endpoint path="${Outbound}" outputPattern="outputFile_#[function:datestamp:yyyyMMddHHmmss].csv" doc:name="Output File"/>
Following this point in the flow I need to display a log message along the lines of "Successfully created file {filename}".
The issue I'm having is that I can't find a way of displaying the name of the file I have just created. I could put: Successfully created file outputFile_#[function:datestamp:yyyyMMddHHmmss].csv, but there is a chance that the datestamp may differ by one second.
Is there a way in Mule that I can display the name of the file I've just written?
UPDATE
Following the response from #til_b, I've achieved this using the following:
<set-variable value="outputFile_#[function:datestamp:yyyyMMddHHmmss].csv" variableName="Filename" doc:name="Variable"/>
<file:outbound-endpoint path="${Outbound}" outputPattern="#[variable:Filename]" doc:name="Output File"/>
<logger level="INFO" message="Successfully created file #[variable:Filename]" doc:name="Logger" />
I dont know about mule, but when i encounter such a problem while programming i store the generated filename in a variable, and then use that variable to actually create the file and display the message.
In Pseudocode:
var filename = #yyyymmddhhMMss.csv
create_file(filename)
log_message(filename + ' successfully created')

msdeploy + setParameters.xml, how to set web physical file location

This question has been danced around a bit, forgive me if it is a duplicate but I haven't been able to find an exact answer.
I am trying to create a Parameters.xml for deployment configuration that specifies the destination physical file folder for a web site. This is for an automated build using TeamCity, e.g. commandline using .deploy.cmd.
Can someone explain what I need to do?
Parameters.xml:
<parameter name="physicalPathLocation" description="Physical path where files for this Web service will be deployed." defaultValue="\" tags="PhysicalPath">
<parameterEntry kind="DestinationVirtualDirectory" scope="Default\ Web\ Site/iag\.application\.services\.exampleservice/" match="" />
</parameter>
And in SetParameters.xml
<setParameter name="physicalPathLocation" value="C:\MyFolder\MySite" />
I suspect my problem is in how I am declaring the scope but am unsure what needs to be done.
Assuming Default Web Site/iag.application.services.exampleservice is a virtual directory in IIS (DestinationVirtualDirectory is only valid for "applications"), you can probably just get away with removing the / suffix and not encoding it. (I've also removed the match attribute)
<parameter name="physicalPathLocation"
description="Physical path where files for this Web service will be deployed."
defaultValue="\"
tags="PhysicalPath"
>
<parameterEntry kind="DestinationVirtualDirectory"
scope="Default Web Site/iag.application.services.exampleservice" />
</parameter>
Keep in mind that you don't have to declare parameters before you set them. You could just as easily declare the full parameter and set it at the same time:
<setParameter name="physicalPathLocation"
kind="DestinationVirtualDirectory"
scope="Default Web Site/iag.application.services.exampleservice"
value="C:\MyFolder\MySite" />

Is it possible to put myBatis (iBatis) xml mappers outside the project?

According to the user guide i am able to use file path instead of
resource:
// Using classpath relative resources
<mappers>
<mapper resource="org/mybatis/builder/AuthorMapper.xml"/>
</mappers>
// Using url fully qualified paths
<mappers>
<mapper url="file:///var/sqlmaps/AuthorMapper.xml"/>
</mappers>
in my project I'm trying to put my mapper xml "outside" the project
and i'm doing this:
<mapper url="file://D:/Mappers/ComponentMapper1.xml" />
The output of my log4j console:
Error building SqlSession.
The error may exist in file://D:/Mappers/ComponentMapper1.xml
Cause: org.apache.ibatis.builder.BuilderException: Error parsing
SQL Mapper Configuration. Cause: java.net.UnknownHostException: D
Is it bug or it's me doing something wrong?
You just need an additional forward slash before the drive letter.
Sql Map Config looks for mapping files relatively to the classpath, so just try adding your ComponentMapper1.xml somewhere to the classpath.
set CLASSPATH=%CLASSPATH%;D:/Mappers/
...
<mapper resource="ComponentMapper1.xml" />
You must use
<mapper url="file:///usr/local/ComponentMapper1.xml" />
Where file:///usr/local/ComponentMapper1.xmlis the path to your XML File, instead of the resource if you want use mappers outside resource dir.

Resources