I downloaded dotcms_2.3.2.zip
I have followed this documentation http://dotcms.com/docs/latest/InstallingFromRelease
I changed the url, username and password in ROOT.xml
MSSQL
<Resource name="jdbc/dotCMSPool" auth="Container"
type="javax.sql.DataSource" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:jtds:sqlserver://servername:portnumber/databasename"
username="{xxxxx}" password="{xxxxx}" maxActive="60" maxIdle="10" maxWait="60000"
removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
testOnBorrow="true" validationQuery="SELECT 1" defaultTransactionIsolation="READ_COMMITTED"/>
</Context>
And in server.xml i changed port to 8080
<Connector maxThreads="75" connectionTimeout="3000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
And the main problem is I cant connect the ms sql database to dotCMS because when I go to localhost:8080/admin/ link does work.
Any help?
Maybe,
username="{xxxxx}" password="{xxxxx}"
should look like
username="xxxxx" password="xxxxx"
(without curly braces).
Related
Preface - I was using flink before without ververica and was able to set up log4j JSON logging by leveraging the pre entrypoint script to download the needed jackson dependencies
Question is - for ververica, without building a custom image, is it possible to enable json logging?
I tried using JSONLayout type of logs but jackson is not in the class path, and for some reason marking them as artifacts is not enough for the job/task manager logs
Next, i tried JsonTemplateLayout which does not require jackson or any other dependencies but it does look like the the layouts such as EcsLayout.json or LogstashJsonEventLayoutV1.json also does not exist
my logging config is attached below, it is the same as the default but with the rollingFile appender layout changed
Am I missing something or does this require custom image creation?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Configuration xmlns="http://logging.apache.org/log4j/2.0/config" strict="true">
<Appenders>
<Appender name="StdOut" type="Console">
<Layout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %-60c %x - %m%n" type="PatternLayout"/>
</Appender>
<Appender name="RollingFile" type="RollingFile" fileName="${sys:log.file}" filePattern="${sys:log.file}.%i">
<JsonTemplateLayout eventTemplateUri="classpath:EcsLayout.json"/>
<Policies>
<SizeBasedTriggeringPolicy size="50 MB"/>
</Policies>
<DefaultRolloverStrategy max="5"/>
</Appender>
</Appenders>
<Loggers>
<Logger level="INFO" name="org.apache.hadoop"/>
<Logger level="INFO" name="org.apache.kafka"/>
<Logger level="INFO" name="org.apache.zookeeper"/>
<Logger level="INFO" name="akka"/>
<Logger level="ERROR" name="org.jboss.netty.channel.DefaultChannelPipeline"/>
<Logger level="OFF" name="org.apache.flink.runtime.rest.handler.job.JobDetailsHandler"/>
{%- for name, level in userConfiguredLoggers -%}
<Logger level="{{ level }}" name="{{ name }}"/>
{%- endfor -%}
<Root level="{{ rootLoggerLogLevel }}">
<AppenderRef ref="StdOut"/>
<AppenderRef ref="RollingFile"/>
</Root>
</Loggers>
</Configuration>
Yes, you can use JSON logging without a custom image in Ververica Platform. Let me take JsonTemplateLayout as an example.
Step-1:
Prepare the log4j-layout-template-json-2.14.1.jar (or whatever version you are using) and the LogstashJsonEventLayoutV1.json (from https://logging.apache.org/log4j/2.x/manual/json-template-layout.html)
Step-2:
Create a k8s volume from configmap using the log4j-layout-template-json-2.14.1.jar in the k8s namespace where you will run this job:
kubectl create configmap jsonlogging --from-file=log4j-layout-template-json-2.14.1.jar -n vvp-ops-jobs
Step-3:
In the Deployment configuration page (YAML), add the volume mount for json template jar (under spec.template.spec.kubernetes):
pods:
volumeMounts:
- name: jsonlogging
volume:
configMap:
name: jsonlogging
name: jsonlogging
volumeMount:
mountPath: /flink/lib/log4j-layout-template-json-2.14.1.jar
name: jsonlogging
subPath: log4j-layout-template-json-2.14.1.jar
Step-4:
Add the LogstashJsonEventLayoutV1.json to the Deployment Artifacts and refer to it under the Deployment configuration page (YAML):
spec:
template:
spec:
artifact:
additionalDependencies:
- >-
s3://vvp-lab/artifacts/namespaces/default/LogstashJsonEventLayoutV1.json
Step-5:
Configure the logging template for the Deployment:
<Appender name="RollingFile" type="RollingFile" fileName="${sys:log.file}" filePattern="${sys:log.file}.%i">
<Layout type="JsonTemplateLayout" eventTemplateUri="file:///flink/usrlib/LogstashJsonEventLayoutV1.json" />
<Policies>
<SizeBasedTriggeringPolicy size="50 MB"/>
</Policies>
<DefaultRolloverStrategy max="1"/>
</Appender>
Notes:
For Step-2 and Step-3, you cannot just add this jar as an additional dependency for a deployment, because the jar will be available only in the user class loader. Flink needs this jar to be available in the parent class loader in order to format logs. You can also bake this jar into the /flink/lib directory with a custom image.
For Step-4, the json file can be placed either in the 'additional dependencies' or in the same place as the jar file. (but the latter one means you will need to refer to that json using 'classpath:LogstashJsonEventLayoutV1.json' rather than absolute file path in Step-5)
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.
In WildFly standalone configuration we can define a validation query in the datasource. In case the DB connection is lost, after the background validation milliseconds defined, the connection can be recovered. Without this validation if the connection is lost, it will not be recovered until the application is restarted.
<datasource jndi-name="java:jboss/datasources/MyDS" pool-name="MyDS" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://localhost:5432/myDB</connection-url>
<driver>postgresql</driver>
<security>
<user-name>dbuser</user-name>
<password>password</password>
</security>
<validation>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>true</background-validation>
<background-validation-millis>30000</background-validation-millis>
</validation>
</datasource>
How can I achieve the same in Thorntail project.yml file?
thorntail:
datasources:
data-sources:
MyDS:
driver-name: postgresql
connection-url: jdbc:postgresql://localhost:5432/myDB
user-name: dbuser
password: password
I tried adding a validation node, but it didn't work
validation:
check-valid-connection-sql: select 1
validate-on-match: false
background-validation: true
background-validation-millis: 30000
Here's an example PostgreSQL datasource taken from this documentation: https://docs.thorntail.io/2.7.0.Final/#_example_datasource_definitions It includes connection validation, too.
thorntail:
datasources:
data-sources:
MyDS:
driver-name: postgresql
connection-url: jdbc:postgresql://localhost:5432/postgresdb
user-name: admin
password: admin
valid-connection-checker-class-name: org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker
validate-on-match: true
background-validation: false
exception-sorter-class-name: org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter
Other connection validation options, including those that you use, are described in the same documentation.
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.
Hi
When I try to connect to the datasource using JNDI, I am getting this error:
[org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.apache.roller.weblogger.business.DatabaseProvider.getConnection(DatabaseProvider.java:179)
at org.apache.roller.weblogger.business.DatabaseProvider.<init>(DatabaseProvider.java:141)
at org.apache.roller.weblogger.business.startup.WebloggerStartup.prepare(WebloggerStartup.java:171)
at org.apache.roller.weblogger.ui.core.RollerContext.contextInitialized(RollerContext.java:138)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
at java.sql.DriverManager.getDriver(DriverManager.java:253)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
... 30 more]
Context.xml
<Context path="/roller" docBase="c:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\roller" debug="0">
<Resource name="jdbc/rollerdb" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/rollerdb?autoReconnect=true&useUnicode=true&characterEncoding=utf8-&mysqlEncoding=utf8"
username="roller_user"
password="password"
maxActive="20" maxIdle="3" removeAbandoned="true"
maxWait="3000"
/>
<Resource name="mail/Session"
auth="Container"
type="javax.mail.Session"
username="username#gmail.com"
password="password"
mail.debug="false"
mail.user="username#gmail.com"
mail.password="password"
mail.smtp.from="username#gmail.com"
mail.transport.protocol="smtp"
mail.smtp.port="465"
mail.smtp.host="smtp.gmail.com"
mail.smtp.auth="true"
mail.smtp.starttls.enable="true"
mail.smtp.socketFactory.port="465"
mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
mail.smtp.socketFactory.fallback="false"
/>
</Context>
web.xml
<web-app .. >
...
<!-- jndi resources -->
<resource-ref>
<res-ref-name>jdbc/rollerdb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<res-ref-name>mail/Session</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
roller-custom.properties
installation.type=auto
database.configurationType=jndi
database.jndi.name=jdbc/rollerdb
mail.configurationType=jndi
mail.jndi.name=mail/Session
I've got mysql-connector-java-5.1.15-bin.jar, activation.jar and mail.jar in tomcat's lib diectory and the web application roller in tomcat's webapps folder.
I've not been able to understand what I am doing wrong here. Could someone help me understand what am I missing here?
Thanks.
Thanks.
I just got through a similar error and it turns out my context.xml file was slightly mangled. I think this most likely is where the problem resides.
My suggestion in comparing context.xml files between myself and you, I say try this
driverClass
In place of
driverClassName
I've solved this problem changing the import reference (in my case) from:
import org.apache.tomcat.dbcp.dbcp.BasicDataSource;
to
import org.apache.commons.dbcp.BasicDataSource;
My error was generated because I always use CRTL+o for import references, and when I made the import I had not the .jar in my references.
I hope this may be useful for others.
You could also encounter this error if your Tomcat version is different ..then ur context.xml would have to look different ...for detail go to this page ..a must read for this problem :
http://www.crazysquirrel.com/computing/java/connection-pooling.jspx
regs
Karthic
In my case helped following changes: in APPLICATION_PATH/WebContent/META_INF/context.xml
old code:
<resource name="jdbc/internships_db" auth="Container" type="javax.sql.DataSource">
<param name="username" value="my_user" />
<param name="password" value="my_password" />
<param name="url" value="jdbc:mysql://localhost:3306/internships_db" />
</resource>
new code:
<Resource name="jdbc/internships_db"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
username="my_user"
maxWait="10000"
driverClassName="com.mysql.jdbc.Driver"
password="my_password"
url="jdbc:mysql://localhost:3306/internships_db"/>
Jdbc-Driver class is placed under the path
/user_path/tomcat-instance_path/webapps/app_name/WEB-INF/lib/com.mysql.jdbc_5.1.5.jar