Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Namrata Narula

Greenhorn
+ Follow
since Oct 04, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Namrata Narula

Hi Paul,
Yes..I did use the Rest Client where in I could specify the request to go as POST .Also I gave the "json={"source":"structured"}" as the part of the requestbody.
I am still getting the same error.Let me know if you need any more data from me.

Thanks in advance
7 years ago
HI,
I have Spring applications built where in I am able to retrieve the response when using simple request parameters in the request coming from UI.However when trying to replace it with @RequestBody with passing a json in the request.It gives me 405 "Method not allowed error".
Here is the code of web.xml file
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-servlet.xml</param-value>
</context-param>

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

spring_servlet.xml

<context:component-scan base-package="com.dataguise.dgcontrol.servlets" />
<mvc:annotation-driven />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>

<ref bean="jsonConverter" />
</list>
</property>
</bean>

<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">
<property name="contentType" value="application/json"/>
</bean>

<bean id="jsonConverter"
class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
<property name="supportedMediaTypes" value="application/json" />
</bean>

My Spring controller class has two methods
@Controller


public class DgCentralControllerServlet {

DgControlRepository repo = new DgControlRepository();


///Method 1
@RequestMapping(value ="/LoadDiscoverExpression")
public @ResponseBody List<DgPolicyRegexPatternsUI> getMovie(@RequestParam("id") Integer id ,@RequestParam("source") String source, HttpServletResponse response,
HttpServletRequest request) throws DgException{

List<DgPolicyRegexPatternsUI> dgRegexPatternsList = repo.loadPolicyRegexPatternsTest(id,source, "All");

return dgRegexPatternsList;
}

/// Method 2
@RequestMapping(value ="/LoadDiscover", method=RequestMethod.POST, headers={"Accept=*/*", "Content-Type=application/json"})
public @ResponseBody DgDiscoverExpressionPol getexp(@RequestBody DgDiscoverExpressionPol pol,Model model) throws Exception{

DgDiscoverExpressionPol returnpol = new DgDiscoverExpressionPol();
returnpol.setSource(pol.getSource());
return returnpol;
}

Method 1 works and gives me response when running the URL on the browser using RESTCLIENT addon on mozilla
http://localhost:8080/dgControl/LoadDiscoverExpression?id=0&source=structured

However when using the Method 2 on the URL
http://localhost:8080/dgControl/LoadDiscover?json={"source":"structured"}

It gives me 405 Method not allowed error
7 years ago
I created the self signed certificate using java keytool and gave the path of the .keystore file in server.xml file in the conf folder of Tomcat.
I have an existing Web Application where I am using SOAP web services and I have to configure SSL in it.
I added the following code in the web.xml file of the application
<security-constraint>
<web-resource-collection>
<web-resource-name>securedapp</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
Now redeploying this application on Tomcat I run the URL as
https://localhost:8443/DgSuite/login.html (My application URL)
It opens successfully ,but I am not able to login as it says cannot connect
I also changed the path in WSDL file from localhost:8080 to https://localhost:8443 and i am able to open the wsdl with new URL
But I am not able to further login.I am not getting any error in Tomcat logs or even in the debugger (for firefox).
Kindly help

Also Noticed that in the debugger it says it cannot connect to WSDL saying
"{\"success\": false, \"error\": \"Can not connect to controller at https://localhost:8443/dgcontroller/ControllerConnectorPort?wsdl exception: javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://localhost:8443/dgcontroller/ControllerConnectorPort?wsdl. It failed with: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.\"}"
Thanks
Namrata
8 years ago
issue regarding running SVN checkout from ANT script
hi,
I am trying to write a ANT script to take checkout from SVN.Here is how my script looks like
<?xml version="1.0"?>

<project name="blah" basedir="." default="checkout">

<property environment="env"/>

<path id="svnant.classpath">
<pathelement location="${env.ANT_HOME}/lib"/>
<fileset dir="${env.ANT_HOME}/lib/">
<include name="**/*.jar"/>
</fileset>
</path>

<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" />

<target name="checkout">
<svn username="testapp" password="Datag123" >
<checkout url="svn://<systenip>/svn/Enterprise_2011/trunk"; destPath="src_latest"/>
</svn>
</target>

</project>

where in I included the following jars in the ANT_HOME/lib folder.
commons-lang-2.0.jar ,jakarta-regexp-1.4.jar,javasvn.jar,svnant.jar,svnClientAdapter.jar,svnjavahl.jar,svnkit.jar.

But when i run the script it says Svn; Handshake failed.received:
Checkout failed.

replacing the svn: to svn+ssh gave the following error



C:\svnant-1.0.0\buildsvn.xml:17: java.lang.NoClassDefFoundError: com/trilead/ssh
2/InteractiveCallback
at org.tmatesoft.svn.core.internal.io.svn.SVNSSHConnector.open(SVNSSHCon
nector.java:88)
at org.tmatesoft.svn.core.internal.io.svn.SVNConnection.open(SVNConnecti
on.java:74)
at org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryImpl.openConnecti
on(SVNRepositoryImpl.java:1237)
at org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryImpl.getLatestRev
ision(SVNRepositoryImpl.java:168)
at org.tmatesoft.svn.core.wc.SVNBasicClient.getRevisionNumber(SVNBasicCl
ient.java:482)
at org.tmatesoft.svn.core.wc.SVNBasicClient.getLocations(SVNBasicClient.
java:851)
at org.tmatesoft.svn.core.wc.SVNBasicClient.createRepository(SVNBasicCli
ent.java:534)
at org.tmatesoft.svn.core.wc.SVNUpdateClient.doCheckout(SVNUpdateClient.
java:893)
at org.tmatesoft.svn.core.javahl.SVNClientImpl.checkout(SVNClientImpl.ja
va:1973)
at org.tmatesoft.svn.core.javahl.SVNClientImpl.checkout(SVNClientImpl.ja
va:1964)
at org.tigris.subversion.svnclientadapter.javahl.AbstractJhlClientAdapte
r.checkout(AbstractJhlClientAdapter.java:224)
at org.tigris.subversion.svnant.commands.Checkout.execute(Unknown Source
)
at org.tigris.subversion.svnant.commands.SvnCommand.executeCommand(Unkno
wn Source)
at org.tigris.subversion.svnant.SvnTask.execute(Unknown Source)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.ClassNotFoundException: com.trilead.ssh2.InteractiveCallbac
k
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 31 more


Its a kind of urgent issue.

Thanks
in advance

Shweta
8 years ago