NBzhCNfaq20081027
NetBeans 有问必答活动 - 2008/10/27
- 1:【有问必答】请问怎样reset netbean新增Project时的预设号码?
请问要怎样reset那个default的号码啊? 现在都累积到24了, 有办法reset回1吗?
图见:http://bbs.chinaunix.net/viewthread.php?tid=1297226&extra=page%3D1
Michael: 两个办法,把项目生成的根目录换个新的,或者,把老项目删去,NetBeans就会重新计数。
- 2:【有问必答】netbeans web服务返回对象
在netbeans中选择建立java类如下:
package org.me.calculator;
import java.io.Serializable;
/**
-
- /
public class CustomerInfo implements Serializable{
private String customerName;
private int customerAge;
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public int getCustomerAge() {
return customerAge;
}
public void setCustomerAge(int customerAge) {
this.customerAge = customerAge;
}
public CustomerInfo(String customerName,int customerAge)
{
this.customerName=customerName;
\
this.customerAge=customerAge;
}
}
在netbeans中,选择从头开始建立web服务文件,CustomerService,代码如下:
/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
- /
package org.me.calculator;
import javax.jws.WebMethod;
import javax.jws.WebService;
/**
-
- /
@WebService()
public class CustomerService {
/**
* Web 服务操作
*/
@WebMethod(operationName = "GetCustomer")
public CustomerInfo GetCustomer() {
//TODO 在此处编写实现代码:
return new CustomerInfo("china",1);
}
}
生成可以通过,运行时候,输出框出现如下消息:
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
就地在 C:\CalculatorWSApplication\build\web 处部署
开始注册项目的服务器资源
已完成服务器资源注册
moduleID=CalculatorWSApplication
deployment started : 0%
正在域中部署应用程序 失败;部署错误 -- Exception occured in the wsgen process javax.xml.ws.WebServiceException: 无法创建 JAXBContext
部署错误:
尚未部署该模块。
有关详细信息,请参见服务器日志。
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: 尚未部署该模块。
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:160)
... 16 more
生成失败(总时间:6 秒)
请问为什么?
- 3:【有问必答】J2ME开发时的问题
代码如下:
// open an input stream to the file
FileInputStream fis = new FileInputStream("F:/wks/Certificate/client-cert.pem";
// instantiate a CertificateFactory for X.509 CertificateFactory cf = CertificateFactory.getInstance("X.509";
// extract the certification path from
// the PKCS7 SignedData structure
CertPath cp = cf.generateCertPath(fis, "KCS7";
异常如下:
IOException parsing PKCS7 data: sun.security.pkcs.ParsingException: ObjectIdenti
fier() -- data isn't an object ID (tag = 4
提前多谢各位。

