Page 1 of 2

How to run broadleaf on Tomcat instead of jettyserver..?

Posted: Tue Nov 18, 2014 2:05 am
by rijualex
I followed all the instructions that you provided in your 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 your "getting started" page It stopped working on jettyserver as well...what may be the problem..?
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

Code: Select all

<?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.
-->
<!-- 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>


my server.xml:

Code: Select all

<?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" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <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">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <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" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- 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>

Re: How to run broadleaf on Tomcat instead of jettyserver..?

Posted: Tue Nov 18, 2014 5:14 am
by songdragon
You add <Resource> in wrong file.
The context.xml is at the META-INF folder in site or admin.

Try again.

Re: How to run broadleaf on Tomcat instead of jettyserver..?

Posted: Tue Nov 18, 2014 5:49 am
by rijualex
i've tried it but still not working.what changes should i make in the tomcat config files.? i mean the web.xml,server.xml and context.xml in the tomcat config directory?

Re: How to run broadleaf on Tomcat instead of jettyserver..?

Posted: Tue Nov 18, 2014 9:57 am
by songdragon
If you still enconter the same exception related to ${database.driver}, you'd better first check which configuration files contains this string. Then rebuid projects via "mvn install".

If it still does not work, I am sorry that you should be waiting for answers from developers. Good luck!

I have solve a simlar problem by modifing Resource in the context.xml in META-INF. But I am suffering another two exceptions. :(

Re: How to run broadleaf on Tomcat instead of jettyserver..?

Posted: Tue Nov 18, 2014 10:10 am
by songdragon

Re: How to run broadleaf on Tomcat instead of jettyserver..?

Posted: Thu Nov 20, 2014 1:05 am
by rijualex
@snapdragon:Thank you so much for that info.It helped me resolve some issues.But i get some errors even after following all those procedures mentioned in that link.
some errors are like:
WARNING: Failed to register in JMX: javax.naming.NamingException: Communications link failure
INFO: Server startup in 62894 ms
Nov 20, 2014 11:31:05 AM org.apache.catalina.loader.WebappClassLoader findResourceInternal
INFO: Illegal access: this web application instance has been stopped already. Could not load org/terracotta/bigmemory/version.properties. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
Nov 20, 2014 11:31:05 AM org.apache.catalina.loader.WebappClassLoader findResourceInternal
INFO: Illegal access: this web application instance has been stopped already. Could not load net/sf/ehcache/version.properties. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
Exception in thread "__DEFAULT__" java.lang.NullPointerException
at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:286)
at net.sf.ehcache.util.UpdateChecker.checkForUpdate(UpdateChecker.java:107)

Re: How to run broadleaf on Tomcat instead of jettyserver..?

Posted: Thu Nov 20, 2014 2:01 am
by songdragon
rijualex wrote:@snapdragon:Thank you so much for that info.It helped me resolve some issues.But i get some errors even after following all those procedures mentioned in that link.
some errors are like:
WARNING: Failed to register in JMX: javax.naming.NamingException: Communications link failure
INFO: Server startup in 62894 ms
Nov 20, 2014 11:31:05 AM org.apache.catalina.loader.WebappClassLoader findResourceInternal
INFO: Illegal access: this web application instance has been stopped already. Could not load org/terracotta/bigmemory/version.properties. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
Nov 20, 2014 11:31:05 AM org.apache.catalina.loader.WebappClassLoader findResourceInternal
INFO: Illegal access: this web application instance has been stopped already. Could not load net/sf/ehcache/version.properties. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
Exception in thread "__DEFAULT__" java.lang.NullPointerException
at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:286)
at net.sf.ehcache.util.UpdateChecker.checkForUpdate(UpdateChecker.java:107)

It looks same as this http://forum.broadleafcommerce.org/viewtopic.php?f=11&t=2313

Re: How to run broadleaf on Tomcat instead of jettyserver..?

Posted: Thu Nov 20, 2014 4:51 am
by rijualex
i have one more doubt.should we remove the jettyserver plugin from the pom.xml files of both admin and site..?

Re: How to run broadleaf on Tomcat instead of jettyserver..?

Posted: Fri Nov 21, 2014 12:31 am
by songdragon
rijualex wrote:i have one more doubt.should we remove the jettyserver plugin from the pom.xml files of both admin and site..?

I think it is not required. But I recommend you remove it, because it is useless if the broadleaf is deployed in tomcat.

Re: How to run broadleaf on Tomcat instead of jettyserver..?

Posted: Wed Nov 26, 2014 5:32 am
by rijualex
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!! Thanks snapdragon.