Could not find host in the application's host system: 'vespa-container' - vespa

I deployed vespa docker image on two nodes, got the following errors while running '/opt/vespa/bin/vespa-deploy prepare', configs are as follows. If I replaced 'yyy.com' with 'localhost', it looks fine. Anyone know what was the issue?
Session 21 for tenant 'default' created.
Preparing session 21 using http://localhost:19071/application/v2/tenant/default/session/21/prepared
Request failed. HTTP status code: 400
Invalid application package: default.default: Error loading model: Could not find host in the application's host system: 'vespa-container'. Hostsystem=host 'yyy.com',host 'xxx.com'
---- hosts.xml-----
<hosts>
<host name="yyy.com">
<alias>admin0</alias>
</host>
<host name="xxx.com">
<alias>node2</alias>
</host>
</hosts>
--- services.xml ---
3 <services version="1.0">
4 <admin version="2.0">
5 <adminserver hostalias="admin0"/>
6 <configservers>
7 <configserver hostalias="admin0"/>
8 </configservers>
9 </admin>
10 <container id="container" version="1.0">
11 <document-api />
12 <search />
13 <nodes>
14 <node hostalias="admin0" />
15 <node hostalias="node2" />
16 </nodes>
17 </container>
18
19 <content id="music" version="1.0">
20 <redundancy>1</redundancy>
21 <documents>
22 <document type="music" mode="index" />
23 </documents>
24 <nodes>
25 <node hostalias="admin0" distribution-key="0" />
26 <node hostalias="node2" distribution-key="1" />
27 </nodes>
28 </content>
29
30 </services>
//inside docker container, /etc/hosts
172.17.0.2 vespa-container

Your problem is that 'localhost' inside the container is 'vespa-container', but it must be the FQDN reachable form the other nodes, e.g xxx.com/yyy.com.
If you are interested in the details, the exact code that resolves the name vespa-container but must resolve to the FQDN is getPreferredHostname in https://github.com/vespa-engine/vespa/blob/master/vespajlib/src/main/java/com/yahoo/net/HostName.java

I suppose this is because your container probably do not resolve "yyy.com" and "xxx.com".
Can you ping from inside the container the yyy.com and xxx.com ? What are the hostname of the 2 containers you have on your nodes?
You should put your nodes IP and hostname in your /etc/hosts, so they can communicate with each other.

Related

Need two services that share database in Tomcat 9

I would like to run two tomcat services on two ports (8080,8181) with different codeBases, but sharing the same database resource. When I do this, I get "javax.naming.NameNotFoundException: Name [comp/env/jdbc/mydb] is not bound in this Context. Unable to find [comp]." when it tries to initialize the second Service.
My Services look like this in the server.xml:
...
<GlobalNamingResources>
<Resource auth="Container" name="jdbc/mydb" url="jdbc:db2://myserver:50000/mydb" username="xxx" password="xxx" .... />
</GlobalNamingResources>
...
<Service name="Catalina8080">
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
....
<Host name="localhost" appBase="webapps8080" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" .... />
</Host>
</Engine>
</Service>
<Service name="Catalina8181">
<Connector port="8181" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8444" />
<Engine name="Catalina" defaultHost="localhost">
....
<Host name="localhost" appBase="webapps8181" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" .... />
</Host>
</Engine>
</Service>
My server level context file looks like :
<Context>
...
<ResourceLink name="jdbc/mydb" global="jdbc/mydb" type="javax.sql.DataSource" />
</Context>
I've tried adding and removing the Resource links at the application level context file, but nothing seems to change the outcome. Any thoughts are greatly appreciated.
You should change the name of your <Engine> in the second service: there can be only one naming context for each combination of engine name, host name and context name.
In your case the combination (Catalina, localhost, your application name) probably appears twice, hence you should be able to find an entry like this:
SEVERE [main] naming.namingContextCreationFailed
in the logs and JNDI doesn't work in the second context.

log4net log file not being written when the app is deployed

