RuntimeEnvironmentPropertiesConfigurer issue - when running broadleaf admin on tomcat - java

I have build the whole app using maven and tried to deploy admin.war it on a standalone tomcat7, during the server start-up, it is showing some error : but still the server starts up,
due to this , when i go to products->Inventory -> the Available Quantity field is missing. But the same field is available, when i am running through eclipse.
Dec 15, 2014 5:45:09 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive D:\apache-tomcat-7.0.42\webapps\admin.war
[ WARN] 17:46:12 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'
[ WARN] 17:46:20 MergePersistenceUnitManager - A BroadleafClassTransformer is configured for this persistence unit, but Spring reported a problem (likely that a LoadTimeWeaver is not registered). As a result, the Broadleaf Commerce ClassTransformer (org.broadleafcommerce.common.extensibility.jpa.cop
y.DirectCopyClassTransformer) is not being registered with the persistence unit.
[ WARN] 17:46:20 MergePersistenceUnitManager - A BroadleafClassTransformer is configured for this persistence unit, but Spring reported a problem (likely that a LoadTimeWeaver is not registered). As a result, the Broadleaf Commerce ClassTransformer (org.broadleafcommerce.common.extensibility.jpa.con
vert.EntityMarkerClassTransformer) is not being registered with the persistence unit.
[ WARN] 17:46:20 MergePersistenceUnitManager - A BroadleafClassTransformer is configured for this persistence unit, but Spring reported a problem (likely that a LoadTimeWeaver is not registered). As a result, the Broadleaf Commerce ClassTransformer (org.broadleafcommerce.common.extensibility.jpa.cop
y.DirectCopyClassTransformer) is not being registered with the persistence unit.
[ WARN] 17:46:31 AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [blSandBoxElements]; using defaults.
[ WARN] 17:47:14 DefaultFilterChainValidator - Possible error: Filters at position 12 and 13 are both instances of org.springframework.security.web.access.intercept.FilterSecurityInterceptor
[ WARN] 17:47:15 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'
Hibernate: select systemprop0_.BLC_SYSTEM_PROPERTY_ID as BLC1_167_, systemprop0_.FRIENDLY_GROUP as FRIENDLY2_167_, systemprop0_.FRIENDLY_NAME as FRIENDLY3_167_, systemprop0_.FRIENDLY_TAB as FRIENDLY4_167_, systemprop0_.PROPERTY_NAME as PROPERTY5_167_, systemprop0_.PROPERTY_TYPE as PROPERTY6_167_, sy
stemprop0_.PROPERTY_VALUE as PROPERTY7_167_ from BLC_SYSTEM_PROPERTY systemprop0_ where systemprop0_.PROPERTY_NAME=?
Dec 15, 2014 5:47:20 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
Dec 15, 2014 5:47:20 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Dec 15, 2014 5:47:20 PM org.apache.catalina.startup.Catalina start

The inventory was added in version 3.1.3 make sure you are using this version or newer version.
It was added using
org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyClassTransformer
Which adds the field at run time, but this creates the dependency on "Spring Instruments", which needs to be added as javaagent
So you can edit your /path/to/tomcat/bin/setenv.sh and add following
JAVA_OPTS="-Djava.awt.headless=true -Xmx1024M -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -javaagent:/path/to/spring-jar/spring-instrument-3.2.2.RELEASE.jar"
Adjust Xmx and other tomcat setting and replace /path/to/spring-jar/ with actual path.

Related

Running vert.x cluster backed by hazelcast cache in distributed mode

