2017-02-10 105 views
0

Glassfish的4.0服務器爲錯誤。有關更多詳細信息,請參閱server.log。Glassfish4-錯誤嘗試部署下面的代碼時,而在Java部署代碼

代碼

import java.util.ArrayList; 

import java.util.List; 

import javax.jws.WebService; 

@WebService 

public class ProductCatalog 

{ 

    public List<String> getProductCategories() 

    { 
     List<String> l=new ArrayList<String>(); 
     l.add("Books"); 
     l.add("Music"); 
     l.add("Movies"); 
     return l; 
    } 
} 

服務器日誌:

2017-02-12T14:33:47.252-0500|Info: Running GlassFish Version: GlassFish Server Open Source Edition 4.1.1 (build 1) 
2017-02-12T14:33:47.260-0500|Info: Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter 
2017-02-12T14:33:47.589-0500|Info: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created. 
2017-02-12T14:33:47.593-0500|Info: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created. 
2017-02-12T14:33:47.599-0500|Info: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created. 
2017-02-12T14:33:48.153-0500|Info: Authorization Service has successfully initialized. 
2017-02-12T14:33:48.690-0500|Info: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry 
2017-02-12T14:33:49.160-0500|Warning: Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-1, realClassName=org.glassfish.grizzly.http2.Http2AddOn 
2017-02-12T14:33:49.343-0500|Info: Grizzly Framework 2.3.23 started in: 99ms - bound to [/0.0.0.0:8080] 
2017-02-12T14:33:49.427-0500|Warning: Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-2, realClassName=org.glassfish.grizzly.http2.Http2AddOn 
2017-02-12T14:33:49.443-0500|Info: Grizzly Framework 2.3.23 started in: 2ms - bound to [/0.0.0.0:8181] 
2017-02-12T14:33:49.455-0500|Warning: Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=admin-listener, realClassName=org.glassfish.grizzly.http2.Http2AddOn 
2017-02-12T14:33:49.469-0500|Info: Grizzly Framework 2.3.23 started in: 3ms - bound to [/0.0.0.0:4848] 
2017-02-12T14:33:49.555-0500|Info: Grizzly Framework 2.3.23 started in: 0ms - bound to [/0.0.0.0:3700] 
2017-02-12T14:33:49.557-0500|Info: GlassFish Server Open Source Edition 4.1.1 (1) startup time : Felix (32,719ms), startup services(2,755ms), total(35,474ms) 
2017-02-12T14:33:53.625-0500|Info: HV000001: Hibernate Validator 5.1.2.Final 
2017-02-12T14:33:55.102-0500|Info: JTS5014: Recoverable JTS instance, serverId = [100] 
2017-02-12T14:34:00.227-0500|Info: Grizzly Framework 2.3.23 started in: 6ms - bound to [/0.0.0.0:7676] 
2017-02-12T14:34:00.231-0500|Info: Registered com.su[email protected]1d25c1c as OSGi service registration: [email protected] 
2017-02-12T14:34:02.581-0500|Info: visiting unvisited references 
2017-02-12T14:34:03.207-0500|Info: Web service endpoint deployment events listener registered successfully. 
2017-02-12T14:34:03.533-0500|Info: Java security manager is disabled. 
2017-02-12T14:34:03.535-0500|Info: Entering Security Startup Service. 
2017-02-12T14:34:03.553-0500|Info: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper. 
2017-02-12T14:34:03.679-0500|Info: Security Service(s) started successfully. 
2017-02-12T14:34:04.249-0500|Info: Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080 
2017-02-12T14:34:04.261-0500|Info: Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181 
2017-02-12T14:34:04.266-0500|Info: Created HTTP listener admin-listener on host/port 0.0.0.0:4848 
2017-02-12T14:34:04.317-0500|Info: Created virtual server server 
2017-02-12T14:34:04.320-0500|Info: Created virtual server __asadmin 
2017-02-12T14:34:04.795-0500|Info: Setting JAAS app name glassfish-web 
2017-02-12T14:34:04.796-0500|Info: Virtual server server loaded default web module 
2017-02-12T14:34:10.237-0500|Info: JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://192.168.1.7:8686/jndi/rmi://192.168.1.7:8686/jmxrmi 
2017-02-12T14:34:15.253-0500|Info: visiting unvisited references 
2017-02-12T14:34:15.334-0500|Severe: WS00029: The javax.jws.WebService annotation targetNamespace must be used for classes or interfaces that are in no package. 
2017-02-12T14:34:15.338-0500|Severe: Annotations processing failed for file:/Users/rohitaila/Downloads/glassfish4/glassfish/domains/domain1/eclipseApps/Testmart1/ 
2017-02-12T14:34:15.342-0500|Info: visiting unvisited references 
2017-02-12T14:34:35.580-0500|Info: Webservice Endpoint deployed ProductCatalog 
listening at address at http://Rohits-MacBook-Pro.local:8080/Testmart1/ProductCatalogService. 
2017-02-12T14:34:35.583-0500|Severe: Exception while invoking class org.glassfish.webservices.WebServicesDeployer prepare method 
2017-02-12T14:34:35.585-0500|Severe: java.lang.RuntimeException 
    at org.glassfish.webservices.WebServicesDeployer.prepare(WebServicesDeployer.java:185) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) 
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at javax.security.auth.Subject.doAs(Subject.java:360) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at javax.security.auth.Subject.doAs(Subject.java:360) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722) 
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534) 
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224) 
    at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) 
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206) 
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180) 
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) 
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111) 
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536) 
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) 
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591) 
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.NullPointerException 
    at org.glassfish.webservices.deployment.DeployedEndpointData.<init>(DeployedEndpointData.java:118) 
    at org.glassfish.webservices.deployment.WebServicesDeploymentMBean.deploy(WebServicesDeploymentMBean.java:272) 
    at org.glassfish.webservices.deployment.WebServicesDeploymentMBean.deploy(WebServicesDeploymentMBean.java:301) 
    at org.glassfish.webservices.WebServicesDeployer.prepare(WebServicesDeployer.java:182) 
    ... 40 more 
