JWSDP Tutorial - Servlet Example
I am trying to run the bookstore example in the Servlet section of the JWSDP on Red Hat 7.3.I am also getting confused over ANT and the Tomcat Manager.
I need to build the bookstore example and the instructions read: (for those who know the tutorial)
1. In a terminal window, go to /docs/tutorial/examples/web/bookstore1
2. Run ant build - The build target will spawn any necessary compilations and copy files to the docs/tutorial/examples/web/bookstore1/build directory.
3. Make sure Tomcat is started.
4. Run ant install - The install target notifies Tomcat that the new context is available.
5. Start the Pointbase database server and populate the database if you have not done so already
6. Open the bookstore URL http://localhost:8080/bookstore1/enter
On the command line I can run ANT BUILD fine, but ANT INSTALL fails. (It also fails in Tomcat Manager...but not sure whether I can use this instead of ANT INSTALL?)
I know this is sketchy but does anyone have any idea?
Regards
Scott
Hi Scott,
Thank you any way.
Last time, I met it and carried the tutorial on by compiling and copying manually. Then, I came back to set the ant.jar into path&classpath, and it worked.(ant build)
Today, I'm trying on "hello1" example, but can't get though.
Maybe it's still classpath and path issue, as I can't compile two servlet classes by javac from command line, but from Forte, it passed.
Cheers!
Zhan
Similar Messages
-
Run JWSDP tutorial JAXR example problem
Dear all:
I'm running examples from JWSDP 2.0 tutorial
I use sjsas-9_1
my location is jwstutorial20/examples/jaxr/simple
my registry server is http://localhost:8080/RegistryServer as default
asant run-publish
I got following errors:
javaee-home-test:
init:
prepare:
build:
run-publish:
[java] Created connection to registry
[java] Got registry service, query manager, and life cycle manager
[java] Sep 30, 2007 1:39:56 PM com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection post
[java] SEVERE: SAAJ0008: Bad Response; Not Found
[java] javax.xml.registry.JAXRException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
[java] at com.sun.xml.registry.uddi.RegistryServiceImpl.jaxmSend(Unknown Source)
[java] at com.sun.xml.registry.uddi.RegistryServiceImpl.send(Unknown Source)
[java] at com.sun.xml.registry.uddi.Processor.processRequestJAXB(Unknown Source)
[java] at com.sun.xml.registry.uddi.UDDIMapper.getAuthorizationToken(Unknown Source)
[java] at com.sun.xml.registry.uddi.ConnectionImpl.setCredentials(Unknown Source)
[java] at JAXRPublish.executePublish(Unknown Source)
[java] at JAXRPublish.main(Unknown Source)
[java] Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
[java] at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:146)
[java] ... 7 more
[java] Caused by: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:140)
[java] ... 7 more
[java] Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
[java] at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:323)
[java] at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:169)
[java] ... 9 more
BUILD SUCCESSFUL
can anyone help?
thanksHi Scott,
Thank you any way.
Last time, I met it and carried the tutorial on by compiling and copying manually. Then, I came back to set the ant.jar into path&classpath, and it worked.(ant build)
Today, I'm trying on "hello1" example, but can't get though.
Maybe it's still classpath and path issue, as I can't compile two servlet classes by javac from command line, but from Forte, it passed.
Cheers!
Zhan -
J2EE tutorial (June 17 '04) servlet example compilation error
This is a copy of my previous post on the same topic, but this one has a more self-desriptive subject line. Apologies for duplication.
I am trying the first servlet example in the J2EE tutorial, June 17, 2004, pgs 443 - 448. I have completed all the steps as described. However, the URL results in the following error. I would like to point out that I am using the URL http://localhost:8081/bookstore1/bookstore (instead of port 8080 because the admin console suggests that port 8081 is an available http port):
Assistance would be appreciated.
HTTP Status 404 - /bookstore1/bookstore
type Status report
message /bookstore1/bookstore
description The requested resource (/bookstore1/bookstore) is not available.
Sun-Java-System/Application-Server-PE-8.0
I looked at the logviewer and there are 3 severe errors in the log:
1. Application Server
Log Entry Detail
Details
Timestamp: Aug 6, 2004 14:36:28.375
Log Level: SEVERE
Logger: javax.enterprise.system.container.web
Name-Value Pairs:
_ThreadID=12;
Record Number: 754
Message ID: WebModule[bookstore1]Exception sending context initialized event to listener instance of class listeners.ContextListener java.lang.NoClassDefFoundError
Complete Message
exception/OrderException
at listeners.ContextListener.contextInitialized(Unknown Source)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3679)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4140)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:873)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:171)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:855)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:623)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:947)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:729)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:147)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:224)
at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:488)
at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:475)
at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:302)
at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:107)
at com.sun.enterprise.admin.server.core.mbean.config.ManagedServerInstance.multicastEvent(ManagedServerInstance.java:3880)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.server.core.jmx.Introspector.invokeMethodOn(Introspector.java:181)
at com.sun.enterprise.admin.server.core.mbean.config.AdminBase.invoke(AdminBase.java:86)
at com.sun.enterprise.admin.server.core.mbean.config.ConfigMBeanBase.invoke(ConfigMBeanBase.java:680)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:221)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:228)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:823)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)
at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:282)
at com.sun.enterprise.deployment.phasing.DeploymentService.multicastEvent(DeploymentService.java:341)
at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:284)
at com.sun.enterprise.deployment.phasing.StartPhase.runPhase(StartPhase.java:115)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:74)
at com.sun.enterprise.deployment.phasing.DeploymentService.executePhases(DeploymentService.java:233)
at com.sun.enterprise.deployment.phasing.DeploymentService.deploy(DeploymentService.java:150)
at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:275)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:287)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:280)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:221)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:228)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:823)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)
at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:282)
at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:38)
at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:92)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:69)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:768)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:311)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:205)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:102)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:192)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:261)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:583)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:200)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:180)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:582)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:254)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:161)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:979)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:692)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:647)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:691)
at java.lang.Thread.run(Thread.java:534)
2. Application Server
Log Entry Detail
Details
Timestamp: Aug 6, 2004 14:36:28.375
Log Level: SEVERE
Logger: tomcat.server./bookstore1.Context
Name-Value Pairs:
_ThreadID=12;
Record Number: 755
Message ID:
Complete Message
Error listenerStart
3. Application Server
Log Entry Detail
Details
Timestamp: Aug 6, 2004 14:36:28.375
Log Level: SEVERE
Logger: tomcat.server./bookstore1.Context
Name-Value Pairs:
_ThreadID=12;
Record Number: 756
Message ID:
Complete Message
Context startup failed due to previous errorsI had the same problem. It was caused by not including \j2eetutorial14\examples\web\bookstore\dist\bookstore.jar in the bookstore1.war. You may need to build the bookstore.jar file first if you haven�t already.
-
JWSDP Tutorial Problem - please help!
Hi!
I'm new to the Java Technology so I'm going through the JWSDP Tutorial provided by Sun. I have followed all of the steps set out in the 3rd chapter, however, when I enter this URL http://localhost:8080/gs, to run the example application I get the following error message:
HTTP Status 404 - /gs
type Status report
message /gs
description The requested resource (/gs) is not available.
Java Web Services Developer Pack/1.2
Does anyone know what this means? I will be very grateful for any kind of help.
Thanks.Apologies for the lack of detail.
I have installed the Java Development Kit (j2sdk1.4.2), the Java
WSDP (jwsdp-1.2) and the tutorial (jwsdp-1_2-tutorial) on my C:\ drive.
The following have been set as the PATH variable:
- C:\jwsdp-1.2\jwsdp-shared\bin
- C:\jwsdp-1.2\apache-ant\bin
- C:\j2sdk1.4.2\bin
The tutorial states that the build.properties file
(<INSTALL>\jwstutorial12\examples\common\build.properties) needs to be
modified so I have made the following changes:
tutorial.home=C:\jwsdp-1_2-tutorial
tutorial.install=${tutorial.home}/jwstutorial12
username=<username>
password=<password>
host=localhost
port=8080
secure.port=8443
url=http://${host}:${port}/manager
- The tutorial.home variable has been set to the path to the directory
into which the tutorial was installed
- The username and password variables have been set to what was
specified upon installing the JWSDP
1. I have changed to the root directory, C:\jwsdp-1_2-
tutorial\jwstutorial12\examples\gs. I have compiled the source files
by typing the following at the terminal prompt:
ant build
The following message is echoed to the screen:
Buildfile: build.xml
init:
prepare:
[mkdir] Created dir:
INSTALL>/jwstutorial12/examples/gs/build
[mkdir] Created dir:
<INSTALL>/jwstutorial12/examples/gs/build/WEB-INF
[mkdir] Created dir:
<INSTALL>/jwstutorial12/examples/gs/build
/WEB-INF/classes
[mkdir] Created dir:
<INSTALL>/jwstutorial12/examples/gs/build/WEB-INF/lib
[mkdir] Created dir:
<INSTALL>/jwstutorial12/examples/gs/build/WEB-INF/tags
copy:
[copy] Copying 1 file to
<INSTALL>/jwstutorial12/examples/gs/build
[copy] Copying 1 file to
<INSTALL>/jwstutorial12/examples/gs/build/WEB-INF
build:
[javac] Compiling 1 source file to
<INSTALL>/jwstutorial12/examples/gs/build/WEB-INF/classes
BUILD SUCCESSFUL
2. I have started Tomcat.
3. I have installed the Web application on Tomcat using Ant by typing
the following at the terminal prompt:
ant install
The following message is echoed to the screen:
[install] OK - Installed application at context path /gs
4. I have started a Web browser and entered the following URL to run
the example application:
http://localhost:8080/gs
It is at this point I get the error. I have read through the
instructions several times to ensure I have not missed anything. It is
not specified that the tutorial should be installed in a particular
directory, but I was wondering if it should be. -
Am getting the following error while running the servlet example
Hi,
am getting the following error while running the servlet example
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
edu.dao.StudentDao.insertStudent(StudentDao.java:18)
edu.servlet.StudentServlet.doGet(StudentServlet.java:25)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.
Thanks
//sreekanthHi,
the following code i have written in StudentDao
package edu.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.apache.commons.dbutils.DbUtils;
import edu.model.Student;
import edu.util.DBUtil;
public class StudentDao {
public void insertStudent(Student student) {
String stuQuery = "INSERT INTO STUDENT VALUES(?,?)";
Connection connection = DBUtil.getConnection();
PreparedStatement preparedStatement = null;
try {
preparedStatement = connection.prepareStatement(stuQuery);
preparedStatement.setString(1,student.getStudentNo());
preparedStatement.setString(2, student.getStudentName());
preparedStatement.executeUpdate();
} catch(SQLException e){
System.out.println("..Sql exception......");
}finally {
DbUtils.closeQuietly(connection,preparedStatement,null);
} -
Problems with the jax-rpc testcase from the JWSDP tutorial
Hello.
I have e few problems with the hello case from the JWSDP tutorial.
Everything works fine during the build/compile/installation phase but when I'm accessing the url http://localhost:8080/jaxrpc-hello/jaxrpc, the server wont find the service and I get:
404 The requested resource (/jaxrpc-hello/jaxrpc) is not available.
I've trippel checked the environment settings and other properties and I don't know where to go to error check.
I've tried to install the client as well but it wont detect the service so I guess there is a problem on the server side.
I'm quite new to the whole "Web Service thing" So I would be happy to get som help.
Chrisif you run the tomcat manager application at http://localhost:8080/manager/list, what do you see? I suppose if you have successfully run the ant "install" task after "compile-server" and "xrpcc-server", you will see that your service is registered with its context path, but is not "running". This will be probably because of a runtime error. For further diagnosis of errors like these, I recommend to take a look at the log file at "<%JWSDP_HOME%>/logs/catalina.out".
If you are satisfied with this answer, please be so kind and assign some of your duke dollars to me ;-) -
SIMPLEST servlet example please
Hi,
I was wondering if someone could post a java servlet example that accepts a string array (let's say we pass "A" and "B") and returns back a string array (let's say "1" and "2") without having to use a doGet or doPost. This would simply be passed as a value as one normally might, using a procedure or function.
Help on this is greatly appreciated. I am using this to access DB information, and already have the rest of the code finished, however I must implement this as a servlet.
Thanks...Hello lafnjack,
A servlet is a kind of plugin-class that is connected to a HTTP-server to handle HTTP requests by interpreting the request itself and generating the response.
Therefore, a servlet is called through methods that are in parallel to the HTTP requests GET, POST and in some cases the other variants. Having said this, it should be obvious that a servlet has no more options for functioning than implementing doGet/doPost etc functions.
Silvio Bierman -
Need one to many toplink+Jdeveloper tutorial with example
Hi
I need tutorial with example of one to many with Toplink+J developer
Thanks
Edited by: user11802935 on Aug 18, 2009 1:06 PMHi,
The following links should get you started.
EclipseLink JPA + Eclipse
http://wiki.eclipse.org/EclipseLink/Examples/JPA
JDeveloper tutorials
http://www.oracle.com/technology/products/jdev/index.html
TopLink + JDeveloper tutorial
http://www.oracle.com/technology/obe/obe11jdev/bulldog/ejb_jpa_jsf/ejb.html
@OneToMany documentation
http://wiki.eclipse.org/Introduction_to_EclipseLink_JPA_%28ELUG%29#.40OneToMany
thank you
/michael
www.eclipselink.org -
Searching for simple bluetooth to bluetooth messages tutorial or example
Hi,
I want to send messages from 1 mobile phone to another one using Bluetooth but I can't find any simple tutorial or example with this type of bluetooth use.
So i'm asking for your help :) any simple tutorial/example for bluetooth messages between devices?
Thanks in advanceimport java.util.Vector;
import java.io.IOException;
import javax.microedition.io.Connector;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Choice;
import javax.bluetooth.LocalDevice;
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.DataElement;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.UUID;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.ServiceRecord;
import javax.bluetooth.L2CAPConnectionNotifier;
import javax.bluetooth.L2CAPConnection;
import javax.bluetooth.BluetoothStateException;
import javax.bluetooth.BluetoothConnectionException;
import javax.bluetooth.ServiceRegistrationException;
public class ChatController extends MIDlet implements CommandListener
private Display display = null;
private Form mainForm = null;
private ChoiceGroup devices = null;
private TextField inTxt = null;
private TextField outTxt = null;
private Command exit = null;
private Command start = null;
private Command connect = null;
private Command send = null;
private Command select = null;
private StringItem status = null;
private LocalDevice local = null;
private RemoteDevice rDevices[];
private ServiceRecord service = null;
private DiscoveryAgent agent = null;
private L2CAPConnectionNotifier notifier;
private L2CAPConnection connection = null;
private static final String UUID_STRING = "112233445566778899AABBCCDDEEFF";
private boolean running = false;
public ChatController()
super();
display = Display.getDisplay(this);
mainForm = new Form("CHAT");
devices = new ChoiceGroup(null,Choice.EXCLUSIVE);
inTxt = new TextField("incoming msg:","",256,TextField.ANY);
outTxt = new TextField("outgoing msg:","",256,TextField.ANY);
exit = new Command("EXIT",Command.EXIT,1);
start = new Command("START",Command.SCREEN,2);
connect = new Command("CONNECT",Command.SCREEN,2);
send = new Command("SEND",Command.SCREEN,2);
select = new Command("SELECT",Command.SCREEN,2);
status = new StringItem("status : ",null);
mainForm.append(status);
mainForm.addCommand(exit);
mainForm.setCommandListener(this);
protected void startApp() throws MIDletStateChangeException
running = true;
mainForm.addCommand(start);
mainForm.addCommand(connect);
display.setCurrent(mainForm);
try
local = LocalDevice.getLocalDevice();
agent = local.getDiscoveryAgent();
catch(BluetoothStateException bse)
status.setText("BluetoothStateException unable to start:"+bse.getMessage());
try
Thread.sleep(1000);
catch(InterruptedException ie)
notifyDestroyed();
protected void pauseApp()
running = false;
releaseResources();
protected void destroyApp(boolean uncond) throws MIDletStateChangeException
running = false;
releaseResources();
public void commandAction(Command cmd,Displayable disp)
if(cmd==exit)
running = false;
releaseResources();
notifyDestroyed();
else if(cmd==start)
new Thread()
public void run()
startServer();
}.start();
else if(cmd==connect)
status.setText("searching for devices...");
mainForm.removeCommand(connect);
mainForm.removeCommand(start);
mainForm.append(devices);
DeviceDiscoverer discoverer = new DeviceDiscoverer(ChatController.this);
try
agent.startInquiry(DiscoveryAgent.GIAC,discoverer);
catch(IllegalArgumentException iae)
status.setText("BluetoothStateException :"+iae.getMessage());
catch(NullPointerException npe)
status.setText("BluetoothStateException :"+npe.getMessage());
catch(BluetoothStateException bse1)
status.setText("BluetoothStateException :"+bse1.getMessage());
else if(cmd==select)
status.setText("searching devices for service...");
int index = devices.getSelectedIndex();
mainForm.delete(mainForm.size()-1);//deletes choiceGroup
mainForm.removeCommand(select);
ServiceDiscoverer serviceDListener = new ServiceDiscoverer(ChatController.this);
int attrSet[] = {0x0100}; //returns service name attribute
UUID[] uuidSet = {new UUID(UUID_STRING,false)};
try
agent.searchServices(attrSet,uuidSet,rDevices[index],serviceDListener);
catch(IllegalArgumentException iae1)
status.setText("BluetoothStateException :"+iae1.getMessage());
catch(NullPointerException npe1)
status.setText("BluetoothStateException :"+npe1.getMessage());
catch(BluetoothStateException bse11)
status.setText("BluetoothStateException :"+bse11.getMessage());
else if(cmd==send)
new Thread()
public void run()
sendMessage();
}.start();
//this method is called from DeviceDiscoverer when device inquiry finishes
public void deviceInquiryFinished(RemoteDevice[] rDevices,String message)
this.rDevices = rDevices;
String deviceNames[] = new String[rDevices.length];
for(int k=0;k<rDevices.length;k++)
try
deviceNames[k] = rDevices[k].getFriendlyName(false);
catch(IOException ioe)
status.setText("IOException :"+ioe.getMessage());
for(int l=0;l<deviceNames.length;l++)
devices.append(deviceNames[l],null);
mainForm.addCommand(select);
status.setText(message);
//called by ServiceDiscoverer when service search gets completed
public void serviceSearchFinished(ServiceRecord service,String message)
String url = "";
this.service = service;
status.setText(message);
try
url = service.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,false);
catch (IllegalArgumentException iae1)
try
connection = (L2CAPConnection)Connector.open(url);
status.setText("connected...");
new Thread()
public void run()
startReciever();
}.start();
catch(IOException ioe1)
status.setText("IOException :"+ioe1.getMessage());
// this method starts L2CAPConnection chat server from server mode
public void startServer()
status.setText("server starting...");
mainForm.removeCommand(connect);
mainForm.removeCommand(start);
try
local.setDiscoverable(DiscoveryAgent.GIAC);
notifier = (L2CAPConnectionNotifier)Connector.open("btl2cap://localhost:"+UUID_STRING+";name=L2CAPChat");
ServiceRecord record = local.getRecord(notifier);
String conURL = record.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,false);
status.setText("server running...");
connection = notifier.acceptAndOpen();
new Thread()
public void run()
startReciever();
}.start();
catch(IOException ioe3)
status.setText("IOException :"+ioe3.getMessage());
//starts a message reciever listening for incomming message
public void startReciever()
mainForm.addCommand(send);
mainForm.append(inTxt);
mainForm.append(outTxt);
while(running)
try
if(connection.ready())
int receiveMTU = connection.getReceiveMTU();
byte[] data = new byte[receiveMTU];
int length = connection.receive(data);
String message = new String(data,0,length);
inTxt.setString(message);
catch(IOException ioe4)
status.setText("IOException :"+ioe4.getMessage());
//sends a message over L2CAP
public void sendMessage()
try
String message = outTxt.getString();
byte[] data = message.getBytes();
int transmitMTU = connection.getTransmitMTU();
if(data.length <= transmitMTU)
connection.send(data);
else
status.setText("message ....");
catch (IOException ioe5)
status.setText("IOException :"+ioe5.getMessage());
//closes L2CAP connection
public void releaseResources()
try
if(connection != null)
connection.close();
if(notifier != null)
notifier.close();
catch(IOException ioe6)
status.setText("IOException :"+ioe6.getMessage());
import java.util.Vector;
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.ServiceRecord;
public class DeviceDiscoverer implements DiscoveryListener
private ChatController controller = null;
private Vector devices = null;
private RemoteDevice[] rDevices = null;
public DeviceDiscoverer(ChatController controller)
super();
this.controller = controller;
devices = new Vector();
public void deviceDiscovered(RemoteDevice remote,DeviceClass dClass)
devices.addElement(remote);
public void inquiryCompleted(int descType)
String message = "";
switch(descType)
case DiscoveryListener.INQUIRY_COMPLETED:
message = "INQUIRY_COMPLETED";
break;
case DiscoveryListener.INQUIRY_TERMINATED:
message = "INQUIRY_TERMINATED";
break;
case DiscoveryListener.INQUIRY_ERROR:
message = "INQUIRY_ERROR";
break;
rDevices = new RemoteDevice[devices.size()];
for(int i=0;i<devices.size();i++)
rDevices[i] = (RemoteDevice)devices.elementAt(i);
controller.deviceInquiryFinished(rDevices,message);//call of a method from ChatController class
devices.removeAllElements();
controller = null;
devices = null;
public void servicesDiscovered(int transId,ServiceRecord[] services)
public void serviceSearchCompleted(int transId,int respCode)
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.DataElement;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.ServiceRecord;
public class ServiceDiscoverer implements DiscoveryListener
private static final String SERVICE_NAME = "L2CAPChat";
private ChatController controller = null;
private ServiceRecord service = null;
public ServiceDiscoverer(ChatController controller)
super();
this.controller = controller;
public void deviceDiscovered(RemoteDevice remote,DeviceClass dClass)
public void inquiryCompleted(int descType)
public void servicesDiscovered(int transId,ServiceRecord[] services)
for(int j=0;j<services.length;j++)
DataElement dataElementName = services[j].getAttributeValue(0x0100);
String serviceName = (String)dataElementName.getValue();
if(serviceName.equals(SERVICE_NAME))
service = services[j];
break;
public void serviceSearchCompleted(int transId,int respCode)
String message = "";
switch(respCode)
case DiscoveryListener.SERVICE_SEARCH_COMPLETED:
message = "SERVICE_SEARCH_COMPLETED";
break;
case DiscoveryListener.SERVICE_SEARCH_ERROR:
message = "SERVICE_SEARCH_ERROR";
break;
case DiscoveryListener.SERVICE_SEARCH_TERMINATED:
message = "SERVICE_SEARCH_TERMINATED";
break;
case DiscoveryListener.SERVICE_SEARCH_NO_RECORDS:
message = "SERVICE_SEARCH_NO_RECORDS";
break;
case DiscoveryListener.SERVICE_SEARCH_DEVICE_NOT_REACHABLE:
message = "SERVICE_SEARCH_DEVICE_NOT_REACHABLE";
break;
controller.serviceSearchFinished(service,message);//calling a method from ChatController class
controller = null;
service = null;
} -
Compiled Tomcat Servlet Example & got JAR, not WAR?
Is there a basic reference on how to create a simple servlet with NetBeans 4.1 and deploy it to Tomcat?
When I created the project I chose Samples->Web->Tomcat Servlet Example, and yet it does not create a WAR file on compilation.
And of course once I'm past that I have to figure out how to edit the XML file, I gather.
I need a reference that will hold me by the hand and walk me through it once to kick start me.
After that I think I can make it without having to ask such newbie questions.Hi,
not sure to what extent you are clear in build.xml file (done thru ant).
what i can tell you is, ant creates any archive file (be it .jar, .war, .ear) with the tasks named "jar" (<jar jarfile="yourfilename.jar"..>), "war" and "ear". But both war and ear are the extensions of the jar only.
You can achieve creation of any archive file with the jar task itself.
you need to take care of the following...
(1) you can /should edit the extension of the files at every stage.. first .jar and then .war and then .ear (if necessary) => basic flow
(2) at every step, you have to have a file inclusion inside the corresponding archive file..
say for example, for a .jar file you should include all the compiled .class files, and ejb-jar.xml (incase you use ejbs) and other built-in jar files....
In case of .war files (web archive) you should include the web.xml file, any static files (html, jsp etc), any tld files - it goes with your application's nature and requirement.....
fyi, i m including a sample build.xml file which i use for a webapplication, so it deals with war...
<?xml version="1.0" encoding="UTF-8"?>
<project name="ServletsReqDispFwd" default="deploy">
<property name="top" value="."/>
<property name="webinf" value="${top}/WEB-INF"/>
<property name="lib" value="${webinf}/lib"></property>
<property name="classes" value="WEB-INF/classes"/>
<property name="jboss.dir" value="D:\jboss-3.2.2RC3\server\default\deploy"></property>
<property name="tomcat.dir" value="D:\jakarta-tomcat-4.1.27\webapps"></property>
<property name="warfile" value="ServletsReqDispFwd.war"></property>
<property name="src" value="${top}/src"/>
<property name="web.xml" value="WEB-INF/web.xml"/>
<target name="package">
<javac srcdir="${src}" destdir="${classes}"
listfiles="true" debug="true" verbose="true"
classpath="${lib}/*.jar"/>
<war warfile="${warfile}" webxml="${web.xml}">
<webinf dir="${top}">
<include name="**/*web*.xml"/>
<include name="**/*application*.xml"/>
<exclude name="src/**/*.xml"/>
</webinf>
<lib dir="${lib}">
<include name="*.jar"/>
</lib>
<fileset dir="." includes="**/*.html"/>
<classes dir="${classes}" includes="**/*.class"></classes>
</war>
</target>
<target name="deploy" depends="clean,package">
<copy file="${warfile}" todir="${tomcat.dir}" overwrite="true"></copy>
</target>
<target name="clean">
<delete dir="${classes}">
<filename name="*.class"/>
</delete>
<delete>
<fileset dir="${top}" includes="${warfile}"/>
</delete>
<delete>
<fileset dir="${tomcat.dir}" includes="${warfile}"/>
</delete>
</target>
</project>hope this contribues to a certain extent to help you edit the buildfile (xml file as you go) to meet your requirement..... -
I am looking for the old JWSDP tutorial 1.3 in the .pdf format.
It seems to be no more available on the web ( I have found only the new tutorial 1.4 and the online .html version).
Could anybody help me finding a downloadable version of the old tutorial ?
Thanks!
G.goto
http://java.sun.com/webservices/downloads/webservicespack.html
U will find a link in this page
Java WebServices Tutorial, v1.4
Download
Incase you are looking for the old PDF only then
http://java.sun.com/webservices/downloads/1.3/index.html -
Trouble compiling servlet example
Hi All, I am trying out an example for servlets and I ran into trouble compiling the the file called "FormProcessingServlet.java" in tutorial located here: http://developer.java.sun.com/developer/onlineTraining/Servlets/Fundamentals/magercises/FormPostingAndProcessing/index.html
The exact problem happens in this line:
isStructure = context.getResourceAsStream(paramStructureFile[0]);
The error says:
FormProcessingServlet.java:127: cannot resolve symbol
symbol : method getResourceAsStream (java.lang.String)
location: interface javax.servlet.ServletContext
isStructure = context.getResourceAsStream(paramStructureFile[0]);
anyone else ran into this problem? How do I fix this? Thanks."cannot resolve symbol" means that the JVM can't find a particular class.
Adjust your systems classpath variable to include all the jar files that you use, I also add "." to include files in the current directory I'm working from. -
Request for abap objects tutorial with examples
hi,
i am new to <b>abap objects</b>,
please send me a good tutorial for <b>abap objects</b> which contain good explanation with
good examples.
please send the tutorials to
<b>[email protected]</b>
thanks®ards
vamsi nHello,
<b>General Tutorial for OOPS</b>
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
<b>Have a look at these links for OO ABAP.</b>
http://www.sapgenie.com/abap/OO/
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
<b>SDN Series:</b>
https://www.sdn.sap.com/irj/sdn/developerareas/abap?rid=/webcontent/uuid/35eaef9c-0b01-0010-dd8b-e3b0f9ed7ccb [original link is broken]
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
<b>Basic concepts of OOPS</b>
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1591ec90-0201-0010-3ba8-cdcd500b17cf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
http://www.henrikfrank.dk/abapuk.html
http://www.erpgenie.com/abap/OO/
Regards,
Beejal
**Reward if this helps -
Searching OWB-Tutorial with Example to each component
Hi,
i search a tutorial with a typical example to each component of OWB 11g. I have found this two links which was good for the beginning and an overview, but anyone know a better tutorial if possible in german language (that would be the best for me) - but of course english is possible too.
Oracle® Database 2 Day + Data Warehousing Guide;
http://download.oracle.com/docs/cd/E11882_01/server.112/e10578/toc.htm
Oracle® Database 2 Day + Data Warehousing Guide;
http://apex.oracle.com/pls/apex/f?p=44785:24:1778744827384310::NO:24:P24_CONTENT_ID,P24_PREV_PAGE:5248,29
I look forward for your replies :)This OBE has some useful illustrations;
http://apex.oracle.com/pls/apex/f?p=44785:24:1753420051941801:::24:P24_CONTENT_ID,P24_PREV_PAGE:4262,24
I created the following blog to show the results of the debugger for some operations which is an alternative view - doesn't show how to setup though...
https://blogs.oracle.com/warehousebuilder/entry/owb_11gr2_debugging
Cheers
David -
JavaEE5 tutorial ejb example not working!
I have downloaded latest javaee5 tutorial example and i downloaded latest netbeans 6.9 and tried to run ejb cart example but i am getting
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.lang.NoClassDefFoundError: cart/util/BookException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.glassfish.appclient.client.acc.FacadeLaunchable.getMainClass(FacadeLaunchable.java:256)
at org.glassfish.appclient.client.acc.AppClientContainer.setClient(AppClientContainer.java:317)
at org.glassfish.appclient.client.acc.AppClientContainerBuilder.createContainer(AppClientContainerBuilder.java:174)
at org.glassfish.appclient.client.acc.AppClientContainerBuilder.newContainer(AppClientContainerBuilder.java:161)
at org.glassfish.appclient.client.AppClientFacade.createContainerForAppClientArchiveOrDir(AppClientFacade.java:458)
at org.glassfish.appclient.client.AppClientFacade.createContainer(AppClientFacade.java:420)
at org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:256)
at org.glassfish.appclient.client.acc.agent.AppClientContainerAgent.premain(AppClientContainerAgent.java:75)
FATAL ERROR in native method: processing of -javaagent failed
... 6 more
Caused by: java.lang.ClassNotFoundException: cart.util.BookException
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 org.glassfish.appclient.client.acc.ACCClassLoader.findClass(ACCClassLoader.java:211)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 16 more
Exception in thread "main" Java Result: 1
please help
Edited by: vinaysb on Sep 1, 2010 3:29 AMthere is not much help to give. Java already says what the problem is: the cart/util/BookException class is not on the application's classpath. That can indicate a missing library or bad deployment settings. Hard to say what it exactly is.
All I can say is: learn how a JEE application is properly packaged and deployed and with that knowledge try and figure out where the mistake is.
Maybe you are looking for
-
Hi, Is there anyway in development environment to test clustering without getting the network people involved to do multicasting? Thanks. Tinou Bao www.tinou.com
-
Remove "Personalize Link" from context menu of iViews.
HI, We have to disable / hide the "Personalize Link" from context menu of all iViews in the portal. we do not want to go to Properties of individual iViews and change that. Is their any global setting for that? _vishal
-
PREMIERE PRO cs3 & cs5 - audio out of synch by 6 frames after export
i have never had formal training on adobe premiere, and therefore when i am working with my students it is basically down to expereince i have gained by myself. with cs3, we always worked on the basis that it would always export the audio out of sync
-
Sending IDoc MATERIALBOM_CREATEBOMGROUP01
Hi Gurus, i don't know if i am perfectly right in this Forum. I am looking for a way to send the IDoc MATERIALBOM_CREATEBOMGROUP01. I need to send BOMs (with same data like in IDoc BOMMAT) but including the history-data. Can anybody tell me how i can
-
Ix4-300D Issues on Sleep and Fan Speed - Possible Feature Request
Hi, Can I find out why when the drives go to sleep, why cant the display panel turn off and the fan slow down? My NAS is only used at a certain time of day, which I can use the power off/power on schedule, but there are times during the week when I w