We are using Vert.X library to develop REST service layer to receive messages from many sources. Part of the requirements is to run REST verticle(s) in High availability (HA) mode. We are following vert.x core manual for implementation of VertX cluster to run in distributed cluster (3 nodes to start with).
Based on the documentation we did the following
Included hazelcast library in dependencies
io.vertx
vertx-hazelcast
3.3.0
Created a fat jar with the following manifest entries and added resources folder in classpath which has required configurations to load. We took hazelcast-default.xml from vertx-examples from github
log4j.properties
config.json
hazelcast-default.xml
io.vertx.core.Launcher
com.msg.verticles.RootVerticle
resources/
Created a script file to trigger the launcher
java -jar -Xmx2048m -Xms512m message-1.0-SNAPSHOT.jar -ha -D config=resources/config.json
Launcher fails to to pickup hazelcast-default.xml from resurce folder and stops with the following exception. Not sure what I am missing here.
$>java -jar -Xmx2048m -Xms512m message-1.0-SNAPSHOT.jar -ha -D config=resources/config.json
Jul 16, 2017 7:20:26 PM io.vertx.core.impl.launcher.commands.RunCommand
INFO: Starting clustering...
Jul 16, 2017 7:20:27 PM io.vertx.core.impl.launcher.commands.RunCommand
INFO: No cluster-host specified so using address 127.0.0.1
Jul 16, 2017 7:20:28 PM io.vertx.spi.cluster.hazelcast.HazelcastClusterManager
WARNING: Cannot find cluster configuration on 'vertx.hazelcast.config' system property, on the classpath, or specified programmatically. Using default hazelcast configuration
Jul 16, 2017 7:20:28 PM com.hazelcast.config.XmlConfigLocator
INFO: Loading 'hazelcast-default.xml' from classpath.
Jul 16, 2017 7:20:28 PM com.hazelcast.config.AbstractXmlConfigHelper
WARNING: Name of the hazelcast schema location incorrect using default
Jul 16, 2017 7:20:28 PM io.vertx.core.impl.VertxImpl
SEVERE: Failed to join cluster
com.hazelcast.core.HazelcastException: org.xml.sax.SAXParseException; schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
at com.hazelcast.util.ExceptionUtil.peel(ExceptionUtil.java:73)
According to the documentation of Hazelcast cluster manager you need to specify your Hazelcast configuration in a file named cluster.xml in your classpath (either embedded in the root of your fatjar or in a directory that is in your classpath).
Solved the issue by configuring zookeeper as co-ordination service. Which worked like a champ!!
https://github.com/vert-x3/vertx-zookeeper

Figuring out Spring Logging

I've inherited a, well, messy, Spring MVC application. Some things don't work and I want to enable DEBUG or even TRACE logging to get more information and found that even that is not that simple.
When starting the application (by running a Tomcat 8 server from Eclipse), it seems to output two kinds of log messages. Here is an example of the first kind:
Jun 20, 2017 1:47:07 PM org.hibernate.Version logVersion INFO:
HHH000412: Hibernate Core {4.3.8.Final} Jun 20, 2017 1:47:07 PM
org.hibernate.cfg.Environment <clinit> INFO: HHH000206:
hibernate.properties not found Jun 20, 2017 1:47:07 PM
org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021:
Bytecode provider name : javassist
These messages are all in red. The second kind looks like this:
13:47:16.949 [localhost-startStop-1] INFO org.springframework.web.servlet.DispatcherServlet:489 - FrameworkServlet 'spring': initialization started
13:47:16.952 [localhost-startStop-1] INFO org.springframework.web.context.support.XmlWebApplicationContext:583 - Refreshing WebApplicationContext for namespace 'spring-servlet': startup date [Tue Jun 20 13:47:16 IDT 2017]; parent: Root WebApplicationContext
13:47:16.952 [localhost-startStop-1] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader:317 - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-servlet.xml]
These are all in black.
Obviously there are at least two active logging formats. This is were it gets weird:
I found numerous log4j2.xml as well as log4j.propertiesfiles. All of them seem to be ignored. Changing them makes no difference. I just deleted them all, and it did not affect the logging output. In addition, log4j 1.2, log4j 2.0.2 and slf4j are all Maven dependencies. pom.xml references version 1.2, other Maven dependencies probably need the other versions.
My question is - how do I configure the logging myself? Placing a log4j.xml file under WEB-INF (were all other property files are located) doesn't make any difference. Neither that placing a log4j.properties file there. I need to somehow turn debug printouts of log4j itself, so I can figure out where it's reading it's configuration from.
I tried adding -Dlog4j.debug as a VM argument to the Tomcat run configuarion. Other than printing -Dlog4j.debug command line argument or something similar, nothing changed.
You can use following code snippet that I have used for my project. Over here class name is FolderReader.class and placed lo4j.properties file in folder "conf".Passing argument "../conf/log4j.properties" as args[2] argument when running the application.
final FileSystemXmlApplicationContext applicationContext = new FileSystemXmlApplicationContext(args[0]);
Logger logger=Logger.getLogger(FolderReader.class);
PropertyConfigurator.configure(args[2]);
logger.info("Intializing beans..");
ServiceContext serviceContext = (ServiceContext) BeanFactoryLocator.getBean("serviceContext");
PropertyConfigurator.configure(args[2]);loads the log4j.properties file from location. Configuration is taken from this property file and formatting is done accordingly.

Server is not connected. Deploy is not available. IntelliJ 13 and Tomcat 7

