I am getting the following error when I am trying to instantiate a MockHttpServletRequest object like this: MockHttpServletRequest request = new MockHttpServletRequest();
java.lang.NoSuchMethodError: org.springframework.core.CollectionFactory.createLinkedMapIfPossible(I)Ljava/util/Map;at org.springframework.mock.web.MockHttpServletRequest.(MockHttpServletRequest.java:107)
at org.springframework.mock.web.MockHttpServletRequest.(MockHttpServletRequest.java:187)
My maven code:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>Servlet</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
</properties>
<dependencies>
<!-- http://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<!-- http://mvnrepository.com/artifact/org.springframework/spring-mock -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.8</version>
</dependency>
</dependencies>
</project>
the iml file:
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/web/WEB-INF/web.xml" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/web" relative="/" />
</webroots>
<sourceRoots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Java EE 6-Java EE 6" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-mock:2.0.8" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1" level="project" />
</component>
</module>
My external libraries directories:
I have also added a Java Servlet jar:
I am using Intellij IDEA; thanks in advance.
M. Deinum response worked for me, replace spring-mock with spring-test, additionally take a look at the .iml file and make sure the spring-mock is gone, otherwise remove it manually and re-attempt to execute the test.
Credits to: M. Deinum
Related
I am using phonegap-version cli-5.2.0 i could not build apk. error is here below
Error - The following plugin, plugin version or a dependancy of this plugin is not on npm: Device
my config.xml
this is my config file my plugins are given below
org.apache.cordova.core.geolocation,Device,Logger,Compass,NetworkStatus,Debug Console,Geolocation,SplashScreen,Battery,Globalization
<?xml version="1.1" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id = "com.test.www" version="1.1" >
<name>test</name>
<description>
test
</description>
<preference name="permissions" value="none"/>
<gap:plugin name="org.apache.cordova.core.geolocation" />
<feature name="Geolocation">
<param name="ios-package" value="CDVLocation" />
</feature>
<plugins>
<plugin name="Device" value="CDVDevice" />
<plugin name="Logger" value="CDVLogger" />
<plugin name="Compass" value="CDVLocation" />
<plugin name="NetworkStatus" value="CDVConnection" />
<plugin name="Debug Console" value="CDVDebugConsole" />
<plugin name="Geolocation" value="CDVLocation" />
<plugin name="SplashScreen" value="CDVSplashScreen" />
<plugin name="Battery" value="CDVBattery" />
<plugin name="Globalization" value="CDVGlobalization" />
</plugins>
<preference name="phonegap-version" value="cli-5.2.0" />
<!--<preference name="android-windowSoftInputMode" value="adjustPan" />-->
<preference name="android-windowSoftInputMode" value="adjustResize" />
<icon src="images/ldpi.png" gap:platform="android" gap:density="ldpi" />
<icon src="images/mdpi.png" gap:platform="android" gap:density="mdpi" />
<icon src="images/hdpi.png" gap:platform="android" gap:density="hdpi" />
<icon src="images/xhdpi.png" gap:platform="android" gap:density="xhdpi" />
<!-- iPhone icons -->
<icon src="images/57.png" gap:platform="ios" width="57" height="57" />
<icon src="images/114.png" gap:platform="ios" width="114" height="114" />
<icon src="images/72.png" gap:platform="ios" width="72" height="72" />
<icon src="images/76.png" gap:platform="ios" width="76" height="76" />
<icon src="images/120.png" gap:platform="ios" width="120" height="120" />
<icon src="images/152.png" gap:platform="ios" width="152" height="152" />
<!-- Android splashes -->
<gap:splash src="images/sldpi.png" gap:platform="android" gap:density="ldpi" />
<gap:splash src="images/smdpi.png" gap:platform="android" gap:density="mdpi" />
<gap:splash src="images/shdpi.png" gap:platform="android" gap:density="hdpi" />
<gap:splash src="images/sxhdpi.png" gap:platform="android" gap:density="xhdpi" />
<!-- iPhone splashes -->
<gap:splash src="images/320x480.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="images/640x960.png" gap:platform="ios" width="640" height="960" />
<gap:splash src="images/640x1136.png" gap:platform="ios" width="640" height="1136" />
<gap:plugin name="com.devexpress.plugins.devextremeaddon" version="1.0.1" />
<gap:plugin name="com.phonegap.plugin.statusbar" version="1.1.0" />
<gap:plugin name="org.apache.cordova.splashscreen" version="0.3.4" />
<gap:plugin name="org.li8.inappbrowser" version="0.1" />
<gap:plugin name="org.apache.cordova.network-information" version="0.2.12" />
<gap:plugin name="com.danielcwilson.plugins.googleanalytics" version="0.6.1" />
<gap:plugin name="nl.x-services.plugins.socialsharing" version="3.8.1" />
<preference name="SplashScreen" value="foo" />
<preference name="SplashScreenDelay" value="8000" />
<access origin="*" />
</widget>
Okay, I've fixed up your config.xml, but you likely have errors in your index.html also. I would suggest you post that as well.
Also, i removed the icons, plugins, preferences, and more, because you can always add those back. This example gets you working.
You should read the Phonegap Build blog for the last 60 days or so, and there are more changes coming in the next 30 days. If you get a chance skim through the Cordova blog as well.
You should also skim this: Top Mistakes by Developers new to Cordova/Phonegap
AND READ these
HOW TO apply the Cordova/Phonegap the whitelist system
Core Plugins Setup
Glossary - deprecated means - considered old, and planned to be phased out, but still available for use.
Your Fixes
NOTE YOUR APP IS NOW INSECURE. IT IS UP TO YOU TO SECURE YOUR APP.
Read: HOW TO apply the Cordova/Phonegap the whitelist system
<?xml version="1.1" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id = "com.appbogoo.www" version="1.1" >
<name>BOGOO</name>
<description>
BOGOO
</description>
<preference name="phonegap-version" value="cli-5.2.0" />
<plugin name="cordova-plugin-geolocation" source="npm" spec="1.0.1" />
<plugin name="cordova-plugin-inappbrowser" source="npm" spec="1.0.1" />
<plugin name="cordova-plugin-network-information" source="npm" spec="1.0.1" />
<plugin name="cordova-plugin-splashscreen" source="npm" spec="2.1.0" />
<plugin name="cordova-plugin-statusbar" source="npm" spec="1.0.0" />
<!-- No longer available -->
<!-- <gap:plugin name="com.devexpress.plugins.devextremeaddon" version="1.0.1" /> -->
<!-- Deprecated -->
<!-- <gap:plugin name="com.danielcwilson.plugins.googleanalytics" version="0.6.1" /> -->
<plugin name="cordova-plugin-google-analytics source="npm" spec="0.8.1" />
<!-- Deprecated -->
<!-- <gap:plugin name="nl.x-services.plugins.socialsharing" version="3.8.1" /> -->
<plugin name="cordova-plugin-x-socialsharing source="npm" spec="5.0.7" />
<plugin name="cordova-plugin-whitelist" source="npm" spec="1.1.0" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" /> <!-- Required for iOS9 -->
</widget>
Change Plugin name and value is the package name of plugin. example:
</description>
<preference name="permissions" value="none"/>
<gap:plugin name="org.apache.cordova.core.geolocation" />
<feature name="Geolocation">
<param name="ios-package" value="CDVLocation" />
</feature>
<plugins>
<plugin name="cordova-plugin-device" value="org.apache.cordova.Device" />
<plugin name="cordova-plugin-network-information" value="CDVConnection" />
<plugin name="Debug Console" value="CDVDebugConsole" />
<plugin name="cordova-plugin-globalization" value="CDVLocation" />
<plugin name="cordova-plugin-splashscreen" value="CDVSplashScreen" />
//etc...
</plugins>
I am using jersey.
this is my jboss-deployment-structure:
<?xml version="1.0" encoding="UTF-8" ?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclusions>
<module name="org.jboss.resteasy.resteasy-atom-provider" />
<module name="org.jboss.resteasy.resteasy-cdi" />
<module name="org.jboss.resteasy.resteasy-jaxrs" />
<module name="org.jboss.resteasy.resteasy-jaxb-provider" />
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
<module name="org.jboss.resteasy.resteasy-jsapi" />
<module name="org.jboss.resteasy.resteasy-multipart-provider" />
<module name="org.jboss.resteasy.async-http-servlet-30" />
<module name="javax.ws.rs.api" />
</exclusions>
<exclude-subsystems>
<subsystem name="resteasy" />
<subsystem name="webservices" />
<subsystem name="jaxrs" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
This alone does not work. I had to comment
<resource-root path="jboss-jaxrs-api_1.1_spec-1.0.1.Final-redhat-2.jar"/>
in
jbossHOME\modules\system\layers\base\javax\ws\rs\api\main\module.xml.
Now the rest service works fine, but by commenting the line, i am disabling resteasy for every application in the server! and that's a hack, not a proper solution. Is there a decent way to disable resteasy just for a given application without touching the general server configuration?
thanks
In JBoss 6 or 7 AS resteasy is loaded as a dependency module by the JavaEE module. Most of the time people get stuck here as we can not exclude JavaEE. However it's possible to exclude JavaEE and include the modules JavaEE is supposed to load except the one's we don't need.
For more details you can check here Foolproof method of excluding resteasy...
Sample jboss-deployment-structure.xml from the same place (Goes in WEB-INF/) :
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
<subsystem name="webservices" />
<subsystem name="resteasy" />
</exclude-subsystems>
<exclusions>
<module name="javaee.api" />
<module name="javax.ws.rs.api" />
<module name="org.jboss.as.jaxrs" />
<module name="org.jboss.resteasy.resteasy-jaxrs" />
<module name="org.jboss.resteasy.resteasy-cdi" />
<module name="org.jboss.resteasy.jackson-provider" />
<module name="org.jboss.resteasy.resteasy-atom-provider" />
<module name="org.jboss.resteasy.resteasy-hibernatevalidator-provider" />
<module name="org.jboss.resteasy.resteasy-jaxb-provider" />
<module name="org.jboss.resteasy.resteasy-jettison-provider" />
<module name="org.jboss.resteasy.resteasy-jsapi" />
<module name="org.jboss.resteasy.resteasy-multipart-provider" />
<module name="org.jboss.resteasy.resteasy-yaml-provider" />
<module name="org.codehaus.jackson.jackson-core-asl" />
<module name="org.codehaus.jackson.jackson-jaxrs" />
<module name="org.codehaus.jackson.jackson-mapper-asl" />
<module name="org.codehaus.jackson.jackson-xc" />
<module name="org.codehaus.jettison" />
<module name="org.jboss.as.webservices.*" />
<module name="org.jboss.ws.*" />
</exclusions>
<dependencies>
<module name="javax.activation.api" export="true" />
<module name="javax.annotation.api" export="true" />
<!-- <module name="javax.ejb.api" export="true" />
<module name="javax.el.api" export="true" /> -->
<module name="javax.enterprise.api" export="true" />
<module name="javax.enterprise.deploy.api" export="true" />
<module name="javax.inject.api" export="true" />
<module name="javax.interceptor.api" export="true" />
<!-- <module name="javax.jms.api" export="true" />
<module name="javax.jws.api" export="true" />
<module name="javax.mail.api" export="true" />
<module name="javax.management.j2ee.api" export="true" /> -->
<module name="javax.persistence.api" export="true" />
<module name="javax.resource.api" export="true" />
<!-- <module name="javax.rmi.api" export="true" />
<module name="javax.security.auth.message.api" export="true" />
<module name="javax.security.jacc.api" export="true" /> -->
<module name="javax.servlet.api" export="true" />
<module name="javax.servlet.jsp.api" export="true" />
<module name="javax.transaction.api" export="true" />
<module name="javax.validation.api" export="true" />
<!-- <module name="javax.ws.rs.api" export="true" services="export" /> -->
<module name="javax.xml.bind.api" export="true" />
<module name="javax.xml.registry.api" export="true" />
<module name="javax.xml.soap.api" export="true" />
<module name="javax.xml.ws.api" export="true" />
<!-- This one always goes last. -->
<module name="javax.api" export="true" />
</dependencies>
</deployment>
</jboss-deployment-structure>
I am going through this Spring web MVC tutorial but am stuck at section 1.12 where I should be seeing a "Hello" page handled by my Controller, but instead get "HTTP Status 404 - Servlet is not available". I have looked at the other stackoverflow questions that have the same error, but none have helped.
Here are the relevant files:
/web/WEB-INF/web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<!--
The "Front Controller" (http://en.wikipedia.org/wiki/Front_Controller_pattern).
that dispatches requests to registered handlers (Controller implementations).
-->
<servlet>
<servlet-name>filth</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>filth</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
/web/WEB-INF/filth-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- the application context definition for the filth DispatcherServlet -->
<context:component-scan base-package="com.filth.controller"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/web/view/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
/web/view/hello.jsp:
<html>
<head><title>Hello :: Spring Application</title></head>
<body>
<h1>Hello - Spring Application</h1>
<p>Greetings.</p>
</body>
</html>
/src/main/java/com/filth/controller/HelloController.java:
package com.filth.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
/**
* Controller for the "Hello" page
*/
#Controller
public class HelloController {
private static final Log LOGGER = LogFactory.getLog(HelloController.class);
#RequestMapping(value="/hello.html", method = RequestMethod.GET)
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
LOGGER.info("Returning hello view");
return new ModelAndView("hello");
}
}
/build.properties:
# Ant properties for building FiLTH
appserver.home=${env.WORKSPACE}/tomcat6
appserver.lib=${appserver.home}/lib
deploy.path=${appserver.home}/webapps
tomcat.manager.url=http://localhost:8080/manager
tomcat.manager.username=tomcat
tomcat.manager.password=s3cret
/build.xml:
<?xml version="1.0"?>
<project name="filth" xmlns:ivy="antlib:org.apache.ivy.ant" basedir="." default="usage">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement path="${build.lib.dir}/ant-contrib.jar"/>
</classpath>
</taskdef>
<taskdef name="ivy-configure" classname="org.apache.ivy.ant.IvyConfigure"/>
<taskdef name="ivy-resolve" classname="org.apache.ivy.ant.IvyResolve"/>
<taskdef name="ivy-retrieve" classname="org.apache.ivy.ant.IvyRetrieve"/>
<taskdef name="ivy-deliver" classname="org.apache.ivy.ant.IvyDeliver"/>
<taskdef name="ivy-publish" classname="org.apache.ivy.ant.IvyPublish"/>
<target name="ivy-resolve">
<ivy:configure />
<ivy:resolve file="${ivy.dep.file}" conf="${ivy.configurations}" />
<ivy:retrieve pattern="${ivy.retrieve.pattern}" conf="${ivy.configurations}" />
<echo message="ivy.dep.file: ${ivy.dep.file}"/>
<echo message="ivy.configurations: ${ivy.configurations}"/>
<echo message="ivy.retrieve.pattern: ${ivy.retrieve.pattern}"/>
</target>
<property environment="env"/>
<property file="build.properties"/>
<property file="build.passwords.properties" />
<property name="src.dir" value="src/main/java"/>
<property name="test.dir" value="src/test"/>
<property name="web.dir" value="web/"/>
<property name="build.dir" value="target"/>
<property name="name" value="filth"/>
<property name="resources.dir" value="src/main/resources"/>
<path id="master-classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<!-- We need the servlet API classes: -->
<!-- * for Tomcat 5/6 use servlet-api.jar -->
<!-- * for other app servers - check the docs -->
<fileset dir="${appserver.lib}">
<include name="servlet*.jar"/>
</fileset>
<pathelement path="${resources.dir}"/>
<pathelement path="${build.dir}"/>
</path>
<target name="usage">
<echo message=""/>
<echo message="${name} build file"/>
<echo message="-----------------------------------"/>
<echo message=""/>
<echo message="Available targets are:"/>
<echo message=""/>
<echo message="build --> Build the application"/>
<echo message="deploy --> Deploy application as directory"/>
<echo message="deploywar --> Deploy application as a WAR file"/>
<echo message="install --> Install application in Tomcat"/>
<echo message="reload --> Reload application in Tomcat"/>
<echo message="start --> Start Tomcat application"/>
<echo message="stop --> Stop Tomcat application"/>
<echo message="list --> List Tomcat applications"/>
<echo message=""/>
</target>
<target name="build" description="Compile main source tree java files">
<mkdir dir="${build.dir}"/>
<javac destdir="${build.dir}" source="1.6" target="1.6" debug="true"
deprecation="false" optimize="false" failonerror="true">
<src path="${src.dir}"/>
<classpath refid="master-classpath"/>
</javac>
</target>
<target name="deploy" depends="build" description="Deploy application">
<copy todir="${deploy.path}/${name}" preservelastmodified="true">
<fileset dir="${web.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<target name="deploywar" depends="build" description="Deploy application as a WAR file">
<war destfile="${name}.war" webxml="${web.dir}/WEB-INF/web.xml">
<fileset dir="${web.dir}">
<include name="**/*.*"/>
</fileset>
</war>
<copy todir="${deploy.path}" preservelastmodified="true">
<fileset dir=".">
<include name="*.war"/>
</fileset>
</copy>
</target>
<target name="buildtests" description="Compile test tree java files">
<mkdir dir="${build.dir}"/>
<javac destdir="${build.dir}" source="1.6" target="1.6" debug="true"
deprecation="false" optimize="false" failonerror="true">
<src path="${test.dir}"/>
<classpath refid="master-classpath"/>
</javac>
</target>
<target name="tests" depends="build, buildtests" description="Run tests">
<junit printsummary="on"
fork="false"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true">
<classpath refid="master-classpath"/>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${build.dir}">
<include name="**/*Test.*"/>
</fileset>
</batchtest>
</junit>
<fail if="tests.failed">
tests.failed=${tests.failed}
***********************************************************
***********************************************************
**** One or more tests failed! Check the output ... ****
***********************************************************
***********************************************************
</fail>
</target>
<!-- ============================================================== -->
<!-- Tomcat tasks - remove these if you don't have Tomcat installed -->
<!-- ============================================================== -->
<path id="catalina-ant-classpath">
<!-- We need the Catalina jars for Tomcat -->
<!-- * for other app servers - check the docs -->
<fileset dir="${appserver.lib}">
<include name="catalina-ant.jar"/>
<include name="tomcat-coyote.jar"/>
<include name="tomcat-util.jar"/>
</fileset>
<fileset dir="${appserver.home}/bin">
<include name="tomcat-juli.jar"/>
</fileset>
</path>
<taskdef name="install" classname="org.apache.catalina.ant.DeployTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="list" classname="org.apache.catalina.ant.ListTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<target name="install" description="Install application in Tomcat">
<install url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"
war="${name}"/>
</target>
<target name="reload" description="Reload application in Tomcat">
<reload url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"/>
</target>
<target name="start" description="Start Tomcat application">
<start url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"/>
</target>
<target name="stop" description="Stop Tomcat application">
<stop url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"/>
</target>
<target name="list" description="List Tomcat applications">
<list url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"/>
</target>
<!-- End Tomcat tasks -->
</project>
/ivy.xml:
<ivy-module version="2.0">
<info organisation="org.apache" module="hello-ivy"/>
<dependencies>
<dependency org="org.springframework" name="spring-context" rev="4.1.6.RELEASE"/>
<dependency org="org.springframework" name="spring-webmvc" rev="4.1.6.RELEASE"/>
<dependency org="commons-logging" name="commons-logging" rev="1.2"/>
<dependency org="javax.servlet" name="servlet-api" rev="2.5"/>
<dependency org="junit" name="junit" rev="4.12"/>
</dependencies>
</ivy-module>
I am getting the error when navigating to http://localhost:8080/filth/hello.html.
catalina.out does not give any errors, and I do see the log entry from HelloController.java, but very inconsistently--not sure why that is either.
Note that http://localhost:8080/filth/index.jsp, and http://localhost:8080/filth/view/hello.jsp work--just going through the Controller is not working as expected.
Anyone have any ideas?
Let me know if you need more context/info.
Thanks!
Figured it out. I didn't have the necessary jar dependencies included in the deployment--added a lib/ directory in WEB-INF and had ivy place necessary runtime dependecies there (the "deploy" ant target took it from there). I didn't see this error earlier because I wasn't looking in the right log file--finally saw that logging output was going to [tomcat]/logs/localhost...log.
My sessions are not being cached. I am using co-located caching on my web role.
I have the following in my web.config:
<configSections>
<section name="cacheDiagnostics" type="Microsoft.ApplicationServer.Caching.AzureCommon.DiagnosticsConfigurationSection, Microsoft.ApplicationServer.Caching.AzureCommon" allowLocation="true" allowDefinition="Everywhere" />
</configSections>
...
<dataCacheClients>
<dataCacheClient name="default">
<autoDiscover isEnabled="true" identifier="Website" />
</dataCacheClient>
</dataCacheClients>
My cloud service definition (.csdef) is as follows:
<ServiceDefinition name="WebCloud.Test" ...>
<WebRole name="Website" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Caching" />
</Imports>
<Startup priority="-2">
<Task commandLine="Microsoft.WindowsAzure.Caching\ClientPerfCountersInstaller.exe install" executionContext="elevated" taskType="simple" />
</Startup>
</WebRole>
</ServiceDefinition>
And the following in the ConfigurationSettings of the cscfg file:
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ConfigStoreConnectionString" value="DefaultEndpointsProtocol=http;AccountName=ACCOUNTNAME;AccountKey=ACCOUNTKEY==" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="1" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.NamedCaches" value="{"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]}" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel" value="1" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.CacheSizePercentage" value="20" />
Can anyone spot why it is not working? Is it perhaps the identifier set in dataCacheClients?
I fixed the issue. The following needs to be included in the web.config:
<sessionState mode="Custom" customProvider="AFCacheSessionStateProvider">
<providers>
<add name="AFCacheSessionStateProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheSessionState"/>
</providers>
</sessionState>
This stores ASP.NET Session State in the cache.
I apologize for perhaps naive question but I couldn't find an answer online.
I've got some UI code that was created in NetBeans. Unfortunately I don't know what version was used. My understanding is that IntelliJ IDEA (v11 in my case) doesn't support NetBeans forms.
Can I convert the form to something usable in IDEA's form editor ? Content of form's XML file looks lie this:
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel3"/>
</Properties>
</Component>
<Menu class="javax.swing.JMenuBar" name="menuBar">
<SubComponents>
<Menu class="javax.swing.JMenu" name="fileMenu">
<Properties>
<Property name="mnemonic" type="int" value="102"/>
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="openMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="111"/>
<Property name="text" type="java.lang.String" value="Open"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="saveMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="115"/>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="saveAsMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="97"/>
<Property name="text" type="java.lang.String" value="Save As ..."/>
<Property name="displayedMnemonicIndex" type="int" value="5"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="exitMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="120"/>
<Property name="text" type="java.lang.String" value="Exit"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exitMenuItemActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="editMenu">
<Properties>
<Property name="mnemonic" type="int" value="101"/>
<Property name="text" type="java.lang.String" value="Edit"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="cutMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="116"/>
<Property name="text" type="java.lang.String" value="Cut"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="copyMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="121"/>
<Property name="text" type="java.lang.String" value="Copy"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="pasteMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="112"/>
<Property name="text" type="java.lang.String" value="Paste"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="deleteMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="100"/>
<Property name="text" type="java.lang.String" value="Delete"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="helpMenu">
<Properties>
<Property name="mnemonic" type="int" value="104"/>
<Property name="text" type="java.lang.String" value="Help"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="contentsMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="99"/>
<Property name="text" type="java.lang.String" value="Contents"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="aboutMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="97"/>
<Property name="text" type="java.lang.String" value="About"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="My Reporting"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="menuBar"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="dataRequestButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="99" pref="99" max="99" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="downloadButton" min="-2" max="-2" attributes="0"/>
<Component id="answersLoaded" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="answersToLoad" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
</Group>
<Component id="statusLabel" alignment="0" pref="574" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="493" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="534" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="answersLoaded" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="answersToLoad" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="dataRequestButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="downloadButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="316" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="statusLabel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Answer data loaded until"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="answersLoaded">
<Properties>
<Property name="text" type="java.lang.String" value="<nothing loaded>"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Unloaded answers at the server"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="answersToLoad">
<Properties>
<Property name="text" type="java.lang.String" value="<nothing available>"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="downloadButton">
<Properties>
<Property name="text" type="java.lang.String" value="Download ready data"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downloadButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="statusLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Ready"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="dataRequestButton">
<Properties>
<Property name="text" type="java.lang.String" value="Request data"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="dataRequestButtonActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="engineTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="4" rowCount="4">
<Column editable="true" title="Title 1" type="java.lang.Object"/>
<Column editable="true" title="Title 2" type="java.lang.Object"/>
<Column editable="true" title="Title 3" type="java.lang.Object"/>
<Column editable="true" title="Title 4" type="java.lang.Object"/>
</Table>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
</TableColumnModel>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Engines"/>
</Properties>
</Component>
</SubComponents>
</Form>
Thanks a lot.
IntelliJ IDEA doesn't support NetBeans forms, you can try to use the create snapshot feature that can save IDEA form file from a dialog of the running application.
However, much more convenient solution would be to use JFormDesigner which has IntelliJ IDEA plug-in and can convert NetBeans form files. Note that this tool is commercial and will cost you money, but it's free to try.
I have had perfect success by simply opening up the Source tab in the NetBeans Form editor where I created the form and copying the entirety of the code into a new Class in IntelilJ, then simply adding the code for a new JFrame and its code and passing (this) to the Panel parameter at the bottom of the initComponentsGui method.
Such as:
public class ConvertedGui extends Panel { // my new class
private void initComponents()... // copied code
// >>> the copied code here >>>
JFrame frame = new JFrame("Title For JFrame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(1440, 900);// or your preferred size
frame.add(this);
frame.setVisible(true);`
}
// >>> More copied code for all the actionListeners etc.>>>