UrlMappings in Tomcat container vs. running via grails run-app - grails

In Grails 3.3.0, I'm having an issue with getting it to use the UrlMappings that I've defined. For instance, I'm trying to have "/" map to the default controller/action.
This works locally (I've turned on logging for 'org.grails.plugins.web.mapping').
I see this in log:
2017-09-01 18:08:05,254 [http-nio-8080-exec-2] DEBUG org.grails.web.mapping.DefaultUrlMappingsHolder - Attempting to match URI [/] with pattern [500]
2017-09-01 18:08:05,254 [http-nio-8080-exec-2] DEBUG org.grails.web.mapping.DefaultUrlMappingsHolder - Attempting to match URI [/] with pattern [/]
2017-09-01 18:08:05,302 [http-nio-8080-exec-2] DEBUG org.grails.web.mapping.DefaultUrlMappingsHolder - Matched URI [/] with pattern [/], adding to posibilities
...and the default controller/action is what I see.
In the Tomcat container, I see this:
09-01 17:44:35,968 [ajp-bio-8009-exec-1] DEBUG org.grails.webflow.mvc.servlet.GrailsFlowHandlerMapping - Looking up Grails controller for URI [/]
2017-09-01 17:44:36,019 [ajp-bio-8009-exec-1] TRACE org.grails.web.servlet.mvc.GrailsDispatcherServlet - Testing handler map [org.grails.web.mapping.mvc.UrlMappingsHandlerMapping#17ef7838] in DispatcherServlet with name 'grailsDispatcherServlet'
but I don't see it attempt to match against "/". Or the 500, for that matter. Any ideas on what else to look for to troubleshoot this?

Related

Grails 4.0.2. Could not resolve view with name 'index' in servlet with name 'grailsDispatcherServlet'

I created a new grails app using below code
grails create-app myapp --profile=rest-api
I modified ApplicationController and added namespace to it, It is as below:
class ApplicationController implements PluginManagerAware {
/** The Namespace for the version of the API, see http://docs.grails.org/latest/guide/REST.html#versioningResources */
static namespace = "v1"
GrailsApplication grailsApplication
GrailsPluginManager pluginManager
def index() {
[grailsApplication: grailsApplication, pluginManager: pluginManager]
}
}
There is a index.gson file present under views/application/ Directory.
I run this setup using grails run-app and point my browser to http://localhost:8080
It throws following exeption:
<=======2020-04-08 16:01:31.616 ERROR --- [nio-8080-exec-1] .a.c.c.C.[.[.[.[grailsDispatcherServlet] : Servlet.service() for servlet [grailsDispatcherServlet] in context with path [] threw exception [Could not resolve view with name 'index' in servlet with name 'grailsDispatcherServlet'] with root cause
However if I modify controller code an use render, everything works fine.
render(view:'index',model: [grailsApplication: grailsApplication, pluginManager: pluginManager])
Output of grails -v
Grails Version: 4.0.2
JVM Version: 1.8.0_171
OS: macOS High Sierra
See Selecting Views For Namespaced Controllers
The correct path for the namespaced view should be:
grails-app/views/v1/application/index.gson

Using Neo4j 2.1.2 database with Neo4j 2.1.3 fails to start

I'm trying to copy over a database that I've been using with Neo4j 2.1.2 to a new machine that I upgraded from Neo4j 2.0.3 to Neo4j 2.1.3. Seems like it is coming down to Expected 'NeoStore v0.A.0' but file is version 'NeoStore v0.A.3'. but I don't know how to fix that.
Here's what I did:
On my old server:
Shut down my 2.1.2 server using bin/neo4j stop
Copied the graph.db directory to my new server
On my new server:
Delete the existing graph.db directory
Ran apt-get install neo4j to upgrade the new server from 2.0.3 to 2.1.3
Server started successfully without warnings
Deleted the newly created graph.db directory
Copied my existing graph.db directory into the data directory for 2.1.3
Ran chown to change the owner of the files to neo4j
Attempted to start the server using sudo service neo4j-service start
Also tried setting allow_store_upgrade=true but that had no effect
Here is the console output that I get:
Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
Starting Neo4j Server...WARNING: not changing user
process [9107]... waiting for server to be ready... Failed to start within 120 seconds.
Here is the error logged in messages.log:
2014-08-06 19:13:13.103+0000 ERROR [o.n.k.EmbeddedGraphDatabase]:
Startup failed: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager#3bf17f92' was successfully initialized, but failed to start.
Please see attached cause exception.: Component 'org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource#c3e122' was successfully initialized, but failed to start.
Please see attached cause exception.: 'neostore' has a store version number that we cannot upgrade from. Expected 'NeoStore v0.A.0' but file is version 'NeoStore v0.A.3'.
2014-08-06 19:13:13.104+0000 INFO [o.n.k.EmbeddedGraphDatabase]: Shutdown started
And here is the console.log output:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/share/neo4j/system/lib/logback-classic-1.0.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/neo4j/system/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
11:21:18,697 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
11:21:18,697 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
11:21:18,698 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/usr/share/neo4j/system/lib/neo4j-server-2.0.3.jar!/logback.xml]
11:21:18,699 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
11:21:18,699 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/usr/share/neo4j/system/lib/neo4j-server-2.0.3.jar!/logback.xml]
11:21:18,699 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/usr/share/neo4j/system/lib/neo4j-server-2.1.3.jar!/logback.xml]
11:21:18,725 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList#2d3d0953 - URL [jar:file:/usr/share/neo4j/system/lib/neo4j-server-2.0.3.jar!/logback.xml] is not of type file
11:21:18,782 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
11:21:18,786 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
11:21:18,795 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
11:21:18,822 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
11:21:18,890 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
11:21:18,890 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
11:21:18,891 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
11:21:18,893 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator#22f3f59 - Registering current configuration as safe fallback point
11:21:19.099 [main] INFO o.n.s.enterprise.EnterpriseNeoServer - Setting startup timeout to: 120000ms based on -1
Any tips to get this running? I've actually never successfully copied a database to a new server running a new Neo4j version and had it actually work so I'm clearly using the wrong process. The 2.1.3 server starts fine if I let it create a new empty database.
Try clearing out all references to 2.0.3.jar in /usr/share/neo4j/system/lib/ -- make sure that there is only 2.1.3.
It looks like from your logs that your /neo4j/system/lib directories were merged together and contain incongruous jar files. Those jar files contain some meta data from compilation that could cause some conflicting issues.
And as always, backup your data store files before migrating.

Need help resolving error message

Just tried to deploy a .war file and received this error message. This came quite the surprise to me because I just deployed a .war file the day before and worked fine with minimal changes between the two (changed a value of a variable that tracks days until a cron job executes). I do leave out the auto generated .iml files that IntelliJ creates, could that do it?
'2014-01-24 08:47:45,480 [Thread-10] WARN config.ConfigurationFactory - No configuration found. Configuring ehcac he from ehcache-failsafe.xml found in the classpath: jar:file:/var/opt/tomcat/webapps/PerformanceEvaluations-moved /WEB-INF/lib/ehcache-core-2.4.6.jar!/ehcache-failsafe.xml
''2014-01-24 08:47:46,117 [Thread-10] WARN hibernate.AbstractEhcacheRegionFactory - Couldn't find a specific ehca che configuration for cache named [edu.wisc.radiology.performanceevaluations.Role]; using defaults.
' ==> PerformanceEvaluations_main.log <== '2014-01-24 08:47:45,480 [Thread-10] WARN config.ConfigurationFactory - No configuration found. Configuring ehcac he from ehcache-failsafe.xml found in the classpath: jar:file:/var/opt/tomcat/webapps/PerformanceEvaluations-moved /WEB-INF/lib/ehcache-core-2.4.6.jar!/ehcache-failsafe.xml
''2014-01-24 08:47:46,117 [Thread-10] WARN hibernate.AbstractEhcacheRegionFactory - Couldn't find a specific ehca che configuration for cache named [edu.wisc.radiology.performanceevaluations.Role]; using defaults.
' ==> catalina.out <==
'2014-01-24 08:47:49,046 [Thread-10] WARN servlet.DefaultGrailsApplicationAttributes - ApplicationContext not fou nd in org.codehaus.groovy.grails.APPLICATION_CONTEXT attribute of servlet context.
' ==> PerformanceEvaluations_main.log <==
'2014-01-24 08:47:49,046 [Thread-10] WARN servlet.DefaultGrailsApplicationAttributes - ApplicationContext not fou nd in org.codehaus.groovy.grails.APPLICATION_CONTEXT attribute of servlet context.
' ==> catalina.out <==
'2014-01-24 08:47:50,112 [Thread-10] WARN module.ModuleDeclarationsFactory - 'grails.resources.modules' in config does not define any modules
'==> PerformanceEvaluations_main.log <==
'2014-01-24 08:47:50,112 [Thread-10] WARN module.ModuleDeclarationsFactory - 'grails.resources.modules' in config does not define any modules
' ==> catalina.out <==
Parsing DB Changelog
I don't see any error messages, only warnings. And all are harmless. For example the one about Ehcache is standard. If you don't provide a custom ehcache.xml, it defaults to one in the jar file and prints some messages to that effect. You can create your own - typically a modified version of the default file - and put it in the root of the classpath (non-Groovy files in grails-app/conf and src/java get copied to the classpath, so it's a good location) and it will be used instead. This is a good idea to do early on, even if you just keep the default values in your file, to make it easier to configure later. And the defaults are rather conservative, e.g. the TTL defaults to only 2 minutes.

Grails 2.0 Externalized Config in Production, cannot access application - HTTP 404

when I've upgraded my Grails app to Grails 2.0.3, the application isn't accessible in production Tomcat.
When I run the app in development or even using "grails prod run-war", the application works properly. But when I move this app to Tomcat (tested on Tomcat 6 and 7), the app is not accessible anymore. It loads properly but when I go to http://localhost:8080/appName I receive HTTP 404.
The logs are empty, therefore I cannot find out where is the problem. When I remove externalized config loading from Config.groovy, the application works! Really weird. Config.groovy:
grails.config.locations = ["file:/home/user/application_homes/app_home/app-config.properties"]
Did you faced same issue? Or were there any changes from Grails 1.3.7 to Grails 2.0.3 which could affect this?
Thanks for any advice!
i'm having the exact same issue as you it would appear...
I get nothing in the logs...
It just doesn't start up... fails with:
0/04/2012 2:17:36 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
20/04/2012 2:17:36 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/abcd] startup failed due to previous errors
Seems to work when we use a classpath spring format in the
grails.config.locations section.
we have also just gone to grails 2.0.3, could it be a bug?
Also experiencing the same problems. We actually have two methods for specifying the grails.configuration.locations, using System/Env Variables or a -Dconfig.file= definition. Using the environment variable load, this causes a line of
classpath:the-config-file.properties
If a -Dconfig.file is specified, it uses the file based evaluator:
file:/full-path/the-config.file.properties
When using the System/Env method, the configuration loads fine! As soon as we shift to using the 'file' lookup, Tomcat fails to start.
It looks to be failing just after creating the internalConfigurationAnnotationProcessor bean:
2012-04-22 22:35:53,514 (main) DEBUG [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext] - <Bean factory for org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#17bcd4: org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory#752144: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,....<--- (left out the big list of others)
2012-04-22 22:35:53,538 (main) DEBUG [org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory] - <Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'>
2012-04-22 22:35:53,538 (main) DEBUG [org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory] - <Creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'>
2012-04-22 22:35:53,547 (main) DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Returning cached instance of singleton bean 'grailsApplication'>
2012-04-22 22:35:53,547 (main) DEBUG [org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory] - <Eagerly caching bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' to allow for resolving potential circular references>
2012-04-22 22:35:53,548 (main) DEBUG [org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory] - <Finished creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'>
2012-04-22 22:35:53,667 (main) INFO [org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory] - <Destroying singletons in org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory#752144
22/04/2012 10:35:53 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
The oddest part is just changing from a classpath:<> definition to a file:<> is causing this problem. I have put in debug statements into the grails Config.groovy file and the contents of the files are read ok.

grails wsclient "file not found" consuming a .net web service

first of all, I want to apologize if my question is stupid, but I'm really new in consuming .net web service in grails.
There's a SOAP WS (wich I can't manipulate in any way) that I consume whis way:
def wsdlURL = "_HttpUrl_'/AspNetOracleProviderService.asmx?WSDL"
def proxy = webService.getClient(wsdlURL) <= This is the line where my project fails
Now, I've tested this service in a asp.Net Project with no troubles, but in Grails it generates me this error:
Error 500: Executing action [create] of controller [pruebaplugins.PruebaWsClientController] caused exception: Unable to create JAXBContext for generated packages: "com.something.anothersomething" doesnt contain ObjectFactory.class or jaxb.index
I have defined the JAVA_HOME and javac Is there, I can acces to it in any location in a command prompt.
At the end of this post I'll put de detailed info.
I've only tested this service and the well-known Celsius-Farenheit example, wich works with no problems, I think it's because it only returns a String, unlike mine or any other services.
I don't know if its a lack of something, surely could be something I ignore.
Like I said, I'm very new in this kind of stuff and I'd appreciate any kind of help.
Thanks anyway.
Detailed info:
When I put
debug 'org.apache.cxf'
in log4j in Config.groovy
the output throw me this:
2012-01-25 16:08:13,514 [http-8080-2] INFO spring.BusApplicationContext - Refreshing org.apache.cxf.bus.spring.BusApplicationContext#5c3e99: startup date [Wed Jan 25 16:08:13 CLST 2012]; root of context hierarchy
2012-01-25 16:08:13,639 [http-8080-2] INFO spring.BusApplicationContext
- No cxf.xml configuration file detected, relying on defaults.
2012-01-25 16:08:13,820 [http-8080-2] DEBUG spring.ControlledValidationXmlBeanDefinitionReader
- Loaded 0 bean definitions from location pattern [classpath:META-INF/cxf/cxf-extension-http.xml]
2012-01-25 16:08:13,848 [http-8080-2] DEBUG spring.BusApplicationContext
- Bean factory for org.apache.cxf.bus.spring.BusApplicationContext#5c3e99: org.springframework.beans.factory.support.DefaultListableBeanFactory#e3e8f3: defining beans [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.corba.CorbaBindingFactory,org.apache.cxf.binding.corba.wsdl.WSDLExtensionRegister#0,org.apache.cxf.jaxws.context.WebServiceContextResourceResolver,org.apache.cxf.jaxws.context.WebServiceContextImpl,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.binding.xml.XMLBindingFactory,org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder,org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider,org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder,org.apache.cxf.javascript.JavascriptQueryHandlerRegistry,org.apache.cxf.transport.local.LocalTransportFactory,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory,org.apache.cxf.management.InstrumentationManager,org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory,org.apache.cxf.transport.jms.JMSTransportFactory,org.apache.cxf.binding.object.ObjectBindingFactory,org.apache.cxf.binding.http.HttpBindingFactory,org.apache.cxf.jaxrs.JAXRSBindingFactory,org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader,org.apache.cxf.ws.policy.AssertionBuilderRegistry,org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry,org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry,org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder,org.apache.cxf.ws.policy.PolicyBuilder,org.apache.cxf.ws.policy.PolicyEngine,org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider,org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider,org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder,org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider,org.apache.cxf.ws.rm.RMManager,org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider,org.apache.cxf.ws.rm.RMAssertionBuilder]; root of factory hierarchy
2012-01-25 16:08:14,009 [http-8080-2] DEBUG spring.BusApplicationContext
- Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource#cb229]
2012-01-25 16:08:14,009 [http-8080-2] DEBUG spring.BusApplicationContext
- Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster#184b649]
2012-01-25 16:08:16,095 [http-8080-2] DEBUG spring.BusApplicationContext
- Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor#1e10f02]
2012-01-25 16:08:18,925 [http-8080-2] INFO dynamic.DynamicClientFactory
- Created classes: com.something.anothersmth.Aplicacion, com.something.anothersmth.ArrayOfControl, com.something.anothersmth.ArrayOfModulo, com.something.anothersmth.ArrayOfPagina, com.something.anothersmth.ArrayOfRol, etc (...all the classes)
javac: file not found: C:\Users\DYT01\AppData\Local\Temp\org.apache.cxf.endpoint.dynamic.DynamicClientFactory#8a3c71-1327518498999-src\com\something\anothersmth\CambiarContraseña.java
Usage: javac
use -help for a list of possible options
2012-01-25 16:08:20,637 [http-8080-2] ERROR dynamic.DynamicClientFactory - Could not compile java files for ...HttpUrl/AspNetOracleProviderService.asmx?WSDL.

Resources