Trying to run my app with IntelliJ 13 and Apache tomcat 7.0.42. JDK1.6
Always getting the error Artifact app:war exploded: Server is not connected. Deploy is not available.
But when I deploy through terminal with catalina.sh start it works perfectly fine.
I referred this link for setup: http://confluence.jetbrains.com/display/IntelliJIDEA/Application+Servers
Any idea what am I missing?
Here is the Tomcat Catalina log:
Dec 29, 2014 11:43:29 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Dec 29, 2014 11:43:29 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 614 ms
Dec 29, 2014 11:43:29 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Dec 29, 2014 11:43:29 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Dec 29, 2014 11:43:29 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 44 ms
Dec 29, 2014 11:43:39 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /Users/yesuagg/apache-tomcat-7.0.42/webapps/manager
Exception in Event log
4:58:40 PM Compilation completed successfully with 104 warnings in 6 sec
4:58:42 PM Application Server was not connected before run configuration stop, reason:
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused]
Please check this answer posted by Christian and also read that thread.
Tomcat deployment issue via IntelliJ
Simply try removing setenv.sh in $CATALINA_HOME/bin
I had this issue today and it wasn't due to setenv.sh as discussed on the other thread. In the end it was an issue with $CATALINA_BASE/conf/server.xml.
For some reason in our server.xml we were using a custom engine name for example
<Engine name="custom-value" defaultHost="localhost">
I tried again with a clean server.xml from tomcat 7.0.57 and the artifact deployed perfectly. After trial and error it came down to this one line.
Changing engine name to 'Catalina' as shown below value fixed our issue and allowed our exploded artifact to deploy using our customised server.xml
<Engine name="Catalina" defaultHost="localhost">
If you are seeing this issue try a clean server.xml and work backwards from there.
tomcat-7.0-doc RUNNING
(3.2) Set JRE_HOME or JAVA_HOME (required)
These variables are used to specify location of a Java Runtime
Environment or of a Java Development Kit that is used to start Tomcat.
The JRE_HOME variable is used to specify location of a JRE. The JAVA_HOME
variable is used to specify location of a JDK.
Using JAVA_HOME provides access to certain additional startup options that
are not allowed when JRE_HOME is used.
If both JRE_HOME and JAVA_HOME are specified, JRE_HOME is used.
In my case, Intellij IDEA doesn't support run tomcat8 installed from linux repositories.
/usr/share/tomcat/bin/catalina.sh start (not support)
/usr/share/tomcat/bin/catalina.sh run (supported)
Only tomcat8 installed from official website. I tried with distribution downloaded from http://tomcat.apache.org/download-80.cgi. So I got successful results.
The reason is in the catalina.sh file from linux distribution, where there isn't "run" command. But in the tomcat downloaded there is "run" command. catalina.sh_InstalledFromLinuxRepository
Do you set JAVA_OPTS anywhere in Tomcat bat/sh files?
If you do, make sure to keep previous values also - IDEA seems to use those to specify some connection options to Tomcat.
E.g. in .sh files do
JAVA_OPTS="<your new stuff> $JAVA_OPTS"
instead of just
JAVA_OPTS=<your new stuff>
P.S. Same answer as this actually: https://stackoverflow.com/a/28867346/307295

can't start neo4j service after moving directory

I have a windows 7 x64 machine. I installed neo4j which went very smoothly. I then managed to install neo4django and neo4j-embedded and that was fine too.
However I decided to change the directory it was in, so I stopped the neo4j service in powershell and moved it to a different spot. Since then I haven't been able to restart the service, though if I run the console it starts neo4j in a java.exe window (I think) and thus it works (localhost:7474 accessible, able to run the neo4j-embedded example script, etc) until I close that java.exe window.
Here is the output I got in PowerShell:
PS G:\dev files\neo4j\bin> .\neo4j start
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.
PS G:\dev files\neo4j\bin> .\neo4j console
25/06/13 9:36:57 PM org.neo4j.server.AbstractNeoServer INFO: Setting startup timeout to: 120000ms based on -1
Detected incorrectly shut down database, performing recovery..
25/06/13 9:36:59 PM org.neo4j.server.database.Database INFO: Loaded neo4j tuning properties from conf/neo4j.properties
25/06/13 9:37:01 PM org.neo4j.server.database.Database INFO: Successfully started database
25/06/13 9:37:02 PM org.neo4j.server.AbstractNeoServer INFO: Starting Neo Server on port [7474] with [80] threads available
25/06/13 9:37:02 PM org.neo4j.server.AbstractNeoServer INFO: Enabling HTTPS on port [7473]
25/06/13 9:37:03 PM org.neo4j.server.modules.DiscoveryModule INFO: Mounted discovery module at [/]
25/06/13 9:37:03 PM org.neo4j.server.modules.RESTApiModule INFO: Mounted REST API at [/db/data/]
25/06/13 9:37:03 PM org.neo4j.server.modules.ManagementApiModule INFO: Mounted management API at [/db/manage/]
25/06/13 9:37:03 PM org.neo4j.server.modules.WebAdminModule INFO: Mounted webadmin at [/webadmin]
21:37:03.260 [main] INFO org.mortbay.log - Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
25/06/13 9:37:03 PM org.neo4j.server.web.Jetty6WebServer INFO: Mounting static content at [/webadmin] from [webadmin-html]
21:37:03.366 [main] INFO org.mortbay.log - jetty-6.1.25
21:37:03.548 [main] INFO org.mortbay.log - NO JSP Support for /webadmin, did not find org.apache.jasper.servlet.JspServlet
21:37:06.088 [main] INFO org.mortbay.log - Started SelectChannelConnector#localhost:7474
I'd be most appreciative of your help. Cheers.
When you create a service in Windows you typically bind a location for the executable that the operating system can find. Because you moved the directory your Neo4J service is no longer valid. What you must do is delete the old service, recreate the service with the new directory, and then launch it.
Code to get and delete service in PowerShell:
$service = Get-WmiObject -Class Win32_Service -Filter "Name='servicename'"
$service.delete()
taken from here

