如何在Tomcat上运行broadleaf而不是jettyserver ..? [英] How to run broadleaf on Tomcat instead of jettyserver..?

查看:231
本文介绍了如何在Tomcat上运行broadleaf而不是jettyserver ..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循broadleafcommerce文档中提供的所有说明。在更改Mysql集成之前,我可以在jettyserver上运行该站点。但是在我遵循入门页面中提供的Mysql集成说明之后,它停止了对jettyserver的工作...什么可能是问题..?



[]



所以我试过在tomcat 7.0服务器上运行该网站...但在运行catalina.sh时看到以下错误

  2014年11月18日12:27:29 PM org.apache.catalina.core.NamingContextListener addResource 
警告:无法在JMX中注册:javax.naming.NamingException:$ {database.driver}
2014年11月18日12: 27:29 PM org.apache.catalina.core.StandardContext startInternal
SEVERE:错误getConfigured
2014年11月18日12:27:29 PM org.apache.catalina.core.StandardContext startInternal
严重:由于以前的错误,上下文[/ mycompany]启动失败
2014年11月18日12:27:29 PM org.apache.catalina.startup.HostConfig deployWAR
信息:部署Web应用程序存档/用户/ mac /apache-tomcat-7.0.57/webapps/mycompany.war已完成2,617 ms
2014年11月18日12:27:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO:部署web应用程序目录/Users/mac/apache-tomcat-7.0.57/webapps/docs
2014年11月18日12:27:29 PM org.apache.tomcat.util.digester.Digester fatalError
SEVERE :第29行第6列解析致命错误:根元素后面的文档中的标记必须格式正确。
org.xml.sax.SAXParseException:根元素后的文档中的标记必须格式正确。
SEVERE:发生在第29行第6列
2014年11月18日12:27:30 PM org.apache.catalina.startup.ContextConfig configureStart
SEVERE:标记此应用程序由于以前的错误而不可用$ s
2014年11月18日12:27:30 .apache.catalina.core.StandardContext startInternal
SEVERE:由于以前的错误,上下文[]启动失败

这是我的tomcat / config的context.xml:

 <?xml version ='1.0'encoding =' UTF-8' >?; 
<! -
根据一个或多个
贡献者许可协议授予Apache Software Foundation(ASF)。有关版权所有权的其他信息,请参阅以
发布的NOTICE文件。
ASF根据Apache许可证版本2.0
(许可证)向您授予此文件;您不得使用此文件,除非符合
许可证。您可以以

获得许可证副本http://www.apache.org/licenses/LICENSE-2.0


- >
<! - 将为每个Web应用程序加载此文件的内容 - >
<上下文>

<资源auth =容器
name =local_jdbc_db
type =javax.sql.DataSource
driverClassName =com.mysql.jdbc $ D
password =admin123/>
url =
< / Context>
< WatchedResource> WEB-INF / web.xml< / WatchedResource>

<! - 取消注释以禁用Tomcat重新启动时的会话持久性 - >
<! -
< Manager pathname =/>
- >

<! - 取消注释以启用Comet连接(在会话过期中提供事件
以及webapp生命周期) - >
<! -
< Valve className =org.apache.catalina.valves.CometConnectionManagerValve/>
- >

< / Context>

和我的server.xml

 <?xml version ='1.0'encoding ='utf-8'?> 
<! -
根据一个或多个
贡献者许可协议授予Apache Software Foundation(ASF)。有关版权所有权的其他信息,请参阅以
发布的NOTICE文件。
ASF根据Apache许可证版本2.0
(许可证)向您授予此文件;您不得使用此文件,除非符合
许可证。您可以以

获得许可证副本http://www.apache.org/licenses/LICENSE-2.0

