The route configured by SpringMVC shows that 404 does not find resources - spring-mvc

HelloController.java
web.xml
springmvc-servlet.xml
And I tried to add dependencies to the lib directory in the project structure
workpiece
tomcat configuration

Related

Start weblogic weblogic12.2.1.4.0 causes exceptions

I imported my maven project then I started my project on my weblogic server but it gives
java.lang.NoSuchMethodError: weblogic.i18n.logging.CatalogMessage.getLocalizerResourceName()
I checked my jar file and I saw it does not contains CatalogMessage class.Do you have any idea how to fix that problem.
My pom fies contains weblogic 10.3.2.0 jar but it does not contains necessary class files
My full error message :
The WebLogic Server encountered a critical failure
Reason:weblogic.common.internal.VersionInfo.initialize(ZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIII)V
Exception in thread "main" java.lang.NoSuchMethodError: weblogic.i18n.logging.CatalogMessage.getLocalizerResourceName()Ljava/lang/String;
at weblogic.logging.MessageLogger.log(MessageLogger.java:68)
at weblogic.logging.MessageLogger.log(MessageLogger.java:114)
at weblogic.logging.WLMessageLogger.log(WLMessageLogger.java:52)
at weblogic.kernel.T3SrvrLogger.logServerStateChange(T3SrvrLogger.java:2284)
at weblogic.t3.srvr.T3Srvr.setState(T3Srvr.java:190)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:458)
at weblogic.Server.main(Server.java:67)
I cannot understand why project contains weblogic 10.3.2.0 jar?I use weblogic 12.2.1.4.0 .
My pom file is :
<dependency>
<groupId>com.myRepo.reporter-application.project</groupId>
<artifactId>weblogic</artifactId>
<version>10.3.2.0</version>
<scope>provided</scope>
</dependency>

Weblogic upgrade to 12c: deployment fails because url mapped to multiple servlet