Unable to Start Tomcat 7.0 in Eclipse Indigo

I've to start working on a web-app project for which I've Eclipse Indigo and Tomcat 7.0 installed. The environment also has JRE 7, Android SDK in it. But whenever I start the server, it gets timed out!
Moreover, I'm able to start the server outside Eclipse and sucessfully execute a web app in the browser. But to debug, I would rather have it in Eclipse.
The error message is:
Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
In the console I get:
Mar 14, 2012 11:51:18 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\program files\Java\jre7\bin;C:\WINNT\Sun\Java\bin;C:\WINNT\system32;C:\WINNT;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\oracle\product\11.1.0\BIN\;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Executive Software\Diskeeper\;C:\Program Files\Pointsec\Pointsec Media Encryption\Program\;C:\Program Files\Windows Imaging\;C:\oracle\product\11.1.0\BIN;C:\Program Files\Reflection\;C:\eclipse;;.
Mar 14, 2012 11:51:18 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:AUDI_ASSIST_v2.0_WS_REDESIGN_Interceptor' did not find a matching property.
Mar 14, 2012 11:51:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-9080"]
Mar 14, 2012 11:51:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-9009"]
Mar 14, 2012 11:51:18 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 504 ms
Mar 14, 2012 11:51:18 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 14, 2012 11:51:18 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
Mar 14, 2012 11:51:18 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [109] milliseconds.
Mar 14, 2012 11:51:18 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\documents and settings\fahmf\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\AUDI_ASSIST_v2.0_WS_REDESIGN_Interceptor\WEB-INF\lib\com.ibm.ws.webservices.thinclient_7.0.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Mar 14, 2012 11:51:20 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9080"]
Mar 14, 2012 11:51:20 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-9009"]
Mar 14, 2012 11:51:20 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1697 ms
I have tried the solutions proposed in other questions on this forum like increasing the time out period,changing the port numbers, uninstalling & reinstalling Tomcat, changing the 'publisiing' option for the server but nothing seems to work.
Any help would be sincerely appreciated. Thanks in advance...
Just follow the Simple Steps
Double click on your desired server in the server-view , It will open the window and Right corner of the Window Timout option is availble and change time to 120 . it will work :)
For me the cause was Eclipse. Running the IDE with the '-clean' parameter solved it.
eclipse.exe -clean
Eclipse WTP usually tries to make sure that the web app is up by visiting the default page (/) of the app when you start the server. Until it gets an HTTP 200 (OK) response from that page - it thinks the app is not up. You are probably noticing the server icon (where you start tomcat from) still says "starting" with a green blinking.
I think Eclipse has a bug where it cannot handle a bunch of 302 on the page at / - which could happen if that page was redirecting to another page which was again redirecting to a login page.
SOLVED: That's it!!!! For me was compiling with JDK6 but running Tomcat with JDK7, WST uses the system properties and not the eclipse settings. I also configure the same JDK Version in eclipse and in System (check it with java -version in cmd line)
Details: I try to configure eclipse like describe here, but it didn´t solve the problem, then I notice in eclipse´s error log that tomcat was started with jre 1.7. in spite of my configurations.
I also try, in cmd line, 'java -version' and obtained '1.7' instead of expected '1.6'.
I also decide to configure java 1.6 (like in eclipse) in system panel but it didn´t solve the problem. I also desinstall jre 1.7 restart eclipse AND IT SUCCESS!.. It was a very usefull clue, thank you.
Verify the deployment-descriptor and check the value for <url-pattern>. This can be stopping tomcat to load.
You have to edit eclipse.ini and push to use Java 1.6
-vm
c:\Program Files\Java\jdk1.6.0_25\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m
http://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example

Categories

Resources