除非适用法律要求或书面同意根据许可证分发的软件
以按原样分配,
,不附带任何明示或暗示的担保或条件。
请参阅许可证,以获取有关权限的特定语言和
许可证下的限制。
- >
<! - 注意:服务器本身不是容器,因此您可能不会在此级别定义子组件,例如阀。
/docs/config/server.html
- >中的文档
< Server port =8005shutdown =SHUTDOWN>
< Listener className =org.apache.catalina.startup.VersionLoggerListener/>
<! - 安全监听器。 /docs/config/listeners.html
< Listener className =org.apache.catalina.security.SecurityListener/>中的文档
- >
<! - APR库加载器。 /docs/apr.html上的文档 - >
< Listener className =org.apache.catalina.core.AprLifecycleListenerSSLEngine =on/>

< Listener className =org.apache.catalina.core.JasperListener/>
<! - 使用特定的java / javax API来防止内存泄漏 - >
< Listener className =org.apache.catalina.core.JreMemoryLeakPreventionListener/>
< Listener className =org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/>
< Listener className =org.apache.catalina.core.ThreadLocalLeakPreventionListener/>

<! - 全局JNDI资源
/docs/jndi-resources-howto.html
- >
< GlobalNamingResources>
<! - 可以由
UserDatabaseRealm使用的可编辑用户数据库来验证用户
- >


<资源名称=jdbc / broadleaf
auth =容器
type =javax.sql.DataSource
username = root
password =admin123
driverClassName =com.mysql.jdbc.Driver
description =全局地址数据库
url =jdbc:mysql:/ / localhost:3306 / mycompany
maxActive =15
maxIdle =3/>
< / GlobalNamingResources>

<! - 服务是一个或多个共享
a单个容器的连接器的集合注意:服务本身不是容器 ,
,所以您不能在此级别定义子组件,如阀。
文件/docs/config/service.html
- >
<服务名称=Catalina>


<! -
<执行者名称=tomcatThreadPoolnamePrefix =catalina-exec-
maxThreads =150minSpareThreads =4 />
- >



< Connector port =8080protocol =HTTP / 1.1
connectionTimeout =20000
redirectPort =8443/ >
<! - 使用共享线程池的连接器 - >
<! -
< Connector executor =tomcatThreadPool
port =8080protocol =HTTP / 1.1
connectionTimeout =20000
redirectPort =8443/>
- >
<! - 在端口8443上定义SSL HTTP / 1.1连接器
此连接器使用需要JSSE
样式配置的BIO实现。当使用APR /本地实现时,需要
OpenSSL样式配置,如APR / native
文档中所述 - >
<! -
< Connector port =8443protocol =org.apache.coyote.http11.Http11Protocol
maxThreads =150SSLEnabled =truescheme = httpssecure =true
clientAuth =falsesslProtocol =TLS/>
- >

<! - 在端口8009上定义一个AJP 1.3连接器 - >
< Connector port =8009protocol =AJP / 1.3redirectPort =8443/>




<! - 您应该设置jvmRoute以支持通过AJP的负载平衡,即:
< Engine name =Catalina defaultHost =localhostjvmRoute =jvm1>
- >
< Engine name =CatalinadefaultHost =localhost>

<! - 对于集群,请查看文档:
/docs/cluster-howto.html(简单的方法)
/ docs / config / cluster.html(参考文档) - >
<! -
< Cluster className =org.apache.catalina.ha.tcp.SimpleTcpCluster/>
- >

<! - 使用LockOutRealm防止尝试通过暴力攻击来猜测用户密码
- >
< Realm className =org.apache.catalina.realm.LockOutRealm>
<! - 这个领域使用在全局JNDI
资源下的UserDatabase键下配置的UserDatabase。针对该UserDatabase执行的任何编辑
都可以立即
可供Realm使用。 - >
< Realm className =org.apache.catalina.realm.UserDatabaseRealm
resourceName =UserDatabase/>
< / Realm>

<主机名=localhostappBase =webapps
unpackWARs =trueautoDeploy =true>

<! - SingleSignOn阀门,在Web应用程序之间共享认证
文档在:/docs/config/valve.html - >
<! -
< Valve className =org.apache.catalina.authenticator.SingleSignOn/>
- >

