0

Just puzzling me the Error shown on firebug console:

Uncaught TypeError: Object #<Object> has no method 'Sin'
Uncaught TypeError: Object #<Object> has no method 'Cos'

yet my code gives the value for Math.PI

I'm totaly confused, I can't figure out what i did wrong, any help is greatly appreciated.

My code:

function callCordinates(angle){
    console.log(Math.PI); // shows 3.14...
    console.log(Math.Cos(0)); // throws error. :(

    var x1 = 480 + 100 * Math.Cos(angle * (Math.PI / 180));
    var y1 = 155 + 100 * Math.Sin(angle * (Math.PI / 180));
}

not start tomcat with the option "Server modules without publishing"

I have a small problem when the server starts,it can not find the web.xml context file. (documentation watch)

Here is the exception :

    oct. 24, 2013 5:04:17 PM org.apache.catalina.core.AprLifecycleListener init
Infos: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Ruby200\bin;C:\Python33\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft Network Monitor 3\;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\SlikSvn\bin;C:\Program Files\Sublime Text 2\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\git\cmd;C:\Users\Vincent\AppData\Roaming\npm;C:\Program Files (x86)\Nmap;D:\32bit\eclipse_4.3.1;;.
oct. 24, 2013 5:04:17 PM org.apache.coyote.AbstractProtocol init
Infos: Initializing ProtocolHandler ["http-bio-8080"]
oct. 24, 2013 5:04:17 PM org.apache.coyote.AbstractProtocol init
Infos: Initializing ProtocolHandler ["ajp-bio-8009"]
oct. 24, 2013 5:04:17 PM org.apache.catalina.startup.Catalina load
Infos: Initialization processed in 346 ms
oct. 24, 2013 5:04:17 PM org.apache.catalina.core.StandardService startInternal
Infos: Démarrage du service Catalina
oct. 24, 2013 5:04:17 PM org.apache.catalina.core.StandardEngine startInternal
Infos: Starting Servlet Engine: Apache Tomcat/7.0.42
oct. 24, 2013 5:04:17 PM org.apache.catalina.startup.HostConfig deployDescriptor
Infos: Déploiement du descripteur de configuration C:\Users\Vincent\workspace-kepler-pi\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\arsinoe_eng.xml
oct. 24, 2013 5:04:17 PM org.apache.catalina.startup.SetContextPropertiesRule begin
Avertissement: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:arsinoe_eng' did not find a matching property.
oct. 24, 2013 5:04:17 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Avertissement: [SetPropertiesRule]{Context/Loader} Setting property 'useSystemClassLoaderAsParent' to 'false' did not find a matching property.
oct. 24, 2013 5:04:18 PM org.apache.catalina.core.ContainerBase addChildInternal
Grave: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/arsinoe_eng]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:656)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1635)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer
    at org.apache.catalina.startup.ContextConfig.getServletContainerInitializer(ContextConfig.java:1654)
    at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1562)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1270)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 10 more

oct. 24, 2013 5:04:18 PM org.apache.catalina.startup.HostConfig deployDescriptor
Grave: Erreur lors du déploiement du descripteur de configuration C:\Users\Vincent\workspace-kepler-pi\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\arsinoe_eng.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/arsinoe_eng]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:656)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1635)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

oct. 24, 2013 5:04:18 PM org.apache.coyote.AbstractProtocol start
Infos: Starting ProtocolHandler ["http-bio-8080"]
oct. 24, 2013 5:04:18 PM org.apache.coyote.AbstractProtocol start
Infos: Starting ProtocolHandler ["ajp-bio-8009"]
oct. 24, 2013 5:04:18 PM org.apache.catalina.startup.Catalina start
Infos: Server startup in 349 ms

Here the construction of my project :

\> arsinoe_eng - (project name)
\----> src
\----> build
\----> data (ressource)
\----> WebContent
\---->----> META-INF
\---->----> WEB-INF
\---->---->----> lib
\---->---->----> web.xml
\---->----> index.html