2017-02-12T14:34:35.587-0500|Severe: Exception while preparing the app 
2017-02-12T14:34:35.588-0500|Severe: Exception during lifecycle processing 
java.lang.RuntimeException 
    at org.glassfish.webservices.WebServicesDeployer.prepare(WebServicesDeployer.java:185) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) 
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at javax.security.auth.Subject.doAs(Subject.java:360) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at javax.security.auth.Subject.doAs(Subject.java:360) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722) 
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534) 
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224) 
    at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) 
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206) 
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180) 
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) 
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111) 
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536) 
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) 
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591) 
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.NullPointerException 
    at org.glassfish.webservices.deployment.DeployedEndpointData.<init>(DeployedEndpointData.java:118) 
    at org.glassfish.webservices.deployment.WebServicesDeploymentMBean.deploy(WebServicesDeploymentMBean.java:272) 
    at org.glassfish.webservices.deployment.WebServicesDeploymentMBean.deploy(WebServicesDeploymentMBean.java:301) 
    at org.glassfish.webservices.WebServicesDeployer.prepare(WebServicesDeployer.java:182) 
    ... 40 more 
+0

server.log是什麼意思? – Mike

+0

更新了服務器日誌(前幾行)。 Glassfish每次在eclipse上運行任何東西都會失敗,我無法弄清楚什麼地方出了問題。我嘗試了多次重新啓動服務器,並刪除並重新安裝。但它沒有奏效。 – Ronnie

回答

0

仔細查看這個異常的日誌文件:

2017-02-12T14:34:15.334 -0500 |嚴重:WS00029:javax.jws.WebService 註釋targetNamespace必須用於clas ses或接口 沒有包。

根據這一點,你需要創建一個包,幷包括在IT服務ProductCatalog@WebService註釋指定targetNamespace。 查看更多的documentation