[英]How to deploy the broadleaf demo on my own Tomcat server?
I was able to start the Broadleaf demo application from the provided scripts adminstart.sh and startsite.sh. 我能够从提供的脚本adminstart.sh和startsite.sh启动Broadleaf演示应用程序。 I was also able to change the database to MySQl.
我还能够将数据库更改为MySQl。 However, I do not understand how to create a war that can run on my Tomcat instance.
但是,我不了解如何创建可以在Tomcat实例上运行的战争。
I see that broadleaf does things differently as compared to the common approach. 与普通方法相比,我发现阔叶树的处理方式有所不同。 Usually I put the context values into the file application-context.
通常,我将上下文值放入文件application-context中。 xml that is referred in web.xml.
web.xml中引用的xml。 There is no need for modifying Tomcat context.xml.
无需修改Tomcat context.xml。 The example is
这个例子是
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/application-context.xml</param-value>
</context-param
In the broadleaf configuration there are several context parameters 在阔叶配置中,有几个上下文参数
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>blAdmin.root</param-value>
</context-param>
<context-param>
<param-name>patchConfigLocation</param-name>
<param-value>
classpath:/bl-open-admin-contentClient-applicationContext.xml
classpath:/bl-open-admin-contentCreator-applicationContext.xml
classpath:/bl-admin-applicationContext.xml
classpath:/bl-cms-contentClient-applicationContext.xml
classpath:/bl-cms-contentCreator-applicationContext.xml
classpath*:/blc-config/admin/bl-*-applicationContext.xml
classpath:/applicationContext.xml
classpath:/applicationContext-email.xml
/WEB-INF/applicationContext-datasource.xml
/WEB-INF/applicationContext-admin-security.xml
/WEB-INF/applicationContext-admin-filter.xml
/WEB-INF/applicationContext-admin.xml
</param-value>
</context-param>
<context-param>
<param-name>shutdownHookMethod</param-name>
<param-value>forceFlush</param-value>
</context-param>
Plus in addition in web.xml: 加上web.xml:
<!-- Initialize spring mvc -->
<servlet>
<servlet-name>admin</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/applicationContext-servlet-open-admin.xml
classpath:/applicationContext-servlet-admin.xml
classpath:/applicationContext-servlet-cms-contentClient.xml
classpath:/applicationContext-servlet-cms-contentCreator.xml
classpath:/bl-menu-admin-applicationContext-servlet.xml
classpath*:/blc-config/admin/bl-*-admin-applicationContext-servlet.xml
/WEB-INF/applicationContext-servlet-admin.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
The result is that the Tomcat instance contains context.xml in the conf directory that provides database pool configuration: 结果是Tomcat实例在提供数据库池配置的conf目录中包含context.xml:
What is the best way of utilizing broadleaf in my application? 在我的应用程序中利用阔叶的最佳方法是什么?
Configuration 组态
<resource-ref>
<description>WEB</description>
<res-ref-name>jdbc/web</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>STORAGE</description>
<res-ref-name>jdbc/storage</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>SECURE</description>
<res-ref-name>jdbc/secure</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
keytool -genkey -alias tomcat -keyalg RSA -storepass password
<Connector
protocol="org.apache.coyote.http11.Http11NioProtocol"
port="8443" maxThreads="200"
scheme="https" secure="true"
SSLEnabled="true"
keystorePass="password"
clientAuth="false"
sslProtocol="TLS"
/>
<user username="tomcat" password="password" roles="manager-gui"/>
username="${database.user}" : Replace with your database username (eg. broadleaf)
password="${database.password}" : Replace with your database password
driverClassName="${database.driver}" : Replace with your database classname (eg. org.postgresql.Driver)
url="${database.url}" : Replace with your database URL with database path, port and name. (eg. jdbc:postgresql://localhost:5432/broadleaf)
WAR directory is full path to your war in target directory WAR目录是目标目录中战争的完整路径
Don't forget to change blPU.hibernate.hbm2ddl.auto in development.properties from create to update (standalone tomcat have trouble to create tables - that's my expirience with postreSQL) 不要忘记将development.properties中的blPU.hibernate.hbm2ddl.auto从create更改为update(独立的tomcat很难创建表-这就是我对postreSQL的经验)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.