I've recently setup a new Weblogic 12c environment. On deploying an application that I know works in Weblogic 11g I get the error "The url-pattern /resources/* in web application is mapped to multiple Servlets."
The mapping it's referring to is in the web.xml inside the application.ear that's being deployed, but it's only mapped once:
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
The project doesn't contain any other references to the url pattern /resources/*, can someone explain where the duplicated mapping is coming from and how I can work around it?
The closest issue I could find is this: https://bugster.forgerock.org/jira/si/jira.issueviews:issue-html/OPENAM-7947/OPENAM-7947.html, which has been marked as unreproducible.
Full stack trace from deployment:
<Error> <Deployer> <BEA-149205> <Failed to initialize the application "<application_name>" due to error weblogic.application.ModuleException: weblogic.management.DeploymentException: [HTTP:101401]The url-pa
ttern /resources/* in web application <application_name> is mapped to multiple Servlets.
weblogic.application.ModuleException: weblogic.management.DeploymentException: [HTTP:101401]The url-pattern /resources/* in web application <application_name> is mapped to multiple Servlets.
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:114)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:83)
at weblogic.application.utils.StateMachineDriver.nextStateInParallel(StateMachineDriver.java:144)
at weblogic.application.internal.flow.ModuleStateDriver.parallelPrepare(ModuleStateDriver.java:46)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:75)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:55)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:731)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:243)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:66)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:65)
at weblogic.deploy.internal.targetserver.AppDeployment.prepare(AppDeployment.java:158)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:41)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:193)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:31)
at weblogic.management.deploy.internal.ConfiguredDeployments$2.doItem(ConfiguredDeployments.java:684)
at weblogic.management.deploy.internal.parallel.BucketInvoker.invoke(BucketInvoker.java:138)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionAppsParallel(ConfiguredDeployments.java:692)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:322)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:202)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:207)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:129)
at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:76)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1262)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:332)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:374)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:232)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:85)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2020)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
If you use web annotations in java code, you don't have to declare the servlet in the web.xml file any more.
You can try by removing the corresponding "servlet" and "servlet-mapping" tags in web.xml
It seems that WebLogic 12.1.3 can deal with double declaration (inline annotation & xml) but not anymore in WebLogic 12.2.
I had this error with #webservice annotation when I specified the "serviceName" parameter and when I declared the servlet in web.xml file with the same value.
The issue doesn't exist in version 12.1.3 (which happened to be the version we were meant to be upgrading to).
Weblogic as of version 12.2.1.3 automatically registers a JAX-RS servlet to the path /resources/* in certain scenarios (e.g. some dependency like jackson-jaxrs-json-provider "requests" it via annotation/spi/moduleinfo). But if this path is already registered by another service the mentioned error is thrown.
There are 3 possible solutions one can try:
In our case the issue was coming from classpath scanning for web services components, and finding annotated services in the webservices-rt jar. That scanning needed to be switched off.
Setting the metadata-complete attribute to true in the web.xml descriptor if your Web application does not have any annotations and if you have the version set to 2.5 or higher to avoid unnecessary scanning of the Web applications classes for annotations. E.g.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">
<servlet>
<servlet-name>sample</servlet-name>
<servlet-class>Sample</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>sample</servlet-name>
<url-pattern>/sample</url-pattern>
</servlet-mapping>
</web-app>
Alternatively, you can turn off annotation processing and DI for all the Web applications by setting -Dweblogic.servlet.DIDisabled=true flag when starting WebLogic Server.
Registering another path for jersey in the web.xml to e.g. /jersey/*
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/jersey/*</url-pattern>
</servlet-mapping>
Try removing the FATP jars which were added after 12.2 upgrade. This worked for me.

Webdeploy - precompile asp.net application error with excluded connectionstrings in excluded app_data folder

I try to use webdeploy for our asp.net application. Today I tried to activate the "Precompile during publishing" flag. It seems that this flag doesn`t work together with the "Exclude files from the App_Data folder".
Before I activated the precompiling in webdeploy everything worked fine. If I remove the configSource from my connectionStrings and run the webdeploy with precompiling it works again.
The problem is that I have to load the external connectionstring file, because it will be managed by the administrators for production-environments.
The error message I get from webdeploy is:
"An error occurred loading a configuration file: Directory 'C:\MyProject\obj\Release\AspnetCompileMerge\Source\App_Data' does not exist. Failed to start monitoring file changes."
My current setup is the following:
Web.Config:
<configuration>
<!-- Section stuff here -->
<connectionStrings configSource="App_Data\DBConnection.xml" />
<!-- More stuff here -->
</configuration>
New webdeploy settings:
Try excluding the config file from the package by adding the following MSBuild script to either your project file or a wpp.targets file:
<ItemGroup>
<ExcludeFromPackageFiles Include="App_Data\DBConnection.xml">
<FromTarget>Project</FromTarget>
</ExcludeFromPackageFiles>
</ItemGroup>
Hey this did not work for us. But we also updated our tfs in the last days and we had a look into the webdeploy parameters which can be set easily with the release Manager from our new tfs. So we just readded he connectionstrings into the web.config and than we compile everything. In the end we decided where it's going to be deployed and than we set automatically the connectionstrings, which are hidden for us Devs.

jboss modules system dependencies from ear/lib

I am trying to add more functionality to a product i work on( it is web application) by using jboss modules, the product is a .ear file which contains a utility.jar (this jar is inside the lib folder inside .ear file). Now I am trying to add a single class file by using jboss modules, i have created a jar which contains the new class file and i am trying to add the dependency in module.xml since this new class needs lot of files/class from utility.jar's different packages (around 15 classes are used/imported to compile this new class). Is it possible to achieve this.
I am trying to do this way since product team is the owner for deployment and they don't want to touch/modify the .ear file,hence i can't ask them to just add the new class file in the utility.jar (which works perfectly by the way).
Content of the module.xml are given below.
Error message in jboss log is
Caused by: java.lang.ClassNotFoundException: com.xyx.mdm.wkflw.eng.activities.SqActInstImpl from [Module "com.xyx.mdm:main" from local module loader #5add5415 (roots: D:\project\jboss-as-7.1.1.Final\modules)]
<module xmlns="urn:jboss:module:1.1" name="com.xyx.mdm">
<resources><resource-root path="activity.jar" />
</resources>
<dependencies>
<system export="true">
<paths>
<path name="com/xyx/mdm/wkflw/eng/activities"/>
</paths>
</system>
</dependencies>
</module>

How do you deploy a war at startup in apache-karaf

I have created a war file that I deploy in karaf by running the osgi:install command like
osgi:install -s file:/system/com/mywebapp/1.0.0/mywebapp-1.0.0.war
How can I configure karaf so that this happens when the karaf instance starts?
I've changed the org.apache.karaf.features.cfg file to start the war feature by default
featuresBoot=config,ssh,management,kar,war
Here is a sample features.xml for a war file-
<?xml version="1.0" encoding="UTF-8"?>
<features name="feature-set">
<feature name="my-feature" version="1.0.0"
xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
<feature>war</feature>
<bundle>mvn:com.foo/mywebapp/1.0.0/war</bundle>
</feature>
</features>
The important part is that the mvn url to the war file "mvn:com.foo/mywebapp/1.0.0/war". If you miss the suffix /war in the path the maven url looks for a jar file.
It's best to create your own features file and start your war from this features file, with it you are also able to set the startlevel and it's dependencies.
Another way of deploying is to place your war in the deploy folder.

Resources