Upgrading from Spring 3.2.1 to 3.2.13 gives 404 on static resources - spring

We'd like to upgrade our Spring dependency, but are having issues with resources not being found by the server. No code-changes have been made, this works fine in 3.2.1.
We register the handler like this
#Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
registry.addResourceHandler("/kjernejournal.html").addResourceLocations("/kjernejournal.html").setCachePeriod(0);
}
Log has
o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/kjernejournal.html] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
But this fails later on, with the following error.
12:07:04.520 [[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - Mapping [/kjernejournal.html] to HandlerExecutionChain with handler [org.springframework.web.servlet.resource.ResourceHttpRequestHandler#75288586] and 1 interceptor
12:07:04.520 [[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG o.s.web.servlet.DispatcherServlet - Last-Modified value for [/hpp-webapp/kjernejournal.html] is: -1
12:07:04.520 [[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG o.s.w.s.r.ResourceHttpRequestHandler - Trying relative path [/kjernejournal.html] against base location: ServletContext resource [/kjernejournal.html]
12:07:04.520 [[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG o.s.w.s.r.ResourceHttpRequestHandler - No matching resource found - returning 404
The file does exist in the root of the WAR-file.
Any idea on where to begin?

Figured out the problem.
When we register like
registry.addResourceHandler("/kjernejournal.html").addResourceLocations("/").setCachePeriod(0);
Instead of
registry.addResourceHandler("/kjernejournal.html").addResourceLocations("/kjernejournal.html").setCachePeriod(0);
It works fine. So the problem seems to be that resourceLocations pointed to a file instead of a directory. From ResourceHandlerRegistration JavaDoc:
Add one or more resource locations from which to serve static content. Each location must point to a valid directory.
Weird that it worked before, though...

Related

Unable to connect config client with config server when deployed in the weblogic

I am facing issue when we deployed config server and config client in weblogic server and run it as part of same process which is running on port 7001.
In client app, configured URL to point config-server(http://localhost:7001/) but its not able to connect, whhile troubleshooting, getting below issue -
2022-10-17 20:04:15,234 INFO org.springframework.boot.context.config.ConfigDataLoader [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] Fetching config from server at : http://localhost:7001/
2022-10-17 20:04:15,234 INFO org.springframework.boot.context.config.ConfigDataLoader [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] Connect Timeout Exception on Url - http://localhost:7001/. Will be trying the next url if available
2022-10-17 20:04:15,234 WARN org.springframework.boot.context.config.ConfigDataLoader [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] Could not locate PropertySource ([ConfigServerConfigDataResource#2fe99575 uris = array<String>['http://localhost:7001/'], optional = true, profiles = list['production']]): I/O error on GET request for "http://localhost:7001/common-service,employee-service/production": Tried all: '2' addresses, but could not connect over HTTP to server: 'localhost', port: '7001'
Due to this , unable to fetch properties.
However, if I run same codebase of config-server as a separate process and point that url from client application which is deployed on weblogic 7001 port, then able to connect (http://localhost:8079/)
2022-10-17 20:40:41,434 DEBUG com.oraclecorp.cc.wstemplate.ServletInitializer [[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'] Running with Spring Boot v2.5.14, Spring v5.3.20
2022-10-17 20:40:41,435 INFO com.oraclecorp.cc.wstemplate.ServletInitializer [[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'] The following 1 profile is active: "production"
2022-10-17 20:40:41,499 INFO org.springframework.boot.context.config.ConfigDataLoader [[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'] Fetching config from server at : http://localhost:8079/
2022-10-17 20:40:41,499 INFO org.springframework.boot.context.config.ConfigDataLoader [[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'] Located environment: name=common-service,employee-service, profiles=[production], label=null, version=1c8f98727c7e2e6f0892e8e7d4a5174e0b5b2220, state=null
Please let me know if anyone has any idea or came across with similar situations.

The camel context initiates shutdown immediately after application start, with no apparent error

My spring-boot app starts a Camel route that consumes from a Kafka-enabled Azure event hub. Immediately after the message that the Application has started, this message is logged: "INFO o.a.camel.spring.SpringCamelContext - Apache Camel 2.24.0 (CamelContext: camel-1) is shutting down".
Then any in-flight exchanges (if they exist) are successfully processed by the Camel route, and eventually the route is shutdown (gracefully), which also terminates the app.
No error messages are shown, nothing seems to be wrong, except that the shutdown is initiated automatically right after the application starts....
Any idea why this happens ?
I have played around with the timeouts for Kafka, but there's no change in behavior.
I have set the logging level to TRACE, but still I don't see why shutdown is initiated.
Among others, I use these libraries: spring-boot-starter, spring-boot-starter-web, azure-servicebus-spring-boot-starter, camel-kafka, camel-spring-boot-starter, camel-undertow-starter
This is how the route starts:
from("kafka:dummytopic?brokers=dummy.servicebus.windows.net:9093&topic={{event.hubs.hub.magento}}&groupId={{event.hubs.consumer-group}}"
+ "&consumersCount=1"
+ "&autoOffsetReset=latest"
+ "&saslMechanism=PLAIN"
+ "&securityProtocol=SASL_SSL"
+ "&sslProtocol=TLSv1.2"
+ "&sslEnabledProtocols=TLSv1.2"
+ "&sslEndpointAlgorithm=HTTPS"
+ "&saslJaasConfig=" + saslJaasConfig
+ "&autoCommitEnable=true")
.....
Normally the route should keep running and polling the kafka Event Hub for events (and process them when they are available).
Instead, it initiates shutdown immediately (still successfully processing any in-flight exchanges) - it simply shuts down gracefully. No error messages.
Any help is appreciated!
PS: this is an extract from the trace log:
15:01:40.867 [main] INFO c.i.s.n.NotificationMicroserviceApplication - Started NotificationMicroserviceApplication in 10.516 seconds (JVM running for 14.643)
15:01:40.868 [main] TRACE o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'camelContext'
15:01:40.868 [main] TRACE o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'springApplicationAdminRegistrar'
15:01:40.868 [main] DEBUG o.a.camel.spring.SpringCamelContext - onApplicationEvent: org.springframework.boot.context.event.ApplicationStartedEvent[source=org.springframework.boot.SpringApplication#22aefae0]
15:01:40.870 [main] TRACE o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'camelContext'
15:01:40.870 [main] TRACE o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'springApplicationAdminRegistrar'
15:01:40.870 [main] DEBUG o.a.camel.spring.SpringCamelContext - onApplicationEvent: org.springframework.boot.context.event.ApplicationReadyEvent[source=org.springframework.boot.SpringApplication#22aefae0]
15:01:40.872 [Thread-37] DEBUG o.s.c.a.AnnotationConfigApplicationContext - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#2cd2a21f, started on Thu Jun 06 15:01:31 EEST 2019
15:01:40.873 [Thread-37] TRACE o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in PropertySource 'configurationProperties'
15:01:40.873 [Thread-37] TRACE o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in PropertySource 'systemProperties'
15:01:40.873 [Thread-37] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'spring.liveBeansView.mbeanDomain' in PropertySource 'systemProperties' with value of type String
15:01:40.874 [Thread-37] TRACE o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'camelContext'
15:01:40.874 [Thread-37] TRACE o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'springApplicationAdminRegistrar'
15:01:40.875 [Thread-37] DEBUG o.a.camel.spring.SpringCamelContext - onApplicationEvent: org.springframework.context.event.ContextClosedEvent[source=org.springframework.context.annotation.AnnotationConfigApplicationContext#2cd2a21f, started on Thu Jun 06 15:01:31 EEST 2019]
15:01:40.877 [Thread-37] TRACE o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'camelContext'
15:01:40.877 [Thread-37] TRACE o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
15:01:40.879 [Thread-37] DEBUG o.s.c.s.DefaultLifecycleProcessor - Stopping beans in phase 2147483647
15:01:40.879 [Thread-37] TRACE o.s.c.s.DefaultLifecycleProcessor - Stopping bean 'camelContext' of type [org.apache.camel.spring.SpringCamelContext]
15:01:40.879 [Thread-37] INFO o.a.camel.spring.SpringCamelContext - Apache Camel 2.24.0 (CamelContext: camel-1) is shutting down
15:01:40.879 [Thread-37] TRACE org.apache.camel.util.ServiceHelper - Stopping service org.apache.camel.impl.DefaultRouteController#108b121f
15:01:40.879 [Thread-37] TRACE org.apache.camel.util.ServiceHelper - Shutting down service org.apache.camel.impl.DefaultRouteController#108b121f
15:01:40.879 [Thread-37] TRACE o.a.camel.support.ServiceSupport - Service already stopped
15:01:40.880 [Thread-37] INFO o.a.c.impl.DefaultShutdownStrategy - Starting to graceful shutdown 1 routes (timeout 300 seconds)
15:01:40.880 [Thread-37] TRACE o.a.c.m.DefaultManagementLifecycleStrategy - Checking whether to register org.apache.camel.util.concurrent.RejectableThreadPoolExecutor#11ee4d34[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0][ShutdownTask] from route: null
15:01:40.880 [Thread-37] DEBUG o.a.c.i.DefaultExecutorServiceManager - Created new ThreadPool for source: org.apache.camel.impl.DefaultShutdownStrategy#58b97c15 with name: ShutdownTask. -> org.apache.camel.util.concurrent.RejectableThreadPoolExecutor#11ee4d34[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0][ShutdownTask]
15:01:41.073 [Thread-37] TRACE o.a.c.u.c.CamelThreadFactory - Created thread[Camel (camel-1) thread #2 - ShutdownTask] -> Thread[Camel (camel-1) thread #2 - ShutdownTask,5,main]
15:01:41.075 [Camel (camel-1) thread #2 - ShutdownTask] DEBUG o.a.c.impl.DefaultShutdownStrategy - There are 1 routes to shutdown
15:01:41.075 [Camel (camel-1) thread #2 - ShutdownTask] TRACE o.a.c.impl.DefaultShutdownStrategy - Shutting down route: routeEventHub with options [Default,CompleteCurrentTaskOnly]
You can see that at 15:01:40.872 it starts closing things down...
I had the same problem, for me case the solution it was add the next depency into pom file.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
There is no thread that keeps the application alive. That's why it immediately shutsdown.
You may want to add spring-boot-starter-web to have a web container that is running or you could have a loop in our main class that prevents the shutdown.
I would go for the web container. So you could also add the actuator framework with some diagnostic information.
This is related to spring version upgrade.
The problem described is related to conflicts between different Maven dependencies. I've had the same problem while trying to use the latest version of Spring Boot with Apache Camel.
After analyzing the dependency tree, it turned out that the version of spring-webmvc was 5.2.9, while all other spring dependencies were of version 5.2.8.
I have solved the problem by using a newer version of camel-spring-boot-dependencies (3.6.0)
Eventually, this solution worked:
#Slf4j
#SpringBootApplication
public class NotificationMicroserviceApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(NotificationMicroserviceApplication.class, args);
}
#Override
public void run(String... args) throws Exception {
log.info("You can press Ctrl+C anytime to shutdown application");
Thread.currentThread().join();
}
}

The Message-Driven EJB unable to connect JMS Destination stating Error creating the db_connection

we have Oracle OSB 11g which is connecting to Oracle 12C DB in remote location or a different LAN.
THE WebLogic EJBs connecting to Oracle AQs via JMS/JDBC and currently we are having issues with them.
the WLS logs says:
####<Sep 21, 2018 9:15:51.083 AM GMT+00:00> <Warning> <EJB> <10.170.128.102>
<osb02_m1> <[ACTIVE] ExecuteThread: '18' for queue: 'weblogic.kernel.Default
(self-tuning)'> <<anonymous>> <>
<e10b4740d6c6fa2e:-5f6b2f84:165f9d83f34:-8000-0000000000000f87>
<1537521351083> <BEA-010096> <The Message-Driven EJB:
RequestEJB3103778799539238415X86e7f92.165e6e1ae31.X725d is unable to connect
to the JMS destination or bind to JCA resource adapter: queue/ProvRequestAQ.
Connection failed after 2,609 attempts. The MDB will attempt to
reconnect/rebind every 10 seconds. This log message will repeat every 600
seconds until the condition clears.>
####<Sep 21, 2018 9:15:51.083 AM GMT+00:00> <Warning> <EJB> <10.170.128.102>
<osb02_m1> <[ACTIVE] ExecuteThread: '18' for queue: 'weblogic.kernel.Default
(self-tuning)'> <<anonymous>> <>
<e10b4740d6c6fa2e:-5f6b2f84:165f9d83f34:-8000-0000000000000f87>
<1537521351083> <BEA-010061> <The Message-Driven EJB:
RequestEJB3103778799539238415X86e7f92.165e6e1ae31.X725d is unable to connect
to the JMS destination: queue/ProvRequestAQ. The Error was:
oracle.jms.AQjmsException: Error creating the db_connection
Nested exception: java.lang.UnsupportedOperationException: Remote JDBC
disabled
Nested exception: java.lang.UnsupportedOperationException: Remote JDBC
disabled>
I searched in internet and found the solution that I have to add the below parameter and add to setDomainEnv.sh and restart the WebLogic admins and managed servers, but still this issue is not resolved. I also checked that the DB User used to connect the DB has enqueue/dequeue privileges over the Oracle queues.
Parameter was
WLS_JDBC_REMOTE_ENABLED="-Dweblogic.jdbc.remoteEnabled=true"
I think the parameter must be added to the startup parameters of your managed servers from your domain console. After adding the parameter restart your managed servers.
The requested parameter might give some trouble on weblogic 12.1.3. As a matter of fact the parameter is deprecated since weblogic 10.3.6.
If you are still in trouble try the following workaround:
https://docs.oracle.com/cd/E24329_01/web.1211/e24376/rmidriver.htm#JDBCP350
Might be helpful.

Variable "inputVariable" does not have a part named "payload"

I am trying to deploy a composite I created in JDeveloper 12.1.3.0.0 to Weblogic 12.1.3.0.0. When I deploy from JDeveloper I get the following message on deployment.
[01:17:00 PM] Error deploying archive sca_MX_StormCreateUpdatePlantAcctWO_ABCS_req_rev1.0.jar to partition "WorkOrderServices" on server WLS_SOA1 [https://myip:8002]
[01:17:00 PM] HTTP error code returned [500]
[01:17:00 PM] Error message from server:
There was an error deploying the composite on WLS_SOA1: Deployment Failed: Error occurred during deployment of component: MX_StormCreateUpdatePlantAcctWO_ABCS_req to service engine: implementation.bpel, for composite: MX_StormCreateUpdatePlantAcctWO_ABCS_req: ORABPEL-05215
Error while loading process.
The process domain is encountering the following errors while loading the process "MX_StormCreateUpdatePlantAcctWO_ABCS_req" (composite "WorkOrderServices/MX_StormCreateUpdatePlantAcctWO_ABCS_req!1.0*soa_7dc4d4f8-7df0-465a-9d11-e7c1d8cb9c2d"): Validation of BPEL2.0 process failed..
This error contained an exception thrown by the underlying process loader module.
Check the exception trace in the log (with logging level set to debug mode). If there is a patch installed on the server, verify that the bpelcClasspath domain property includes the patch classes.
.
[01:17:00 PM] Check server log for more details.
[01:17:00 PM] Error deploying archive sca_MX_StormCreateUpdatePlantAcctWO_ABCS_req_rev1.0.jar to partition "WorkOrderServices" on server WLS_SOA1 [https://myip:8002]
[01:17:00 PM] Deployment cancelled.
[01:17:00 PM] ---- Deployment incomplete ----.
[01:17:00 PM] Error deploying archive file:/WorkOrder_EBS/MX_StormCreateUpdatePlantAcctWO_ABCS_req/deploy/sca_MX_StormCreateUpdatePlantAcctWO_ABCS_req_rev1.0.jar
(oracle.tip.tools.ide.fabric.deploy.common.SOARemoteDeployer)
This composite compiles fine in JDeveloper. In the WLS_SOA1-diagnostic.log I am seeing these errors.
[2016-06-13T13:16:57.542-05:00] [WLS_SOA1] [ERROR] [] [oracle.soa.bpel.engine.compiler] [tid: [ACTIVE].ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: TX12238] [ecid: 921f7c10-6914-4003-96f8-df103a09a69a-0005c140,0] [APP: soa-infra] [DSID: 0000LLAykDqB1FELJ6U4Uf1NMlsk00007u] Validation of BPEL2.0 process failed.
[2016-06-13T13:16:57.542-05:00] [WLS_SOA1] [ERROR] [] [oracle.soa.bpel.engine.compiler] [tid: [ACTIVE].ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: TX12238] [ecid: 921f7c10-6914-4003-96f8-df103a09a69a-0005c140,0] [APP: soa-infra] [DSID: 0000LLAykDqB1FELJ6U4Uf1NMlsk00007u] BPEL/MX_StormCreateUpdatePlantAcctWO_ABCS_req.bpel:71 error "element" is set to "ns3:LogEvent" on this <bpel:variable> but it cannot be resolved (check value of "element", imports, WSDLs or XSDs)., Suggested Fix : Make sure that value "ns3:LogEvent" is resolvable (check imports, value of "element").
[2016-06-13T13:16:57.543-05:00] [WLS_SOA1] [ERROR] [] [oracle.soa.bpel.engine.compiler] [tid: [ACTIVE].ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: TX12238] [ecid: 921f7c10-6914-4003-96f8-df103a09a69a-0005c140,0] [APP: soa-infra] [DSID: 0000LLAykDqB1FELJ6U4Uf1NMlsk00007u] BPEL/MX_StormCreateUpdatePlantAcctWO_ABCS_req.bpel:81 error Variable "inputVariable" does not have a part named "payload" - check expression segment "$inputVariable.payload"
I have ran into similar ORABPEL-05215 errors before and resolved them by updating my MDS. I updated all the MDS files that this composite references. I have re-created the inputVariable to try to resolve this error message with no luck.
I was able to deploy after removing this file WorkOrderRouter_ep.wsdl and its reference in the composite.xml. After looking in the logs the WLS_SOA1-diagnostic.log had multiple entries for not being able to find XSD files that were not necessary to this composite. Turns out this WSDL was referencing them.

Jersey Library errors (NoSuchMethod then IncompatibleClassChangeError)

We just upgraded from Weblogic 10 to Weblogic 12 and started to get this error
<Error> <com.sun.jersey.spi.container.ContainerResponse> <hostname> <nodename> <[ACTIVE] ExecuteThread: '21' for queue: 'weblogic.kernel.Default (self-tuning)'> <ws_user> <> <> <140123234234> <BEA-000000> <The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
java.lang.NoSuchMethodError: com.sun.jersey.client.apache.ApacheHttpClientHandler.getRequestEntityWriter(Lcom/sun/jersey/api/client/ClientRequest;)Lcom/sun/jersey/api/client/TerminatingClientHandler$RequestEntityWriter
After little bit digging, I realized that Jersey library (com.sun.jersey.contribs) needs to be upgraded to 1.18.1 version from 1.2. I did that change and then started to get following error
weblogic.application.ModuleException: java.lang.IncompatibleClassChangeError: com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider and com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$Wadl disagree on InnerClasses attribute
a little digging in it i learned that my JSR311-api (javax.ws.rs) has to be 1.1.1 and it is already that. Now i am lost what else shall i change to have these errors fixed
I had a similar issue when updating the Jersey library. In the end it turned out that the old jar was still in the /lib folder. Make sure that you have completely removed the previous version.
Hope that helps.

Resources