my web.xml

    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
    http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <servlet>
        <servlet-name>ServletAdaptor</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>
                com.imagina.aten.engine.webservicev2.WebserviceApplication</param-value>
        </init-param>
        <load-on-startup>100</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>ServletAdaptor</servlet-name>
        <url-pattern>/REST/*</url-pattern>
    </servlet-mapping>

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>REST</web-resource-name>
            <url-pattern>/REST/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>REST</role-name>
        </auth-constraint>
    </security-constraint>
    <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>JDE</realm-name>
    </login-config>
    <security-role>
        <description>Description</description>
        <role-name>REST</role-name>
    </security-role>

    <filter>
        <filter-name>SobekEncodingFilter</filter-name>
        <filter-class> com.imagina.sobek.engine.SobekEncodingFilter</filter-class>
    </filter>
    <filter>
        <filter-name>SobekExpireFilter</filter-name>
        <filter-class>com.imagina.sobek.engine.SobekExpireFilter</filter-class>
        <init-param>
            <param-name>expirationDelay</param-name>
            <param-value>1440</param-value>
        </init-param>
    </filter>
    <filter>
        <filter-name>AjaxAnywhere</filter-name>
        <filter-class>org.ajaxanywhere.AAFilter</filter-class>
    </filter>

    <servlet>
        <servlet-name>invoker</servlet-name>
        <servlet-class>com.imagina.sobek.engine.SobekEngine</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>AxisServlet</servlet-name>
        <servlet-class> org.apache.axis.transport.http.AxisServlet </servlet-class>
    </servlet>

    <servlet>
        <servlet-name>AdminServlet</servlet-name>
        <servlet-class> org.apache.axis.transport.http.AdminServlet </servlet-class>
        <load-on-startup>100</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>SOAPMonitorService</servlet-name>
        <servlet-class> org.apache.axis.monitor.SOAPMonitorService </servlet-class>
        <init-param>
            <param-name>SOAPMonitorPort</param-name>
            <param-value>5001</param-value>
        </init-param>
        <load-on-startup>100</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/axis/AxisServlet</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>*.jws</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>SOAPMonitorService</servlet-name>
        <url-pattern>/SOAPMonitor</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>

    <filter-mapping>
        <filter-name>SobekEncodingFilter</filter-name>
        <url-pattern>/servlet/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>AjaxAnywhere</filter-name>
        <url-pattern>/servlet/*</url-pattern>
    </filter-mapping>

    <!--<filter-mapping>
    <filter-name>SobekExpireFilter</filter-name>
    <url-pattern>*.js</url-pattern>
    </filter-mapping>-->
    <filter-mapping>
        <filter-name>SobekExpireFilter</filter-name>
        <url-pattern>*.gif</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SobekExpireFilter</filter-name>
        <url-pattern>*.jpg</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SobekExpireFilter</filter-name>
        <url-pattern>*.css</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SobekExpireFilter</filter-name>
        <servlet-name>invoker</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SobekExpireFilter</filter-name>
        <url-pattern>*.png</url-pattern>
    </filter-mapping>
    <mime-mapping>
        <extension>manifest</extension>
        <mime-type>text/cache-manifest</mime-type>
    </mime-mapping>


    <!-- log4j 2 conf (to remove if servlet version is upgraded to 3.0 or higher) -->
    <!--<listener>
        <listener-class>
            org.apache.logging.log4j.core.web.Log4jServletContextListener</listener-class>
    </listener>
    <filter>
        <filter-name>log4jServletFilter</filter-name>
        <filter-class>
            org.apache.logging.log4j.core.web.Log4jServletFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>log4jServletFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>-->
</web-app>

thank you in advance for your help.

4

3 回答 3

2

它的Math.sin,所以改变

Math.Sin(angle * (Math.PI / 180));

Math.sin(angle * (Math.PI / 180));

和它的Math.cos,所以改变:

Math.Cos

Math.cos
于 2013-10-22T09:07:06.130 回答
1

使用Math.sin代替 Math.Sin

同样 Math.cos代替 Math.Cos

于 2013-10-22T09:08:01.823 回答
1

按照惯例,常量都是大写的,而 JS 中的函数是小写的。 Math.PI是一个常数,因为是Math.E,所以它们是大写的,而,,,,和sin其他是函数,所以它们是小写的。costan

在这种情况下,Math.Sin应该是Math.sin而且Math.Cos应该是Math.cos

于 2013-10-22T09:08:41.537 回答