I have a WPF app that uses log4net. When I run it in Visual Studio, the log file is created in the Debug or Release folder as expected.
However, when I create an installer and run the installed app, the log file is not created. I added the following lines to the code...
string logFilePath = ((Hierarchy)LogManager.GetRepository())
.Root.Appenders.OfType<FileAppender>()
.FirstOrDefault()?.File;
using (StreamWriter sw = new StreamWriter(#"d:\log.log")) {
sw.WriteLine("Log file: " + logFilePath);
}
...to enable me to check that the log file was being written in the location I expected. It showed me that the log file was supposed to be written to C:\Program Files (x86)\Physio Diary\PhysioDiaryClient.log which is what I expected.
However, the file doesn't exist. Any idea why?
Here is the top of the App.config file...
<?xml version="1.0"
encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net" />
</configSections>
<log4net>
<appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
<param name="File"
value="PhysioDiaryClient.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="2" />
<maximumFileSize value="1MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-7level %logger - %message%newline%exception" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingFileAppender" />
</root>
</log4net>
The bottom of the file looks like this...
<startup>
<supportedRuntime version="v4.0"
sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
The bits in between are all to do with the WCF services that the app uses.
Anyone any ideas?
Edit: As a test, I tried hard-coding the log file path in App.config to my D: drive (so it's hard-coded, and no question of a permissions issue), but the file still wasn't created.
Thanks to #dymanoid for pointing me in the right direction. The log4net docs are a bit weak in this area, but I found this answer that pointed out that you can use normal environment variables in the config file.
With the aid of this list of environment variables, I ended up with the following...
<param name="File"
value="${LOCALAPPDATA}\Physio Diary\PhysioDiaryClient.log" />
This correctly write the file to C:\Users\MyUsername\AppData\Local\Physio Diary\PhysioDiaryClient.log
Hope this helps someone.

Running SQL Script file through Wix using <sql:SqlScript> element

I am new to Wix Installer. I have a requirement where I have to provide credentials for SQL Server login and run a script from a specific path.
I am not getting what's going wrong.The project is build successfully and .msi is created. After running it I get the following Error:
Error 26204. Error -2147217900: failed to execute SQL string, error detail: Incorrect syntax near '»'., SQL key: CreateUpsizingDatabase SQL string: print convert(varchar(25),GetDate(),121) + ' Executing file: SqlTest.sql'
My Sql Script File is as below:
print convert(varchar(25),GetDate(),121) + ' Executing file: SqlTest.sql'
Below is My code:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension">
<Product Id="*" Name="SqlTest" Language="1033" Version="1.0.0.0" Manufacturer="BLRSCCMCAS01" UpgradeCode="0931a445-07bf-4494-b130-a1f96155021f">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SqlTest" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<Binary Id="CreateUpsizingDatabase" SourceFile="C:\Temp\SqlTest.sql" />
<util:User Id="SQLUser" Name="[User]" Password="[Password]" />
<sql:SqlDatabase Id="SqlDatabase" Database="[MyDb]" Server="[Server]" User="SQLUser" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SqlTest" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="SqlComponent" Guid="15CCE46E-8EA5-42CA-80C5-AC3DB30A9716">
<sql:SqlScript Id="CreateDatabases" SqlDb="SqlDatabase" ExecuteOnInstall="yes" BinaryKey="CreateUpsizingDatabase" />
<CreateFolder/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
It looks like you have a UTF8 BOM () in there. Try saving the file as "Unicode (UTF8 Without signature)" using the advanced save options in visual studio.
I got the same error, UTF8 with or without signature both failed.
I think the chars in our script string cause the problem (in my case, I included some chinese chars).
I tried to re-generated sql script from sql server, and save this file in ANSI format. It works!
And i did some query, the chinese chars are correct in sql server.
an article you might want to refer: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Error-executing-sql-scripts-with-WIX-td1488703.html

mod_jk not working with apache2.4 and tomcat7

linux
tomcat 7
apache 2.4
We already have tomcat6 and apache2.2 working on this server. I am attempting to get the newer versions running for out next project. Apache2.4 is working and listening on port 1904. Tomcat is working and listening on port 8081. The AJP is set to 8010.
I have compiled mod_jk against the apache server and it created the mod_jk.so file. I copied the file over to the modules folder.
My workers.properties
worker.list=worker3
worker.myworker.type=ajp13
worker.myworker.host=localhost
worker.myworker.port=8010
My http.conf has:
LoadModule jk_module modules/mod_jk.so
<IfModule jk_module>
Include conf/extra/mod_jk.conf
</IfModule>
The mod_jk.conf is in that directory and contains:
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkShmFile logs/jk-runtime-status
JkLogStampFormat "[%b %d %Y - %H:%M:%S] "
JkRequestLogFormat "%w %V %T"
JkAutoAlias /usr/local/tomcat7/webapps
JkMountCopy All
JkMount /* worker3
JkUnMount /cgi-bin/* worker3
JkUnMount /htdocs/* worker3
server.xml is:
<?xml version='1.0' encoding='utf-8'?>
<Server port="8015" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8444" />
<Connector port="8010" protocol="AJP/1.3" redirectPort="8444" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
</Server>
I am under the assumption I should be able to goto [server]:1904/examples and get the same thing that I get when I goto [server]:8081/examples.
As another peice of configuration info I do have a xml file in tomcathome/conf/Catalina/localhost named srvc.xml
<Context path="" docBase="/usr/local/tomcat7/web"/>
This works when addressing the tomcat server. Thanks for eyeballing all this and for any help if provided.
Finally, found it with the help of a coworker. The worker.properties needs to look like:
worker.list=worker3
worker.worker3.type=ajp13
worker.worker3.host=localhost
worker.worker3.port=8010
The original had worker.myworker.type and so on.

Silverlight Webpart: Error occurred in deployment step 'Activate Features' because of autognerated code

I'm developing multiple Silverlight-Webparts in a single Solution in VisualStudio 2012 for SharePoint 2010.
Sometimes this error occurs in {Project1}:
Error occurred in deployment step 'Activate Features':
Failed to instantiate file "SiteAssets/{Project1Folder}/$SilverlightXapFile$"
from module "Designer": Source path "Features\{Project1Folder}\{otherProject}.xap" not found.
Elements.xml
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
<Module Name="{Module}" List="113" Url="_catalogs/wp">
<File Path="{Module}\{Webpart}.webpart" Url="{ProjectWebpart}.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="{Company}" />
</File>
</Module>
<Module Name="{Project}">
<File Path="{Project}\{Project1}.xap" Url="SiteAssets/{Project1Folder}/{Project1}.xap" />
<File Path="{Project}\{otherProject}.xap" Url="SiteAssets/{Project1Folder}/$SilverlightXapFile$" />
</Module>
</Elements>
Thanks to Subversion: I know Visual Studio added a line to Elements.xml of the {Project1} Webpart.
<File Path="{Project}\{otherProject}.xap" Url="SiteAssets/{Project1Folder}/$SilverlightXapFile$" />
When I delete this new line, it will work again.
My question:
How do I prevent VisualStudio from adding "wrong" references in Elements.xml to other Silverlight-Projects in the same solution?

Resources