<! - 访问日志处理所有示例。
文档在:/docs/config/valve.html
注意:所使用的模式相当于使用pattern =common - >
< Valve className =org.apache.catalina.valves.AccessLogValvedirectory =logs
prefix =localhost_access_log。 suffix =。txt
pattern =%h%l%u%t&%r&%s%b/>

< / Host>
< / Engine>
< / Service>
< / Server>


解决方案

感谢大家!我更改了我的mysql默认端口号和配置。它运行在端口8080,这是apache的默认端口tomcat.so我将mysql端口号更改为3306.Now程序运行顺利!!


I followed all the instructions that was provided in broadleafcommerce's documentation. I could run the site on jettyserver before making changes to the Mysql integration. but after i Followed the Mysql integration instructions that were given in the "getting started" page, it stopped working on jettyserver as well...what may be the problem..?

[http://www.broadleafcommerce.com/docs/core/current/tutorials/getting-started-tutorials/switch-to-mysql-tutorial]

Therefore i tried to run the website on the tomcat 7.0 server...but saw the following errors while running catalina.sh

Nov 18, 2014 12:27:29 PM org.apache.catalina.core.NamingContextListener addResource
WARNING: Failed to register in JMX: javax.naming.NamingException: ${database.driver}
Nov 18, 2014 12:27:29 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error getConfigured
Nov 18, 2014 12:27:29 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/mycompany] startup failed due to previous errors
Nov 18, 2014 12:27:29 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /Users/mac/apache-tomcat-7.0.57/webapps/mycompany.war has finished in 2,617 ms
Nov 18, 2014 12:27:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /Users/mac/apache-tomcat-7.0.57/webapps/docs
Nov 18, 2014 12:27:29 PM org.apache.tomcat.util.digester.Digester fatalError
SEVERE: Parse Fatal Error at line 29 column 6: The markup in the document following the root element must be well-formed.
org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
SEVERE: Occurred at line 29 column 6
Nov 18, 2014 12:27:30 PM org.apache.catalina.startup.ContextConfig configureStart
SEVERE: Marking this application unavailable due to previous error(s)
Nov 18, 2014 12:27:30 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error getConfigured
Nov 18, 2014 12:27:30 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors

this is my context.xml of tomcat/config:

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0


-->
<!-- The contents of this file will be loaded for each web application -->
<Context>

   <Resource auth="Container" 
       name="local_jdbc_db"  
       type="javax.sql.DataSource" 
       driverClassName="com.mysql.jdbc.Driver"  
       url="jdbc:mysql://localhost:3306/broadleaf" 
       username="root" 
       password="admin123"      /> 
   </Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
     on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->

</Context>

and my server.xml

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />

  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->


    <Resource name="jdbc/broadleaf"
    auth="Container"
    type="javax.sql.DataSource"
    username="root"
    password="admin123"
    driverClassName="com.mysql.jdbc.Driver"
    description="Global Address Database"
    url="jdbc:mysql://localhost:3306/mycompany"
    maxActive="15"
    maxIdle="3"/>
 </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">


    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
    maxThreads="150" minSpareThreads="4"/>
    -->



    <Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
           port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />
    -->
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
     This connector uses the BIO implementation that requires the JSSE
     style configuration. When using the APR/native implementation, the
     OpenSSL style configuration is required as described in the APR/native
     documentation -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
           maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />




    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
      /docs/cluster-howto.html  (simple how to)
      /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
       via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
         resources under the key "UserDatabase".  Any edits
         that are performed against this UserDatabase are immediately
         available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
           resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
         Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
         Documentation at: /docs/config/valve.html
         Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="localhost_access_log." suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

解决方案

Thanks everyone.! i changed my mysql default port number and config. it was running on port 8080 which is the default port of apache tomcat.so i changed mysql port number to 3306.Now the program run smoothly!!

这篇关于如何在Tomcat上运行broadleaf而不是jettyserver ..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