JPA help needed(Java Persistence)

Hi friends ,
Is there any demo for JPA ,
I have to perform Java Persistence ,
I have the underlying tables , and I have to access and manipulate them , just like Java objects

Yordon when I tried to test my service I got this error
em is my Entity manager instance
javax.ejb.EJBException: Cannot perform injection over bean instance [email protected]5db311 for bean demo.sap.com/jpacasear*annotation|demo.sap.comjpacas~ejbmodule.jar*annotation|com.sap.demo.jpacas.modeled.appsrv.jpaservice.jpaservice; nested exception is: com.sap.engine.lib.injection.InjectionException: Injection on field em of instance [email protected]5db311 failed. Could not get a value to be injected from the factory.:
com.sap.engine.services.ejb3.util.pool.PoolException: javax.ejb.EJBException: Cannot perform injection over bean instance [email protected]5db311 for bean demo.sap.com/jpacas~ear*annotation|demo.sap.com~jpacas~ejbmodule.jar*annotation|com.sap.demo.jpacas.modeled.appsrv.jpaservice.jpaservice; nested exception is: com.sap.engine.lib.injection.InjectionException: Injection on field em of instance [email protected]5db311 failed. Could not get a value to be injected from the factory.
at com.sap.engine.services.ejb3.util.pool.ContainerPool.translate(ContainerPool.java:288)
at com.sap.engine.services.ejb3.util.pool.ContainerPoolImpl.doResizeOneStepUp(ContainerPoolImpl.java:378)
at com.sap.engine.services.ejb3.util.pool.ContainerPoolImpl.ensureNotEmpty(ContainerPoolImpl.java:342)
at com.sap.engine.services.ejb3.util.pool.ContainerPoolImpl.pop(ContainerPoolImpl.java:309)
at com.sap.engine.services.ejb3.runtime.impl.StatelessInstanceLifecycleManager.getMethodReady(StatelessInstanceLifecycleManager.java:64)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:14)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
at $Proxy367_10002.getDetails(Unknown Source)
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:585)
at com.sap.caf.rt.services.serviceaccess.ServiceWrapper.findByDataObject(ServiceWrapper.java:330)
at com.sap.caf.rt.services.serviceaccess.CAFServiceAccessBeanImpl.findByDataObject(CAFServiceAccessBeanImpl.java:230)
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:585)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:43)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatefulTransactionAssociation.invoke(Interceptors_StatefulTransactionAssociation.java:43)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatefulSessionInstanceGetter.invoke(Interceptors_StatefulSessionInstanceGetter.java:37)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
at com.sap.engine.services.ejb3.runtime.impl.StatefulBMProxyInvocationHandler.invoke(StatefulBMProxyInvocationHandler.java:55)
at $Proxy103_10002.findByDataObject(Unknown Source)
at com.sap.caf.rt.ui.esf.BONodeServiceAccess.findBy(BONodeServiceAccess.java:296)
at com.sap.caf.rt.ui.esf.Query.execute(Query.java:222)
at com.sap.caf.ui.servicebrowser.components.visualizer.controllers.TableViewCC.execute(TableViewCC.java:353)
at com.sap.caf.ui.servicebrowser.components.visualizer.controllers.wdp.InternalTableViewCC.execute(InternalTableViewCC.java:181)
at com.sap.caf.ui.servicebrowser.components.visualizer.views.TableViewCV.onActionExcuteQuery(TableViewCV.java:429)
at com.sap.caf.ui.servicebrowser.components.visualizer.views.wdp.InternalTableViewCV.wdInvokeEventHandler(InternalTableViewCV.java:342)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:131)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:72)
at com.sap.tc.webdynpro.clientserver.phases.ProcessingEventPhase.doHandleActionEvent(ProcessingEventPhase.java:156)
at com.sap.tc.webdynpro.clientserver.phases.ProcessingEventPhase.execute(ProcessingEventPhase.java:91)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequestPartly(WindowPhaseModel.java:161)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doProcessRequest(WindowPhaseModel.java:109)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:96)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:469)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:52)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.doExecute(ClientApplication.java:1388)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.doProcessing(ClientApplication.java:1208)
at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.delegateToApplicationDoProcessing(AbstractExecutionContextDispatcher.java:145)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.DispatchHandlerForAppProcessing.doService(DispatchHandlerForAppProcessing.java:35)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.AbstractDispatchHandler.service(AbstractDispatchHandler.java:116)
at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:93)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.ExecutionContextDispatcher.dispatchToApplicationDoProcessing(ExecutionContextDispatcher.java:114)
at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:80)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.dispatch(ApplicationSession.java:506)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.dispatch(ApplicationSession.java:526)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doApplicationProcessingStandalone(ApplicationSession.java:457)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:248)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:698)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:230)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:228)
at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.delegateToRequestManager(AbstractExecutionContextDispatcher.java:192)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.DispatchHandlerForRequestManager.doService(DispatchHandlerForRequestManager.java:38)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.AbstractDispatchHandler.service(AbstractDispatchHandler.java:116)
at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:93)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.ExecutionContextDispatcher.dispatchToRequestManager(ExecutionContextDispatcher.java:140)
at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:92)
at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:104)
at com.sap.tc.webdynpro.serverimpl.core.AbstractDispatcherServlet.doContent(AbstractDispatcherServlet.java:87)
at com.sap.tc.webdynpro.serverimpl.core.AbstractDispatcherServlet.doPost(AbstractDispatcherServlet.java:61)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:66)
at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:32)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:431)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:289)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:376)
at com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:85)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:160)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:67)
at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:309)
at com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.run(Processor.java:222)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:152)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:247)
Caused by: javax.ejb.EJBException: Cannot perform injection over bean instance [email protected]5db311 for bean demo.sap.com/jpacas~ear*annotation|demo.sap.com~jpacas~ejbmodule.jar*annotation|com.sap.demo.jpacas.modeled.appsrv.jpaservice.jpaservice; nested exception is: com.sap.engine.lib.injection.InjectionException: Injection on field em of instance [email protected]5db311 failed. Could not get a value to be injected from the factory.
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_DependencyInjection.invoke(Interceptors_DependencyInjection.java:25)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_EJBContext30DependencyInjection.invoke(Interceptors_EJBContext30DependencyInjection.java:11)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ApplicationInstancesCreator.invoke(Interceptors_ApplicationInstancesCreator.java:53)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_NewBeanContext.invoke(Interceptors_NewBeanContext.java:17)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startCallback(DefaultInvocationChainsManager.java:147)
at com.sap.engine.services.ejb3.runtime.impl.StatelessInstanceLifecycleManager.makeExist(StatelessInstanceLifecycleManager.java:108)
at com.sap.engine.services.ejb3.runtime.impl.StatelessInstanceLifecycleManager.access$000(StatelessInstanceLifecycleManager.java:23)
at com.sap.engine.services.ejb3.runtime.impl.StatelessInstanceLifecycleManager$PoolUserImpl.createObject(StatelessInstanceLifecycleManager.java:34)
at com.sap.engine.services.ejb3.util.pool.ContainerPoolImpl.doResizeOneStepUp(ContainerPoolImpl.java:373)
... 113 more
Caused by: com.sap.engine.lib.injection.InjectionException: Injection on field em of instance [email protected]5db311 failed. Could not get a value to be injected from the factory.
at com.sap.engine.lib.injection.FieldInjector.inject(FieldInjector.java:115)
at com.sap.engine.lib.injection.InjectionMatrix.inject(InjectionMatrix.java:45)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_DependencyInjection.invoke(Interceptors_DependencyInjection.java:22)
... 129 more
Caused by: com.sap.engine.services.orpersistence.container.exceptions.ResourceException: Persistence unit 'CAR_AL' requested from archive 'demo.sap.com~jpacas~ejbmodule.jar' is not present in application 'demo.sap.com/jpacas~ear' or is not visible to the requested archive.
at com.sap.engine.services.orpersistence.container.ORPersistenceObjectFactory.getPersistenceUnitInfo(ORPersistenceObjectFactory.java:213)
at com.sap.engine.services.orpersistence.container.ORPersistenceObjectFactory.getObjectInstance(ORPersistenceObjectFactory.java:59)
at com.sap.engine.lib.injection.ReferenceObjectFactory.getObject(ReferenceObjectFactory.java:65)
at com.sap.engine.lib.injection.FieldInjector.inject(FieldInjector.java:113)
... 131 more
Close

Similar Messages

  • Urgent  help needed(java frames)

    Hi,
    I need urgent help for correcting a piece of code.
    I have written a piece of code for building a gui with some buttons, drawing some geometric shapes.The code consists of two files called Graph and Frame.
    The problem I suppose in the last part of the Graph file, which Rectangle and Circle are called together, the only shape that the program draws is rectangle.Here is the code:
    //Graph
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import java.util.*;
    public class Graph extends JPanel {
    LinkedList color;
    LinkedList figures;
    public Graph() {
    setBackground(Color.white);
    figures = new LinkedList();
    color = new LinkedList();
    int z;
    class Point {
    int x;
    int y;
    public Point(int x, int y) {
    this.x = x;
    this.y = y;
    public Point(Point p) {
    x = p.x;
    y = p.y;
    public String toString() {
    return "(" + x + ", " + y + ")";
    public void move(Point dist) {
    x += dist.x;
    y += dist.y;
    abstract class GeomFigur {
    public abstract void move(Point p);
    class Line extends GeomFigur {
    Point p1, p2;
    public Line(Point p1, Point p2) {
    this.p1 = new Point(p1);
    this.p2 = new Point(p2);
    public String toString() { return "Line from " + p1 + " to " + p2;  }
    public void move(Point dist) {
    p1.move(dist);
    p2.move(dist);
    class Rectangle extends Line {
    public Rectangle(Point p1, Point p2) {
    super(p1, p2);
    public String toString() { return "Rectangle from " + p1 + " to " + p2; }
    class Circle extends GeomFigur{
    Point centre;
    int radius;
    public Circle(Point centre, int radius) {
    this.centre = new Point(centre);
    this.radius = radius;
    public String toString() {
    return "Circle, centre " + centre + ", radius " + radius;
    public void move(Point dist) { centre.move(dist); }
    public void addRectangle(int x, int y, Color col) {
    Rectangle r =new Rectangle(new Point(x,y),new Point(x+20,y+20));
    figures.addLast(r);
    color.addLast(col);
    repaint();
    public void addCircle(int x, int y, Color col) {
    Circle c =new Circle(new Point(x,y), 1 );
    figures.addLast(c);
    color.addLast(col);
    repaint();
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    for (int i=0;i < figures.size();i++) {
    Rectangle rect = (Rectangle)figures.get(i);
    //Circle circ = (Circle)figures.get(i);
    g.setColor(Color.black);
    g.drawRect(rect.p1.x,rect.p1.y,20,20);
    g.setColor((Color)color.get(i));
    g.fillRect(rect.p1.x,rect.p1.y,20,20);
    //g.setColor(Color.black);
    // g.drawOval(circ.centre.x,circ.centre.y,20,20);
    // g.setColor((Color)color.get(i));
    // g.fillOval(circ.centre.x, circ.centre.y, 20, 20);
    //Frame
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class Frame extends JFrame implements ActionListener {
    JButton button1, button2, button3, button4, button5 ;
    Graph gr;
    JComboBox cbx;
    JComboBox cby;
    JComboBox col;
    JMenu filemenu;
    JMenuItem quit;
    JMenuBar menubar;
    int x=10;
    int y=10;
    Color color=Color.red;
    public Frame() {
    menubar = new JMenuBar();
    filemenu = new JMenu("File");
    filemenu.setMnemonic('F');
    quit = new JMenuItem("Quit");
    quit.addActionListener(this);
    quit.setMnemonic('Q');
    quit.setAccelerator(KeyStroke.getKeyStroke('Q',Event.CTRL_MASK,false));
    filemenu.add(quit);
    menubar.add(filemenu);
    setJMenuBar(menubar);
    button1 = new JButton("Rectangle");
    button1.addActionListener(this);
    button2 = new JButton("Circle");
    button2.addActionListener(this);
    button4 = new JButton("Ellipse");
    button4.addActionListener(this);
    button5 = new JButton("Triangle");
    button5.addActionListener(this);
    button3 = new JButton("Reset");
    button3.addActionListener(this);
    String[] elements_x= {"10","20","30","40","50","60","70"};
    cbx = new JComboBox(elements_x);
    cbx.addActionListener(this);
    cbx.setActionCommand("cbx");
    String[] elements_y= {"10","20","30","40","50","60","70"};
    cby = new JComboBox(elements_y);
    cby.addActionListener(this);
    cby.setActionCommand("cby");
    String[] elements_color = {"Red","Blue","Green","Orange","Yellow" };
    col = new JComboBox(elements_color);
    col.addActionListener(this);
    col.setActionCommand("col");
    gr = new Graph();
    JPanel top = new JPanel(new BorderLayout());
    JPanel inputs = new JPanel(new GridLayout(6,1));
    inputs.add(button1);
    inputs.add(button2);
    inputs.add(button3);
    inputs.add(button4);
    inputs.add(button5);
    inputs.add(cbx);
    inputs.add(cby);
    inputs.add(col);
    top.add(gr,BorderLayout.CENTER);
    top.add(inputs,BorderLayout.WEST);
    getContentPane().add(BorderLayout.CENTER, top);
    setSize(500,300);//set window size
    //take care of actions
    public void actionPerformed(ActionEvent e) {
    String command = e.getActionCommand();
    if (command.equals("Quit")){
    System.exit(0);//terminate program
    else if (command.equals("Rectangle")){
    //add Rectangle to graph at
    //position x,y and with certain color
    gr.addRectangle(x,y,color);
    else if (command.equals("Circle")){
    gr.addCircle(x,y,color);
    else if (command.equals("Reset")){
    else if (command.equals("Triangle")){
    else if (command.equals("Ellipse")){
    else if (command.equals("cbx")){
    x=Integer.valueOf((String)((JComboBox)e.getSource()).getSelectedItem()).intValue();
    else if (command.equals("cby")){
    y=Integer.valueOf((String)((JComboBox)e.getSource()).getSelectedItem()).intValue();
    else if (command.equals("col")){
    String temp=(String)((JComboBox)e.getSource()).getSelectedItem();
    if (temp=="Red") color=Color.red;
    else if (temp=="Blue") color=Color.blue;
    else if (temp=="Green") color=Color.green;
    else if (temp=="pink") color=Color.pink;
    else if (temp=="lightGray") color=Color.lightGray;
    //main program
    public static void main(String [] args) {
    Frame appl = new Frame();
    appl.setVisible(true);
    Thanks in advance
    Marina

    Hi,
    You are very lucky that I'm currently boored. You should never tag a question as urgent. It might be urgent to you, but not to us who answer. And you should also use code formatting when you post code (see the formatting tips, or use the code-button).
    I made some changes to your Graph class. The most important thing is the abstract draw method that I added to the GeomFigur class.
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    public class Graph extends JPanel {
        LinkedList figures;
        public Graph() {
            setBackground(Color.white);
            figures = new LinkedList();
        int z;
        abstract class GeomFigur {
            protected Color color;
            public GeomFigur(Color color) {
                this.color = color;
            public abstract void move(Point p);
            public abstract void draw(Graphics g);
        abstract class Line extends GeomFigur {
            Point p1, p2;
            public Line(Color c, Point p1, Point p2) {
                super(c);
                this.p1 = new Point(p1);
                this.p2 = new Point(p2);
            public String toString() {
                return "Line from " + p1 + " to " + p2;
            public void move(Point dist) {
                p1.move(dist.x, dist.y);
                p2.move(dist.x, dist.y);
        class Rectangle extends Line {
            public Rectangle(Color c, Point p1, Point p2) {
                super(c, p1, p2);
            public String toString() {
                return "Rectangle from " + p1 + " to " + p2;
            public void draw(Graphics g) {
                System.out.println("Draw rectangle at " + p1 + " with color " + color);
                g.setColor(Color.black);
                g.drawRect(p1.x, p1.y, 20, 20);
                g.setColor(color);
                g.fillRect(p1.x, p1.y, 20, 20);
        class Circle extends GeomFigur {
            Point centre;
            int radius;
            public Circle(Color c, Point centre, int radius) {
                super(c);
                this.centre = new Point(centre);
                this.radius = radius;
            public String toString() {
                return "Circle, centre " + centre + ", radius " + radius;
            public void move(Point dist) {
                centre.move(dist.x, dist.y);
            public void draw(Graphics g) {
                System.out.println("Draw circle at " + centre + " with color " + color);
                g.setColor(Color.black);
                g.drawOval(centre.x, centre.y, 20, 20);
                g.setColor(color);
                g.fillOval(centre.x, centre.y, 20, 20);
        public void addRectangle(int x, int y, Color col) {
            System.out.println("x,y,col " + x + ":" + y + ":" + col);
            Rectangle r = new Rectangle(col, new Point(x, y), new Point(x + 20, y + 20));
            figures.addLast(r);
            repaint();
        public void addCircle(int x, int y, Color col) {
            System.out.println("x,y,col" + x + ":" + y + ":" + col);
            Circle c = new Circle(col, new Point(x, y), 1);
            figures.addLast(c);
            repaint();
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            for (int i = 0; i < figures.size(); i++) {
                GeomFigur drawable = (GeomFigur)figures.get(i);
                drawable.draw(g);
    }/Kaj

  • First Spring Application .Help needed.java.lang.ClassNotFoundException

    Hi
    i am new to this site and java Springs, I couldn't find seprate spring forum so i am posting my question here.
    i hope its not a problem.
    I am very new to Springs and struggeling through my first Spring MVC application. can any one help me here.
    Here is what i have done uptill now.
    WEB.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <servlet>
            <servlet-name>HelloSpring</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
            </servlet>
        <servlet-mapping>
            <servlet-name>HelloSpring</servlet-name>
            <url-pattern>*.htm</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>      
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
         <welcome-file>
                index.jsp
            </welcome-file>
        </welcome-file-list>
    </web-app>
    HelloSpring-servlet.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
        <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <props>
                    <prop key="/hello.htm">HelloSpringController</prop>
                </props>
            </property>
        </bean>
        <bean id = "HelloSpringController" class="HelloSpringController" />
    </beans>
    index.jsp
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Hello Spring</title>
        </head>
        <body>
        <form action="hello.htm"  method="POST">
            What is your name?
            <input type="text" name="yourName" value="" />
        </form>
        </body>
    </html>
    welcome.jsp
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Hello Spring</title>
        </head>
        <body>
        Hello <c:out value="${name}" />
        </body>
    </html>
    HelloSpringController.java (in default package)
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.Controller;
    public class HelloSpringController implements Controller {
        public HelloSpringController() {
        public ModelAndView handleRequest(HttpServletRequest httpServletRequest,
                                          HttpServletResponse httpServletResponse)
                                            throws Exception {
            String name = httpServletRequest.getParameter("yourName");
            return new ModelAndView("welcome.jsp", "name", name);
    }After Entering name in the text box of index.jsp, i am getting the following error.
    exception
    javax.servlet.ServletException: Servlet.init() for servlet HelloSpring threw exception
         org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
         org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
         org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         java.lang.Thread.run(Unknown Source)
    root cause
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/HelloSpring-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [HelloSpringController] for bean with name 'HelloSpringController' defined in ServletContext resource [/WEB-INF/HelloSpring-servlet.xml]; nested exception is java.lang.ClassNotFoundException: HelloSpringController
         org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:451)
         org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
         org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
         org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
         org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
         org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
         org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
         org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:330)
         org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:266)
         org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:236)
         org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
         javax.servlet.GenericServlet.init(GenericServlet.java:211)
         org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
         org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
         org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         java.lang.Thread.run(Unknown Source)
    root cause
    java.lang.ClassNotFoundException: HelloSpringController
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
         org.springframework.util.ClassUtils.forName(ClassUtils.java:201)
         org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:327)
         org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1066)
         org.springframework.beans.factory.support.AbstractBeanFactory.isBeanClassMatch(AbstractBeanFactory.java:1094)
         org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:354)
         org.springframework.context.support.AbstractApplicationContext.isSingleton(AbstractApplicationContext.java:745)
         org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:255)
         org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:125)
         org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:103)
         org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
         org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:72)
         org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:304)
         org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1168)
         org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:428)
         org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
         org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
         org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
         org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
         org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
         org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
         org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:330)
         org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:266)
         org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:236)
         org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
         javax.servlet.GenericServlet.init(GenericServlet.java:211)
         org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
         org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
         org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         java.lang.Thread.run(Unknown Source)Can anybody tell me what is am doing wrong .. it will be a greate help...
    thanks in advance

    vikash_sharma wrote:
    Thanks for another quick reply
    here is the folder structure of war.
    HelloSpring.war
    -----------Bin (empty)Wrong. No need for this. Remove it.
    ------------src/HelloSpringController.javaWrong. Source code doesn't go in WAR.
    ------------WEB-INF/classes(empty)there's your problem. the HelloSpringController.class has to be in there.
    /libWhere are the Spring JARs?
    /META-INF
    /tldDon't need /tld.
    ------------welcome.jsp
    ------------index.jspWhere's your web.xml? Where is the Spring configuration?
    You're still blank. Not even close to correct. You don't seem to know Java well enough to tackle this. You will NOT be able to accomplish this by asking questions here. Go back and learn more basics.
    %

  • A novice in need of help --- Need JAVA GOD

    Hello everyone, i would appreciate any help anyone can give me. I am tyring to make a connection to Oracle via Java and make some tables. what am i doing wrong?
    package edu.uwec.cs.jorandbe.assignment5;
    import java.awt.HeadlessException;
    import java.sql.*;
    import javax.swing.*;
    public class OracleDBConnection {
    String username;
    String host;
    String password;
    Driver theOracleDriver;
    Connection myConn;
    String sqlQuery;
    ResultSet rs;
    Statement stmt;
    public OracleDBConnection() {
    public OracleDBConnection(String hostn, String usern, String passw) {
    this.host = hostn;
    this.username = usern;
    this.password = passw;
    public void Open() {
    try {
    theOracleDriver = (Driver) (Class
    .forName("oracle.jdbc.driver.OracleDriver")).newInstance();
    DriverManager.registerDriver(theOracleDriver);
    Connection myConn = DriverManager.getConnection(this.host,
    this.username, this.password);
    stmt = myConn.createStatement();
    } catch (InstantiationException e) {
    e.printStackTrace();
    } catch (IllegalAccessException e) {
    e.printStackTrace();
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    } catch (SQLException e) {
    e.printStackTrace();
    public void Close() {
    try {
    if (rs != null)
    rs.close();
    if (myConn != null)
    myConn.close();
    if (stmt != null)
    stmt.close();
    } catch (SQLException e) {
    e.printStackTrace();
    public void setQueryString(String Query) {
    sqlQuery = Query;
    public void getQueryString(String Query) {
    System.out.println("Current SqlQuery : " + sqlQuery);
    //public String [][] executeSELECT() {
    //rs = stmt.executeUpdate(sql);
    // return rs;
    public static void main(String[] args) {
    OracleDBConnection Oracle1 = new OracleDBConnection("jdbc:oracle:thin:@stef.cs.uwec.edu:1521:csdev","Jorandbe","j8114");
    //CLASS 2
    package edu.uwec.cs.jorandbe.assignment5;
    public class NFL_DDL {
         public static void main(String[] args) {
              OracleDBConnection Oracle1 = new OracleDBConnection("jdbc:oracle:thin:@stef.cs.uwec.edu:1521:csdev","Jorandbe","j8114");
    Oracle1.Open();
    Oracle1.Close();
    public void createTables(Object Oracle1){
    //Oracle1.Open();
    can anyone tell me why Oracle1.Oen(); works in my main method
    but in my create Table method as well??

    public class NFL_DDL {
         public static void main(String[] args) {
              OracleDBConnection Oracle1 = new OracleDBConnection("jdbc:oracle:thin:@stef.cs.uwec.edu:1521:csdev","Jorandbe","j8114");
    Oracle1.Open();
    Oracle1.Close();
    public void createTables(Object Oracle1){
    //Oracle1.Open();
    In the main up top, i can get the connection to open/ Oarcle1.Open works and it gives me no compile errors
    but when i try to do the same thing in the createTables it gives me the evil red line under open and says
    "The method Open() is undefined for the type Object"Where are you calling the createTables method ? How will the compiler know that it has to start off with the createTables ?
    Open() is not a static method either ...?!?!?!?
    what are you trying to do ?

  • JDBC help needed ; java.lang.NoClassDefFoundError:test1

    hi, everyone, i had a problem when i run my own app to connect javadb in embedded mode
    i ve added the ~/javadb/lib/derby.jar to CLASSPATH
    and ~/javadb/lib/derby.jar:~/javadb/lib/derbytools.jar to DERBY_HOME
    but there is a problem said my own application class cannot be found.
    here is my code:
    import java.sql.*;
    class test1
      public static void main (String args [])
           throws SQLException
           try {
            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
        } catch (Exception e) {
            System.out.println("ERROR: failed to load javadb JDBC driver.");
            e.printStackTrace();
            return;
          Connection conn = DriverManager.getConnection("jdbc:derby:testdb");
      try{
         Statement stmt1 = conn.createStatement();
            ResultSet rset1 = stmt1.executeQuery( "SELECT * FROM PART" );
         long counter1 = 0;
            double price1;
         while ( rset1.next() )
             price1 = rset1.getDouble(8);
             if (price1 == 1306.4)
              counter1++;
         System.out.println( counter1 );
         stmt1.executeQuery("SHUTDOWN");
         conn.close();
       catch (SQLException e )
         String errmsg = e.getMessage();
         System.out.println( errmsg );
    }and i ve followed one Derby JDBC tutorial on the internet,
    * AutoLoadJdbcDriver.java
    * Copyright (c) 2007 by Dr. Herong Yang. All rights reserved.
    import java.sql.*;
    import java.util.*;
    public class AutoLoadJdbcDriver {
      public static void main(String [] args) {
        Connection con = null;
        try {
          listDrivers();
    // Find the driver for a given URL
          Driver driverClass = (Driver) DriverManager.getDriver(
            "jdbc:derby://somehost/somedb");
          System.out.println("\nDriver for jdbc:derby://somehost/somedb");
          System.out.println("   "+driverClass.getClass().getName());
          listDrivers();
        } catch (Exception e) {
          System.err.println("Exception: "+e.getMessage());
      private static void listDrivers() {
        Enumeration driverList = DriverManager.getDrivers();
        System.out.println("\nList of drivers:");
        while (driverList.hasMoreElements()) {
          Driver driverClass = (Driver) driverList.nextElement();
          System.out.println("   "+driverClass.getClass().getName());
    The output below confirms that the DriverManager class is able to load any JDBC driver classes as long as their JAR files are included in the classpath.
    C:\>javac AutoLoadJdbcDriver.java
    C:\>java -cp .;\local\javadb\lib\derbyclient.jar AutoLoadJdbcDriver
    List of drivers:
    sun.jdbc.odbc.JdbcOdbcDriver
    org.apache.derby.jdbc.ClientDriver
    Driver for jdbc:derby://somehost/somedb
    org.apache.derby.jdbc.ClientDriver
    List of drivers:
    sun.jdbc.odbc.JdbcOdbcDriver
    org.apache.derby.jdbc.ClientDriver
    but on my machine , it keep telling me the massage
    Exception in thread "main" java.lang.NoClassDefFoundError: SimpleApp
    Exception in thread "main" java.lang.NoClassDefFoundError: test1
    Exception in thread "main" java.lang.NoClassDefFoundError: AutoLoadJdbcDriver
    the ij works well
    and the other java app(without jdbc) works well.
    anybody can help me to solve this problem?
    Edited by: Xiao on Jan 18, 2008 6:19 PM

    but on my machine , it keep telling me the massage
    Exception in thread "main" java.lang.NoClassDefFoundError: SimpleApp
    Exception in thread "main" java.lang.NoClassDefFoundError: test1
    Exception in thread "main" java.lang.NoClassDefFoundError: AutoLoadJdbcDriverI assume you get these messages when you try and run the three programs mentioned (SimpleApp, test1 and AutoLoadJdbcDriver).
    What commands do you use to do this? What does the command line report the CLASSPATH to be (using the echo command)?
    The simplest cause would be that you have the derby jar mentioned as part of CLASSPATH, but not the current directory.

  • Help needed: java / fedora printing

    A java print test program which used to work on fc4 and xp, now simply does not work on fedora core 5 (fc5). The test programs are here:
    http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-Printing.html
    I am using a samsung ml-1750 with the hpijs driver although I do not think this matters.
    The app attempts to print a jpanel image first bringing up the print dialog box, and then printing.
    When the 'print' button is pressed nothing happens. If 'print to file' is chosen, an empty file is written out.
    "regular" printing .e.g of a web page, kedit document etc works fine
    Any and all help is appreciated. Thanks
    Lou

    you can try the following this fine works at my end on CentOS 4
    String strCommand = "lpr#"+masterpath+"/"+filename;
                                  System.out.println("Cmd="+ strCommand);
                                  String[] command=strCommand.split("#");
                                  p = rt.getRuntime().exec(command);

  • Help Needed - Java Threads

    Hi there,
    It's related to Threads in Java, I have the following code and it doesnt compile using NetBeans. While it compiles and runs fine in command prompt i.e. using javac testthreads.java.
    class test implements Runnable{
    public void run(){
    System.out.println("this is from test class");
    class testthreads{
    public static void main(String args[]){
    test t=new test();
    Thread tt=new Thread(t);
    tt.start();
    I get the following error when trying to compile.
    init:
    deps-jar:
    Compiling 1 source file to C:\myjavacode\ExtendThreadClassTest0\build\classes
    C:\myjavacode\ExtendThreadClassTest0\src\MainClass.java:13: cannot find symbol
    symbol : constructor Thread(test)
    location: class java.lang.Thread
    Thread tt=new Thread(t);
    1 error
    BUILD FAILED (total time: 0 seconds)
    If I use extends Thread instead of implements Runnable the above source code compiles fine in NetBeans as well.
    Any idea what's wrong..... Pls suggest!!
    Thanks!

    but this seems to be the issue with netbeans ide.... any idea if I need to change any setting etc. in IDE?

  • HELP needed: java plug-in fatal error

    i keep getting this java error whenever certain websites try using my java. (using either IE6 and ff2.0) http://img.photobucket.com/albums/v226/boogleloo/error.jpg
    i un-installed older version and got new version of java installed but that made no difference
    i do not have a clue where to look how to make the request changes the error wants made... please is someone could assist me with a walk through fix i would be greatly appreciative!
    Message was edited by:
    boogleloo

    Well I got it working on explorer browser but it still wont work on Avant browser which is my favorite any ideas why it will work on one but not the other??

  • With Java Persistence, are DAOs (data access objects) still needed?

    I have just looked at the Java Persistence tutorial and it says each table row of a database can be represented as a Java Persistence entity instance.
    The definition of an "entity" is very much like how you would define the class of an equivalent DAO.
    So I am wondering... should DAOs still be used ? or can persistence entities completely replace them?

    Hi,
    I am saying that if you use JPA then you will not be making a DAO class, for example if you have a Person.java object you will not need to make a PersonDAO.java object.
    For example, if using JPA you Person.java object would look like this example below...
    Of course, the classes that call person object may need to call some JPA manager APIs or some JTA transaction APIs. If you use EJB session beans to call the JP{A entity then you dont have to have any code, as ou can see here
    https://blueprints.dev.java.net/bpcatalog/ee5/persistence/ejbfacade.html
    if you do not use EJBs in a pure web app then you will likely manually write code to manage transactions and entity manager APIs such as
    https://blueprints.dev.java.net/bpcatalog/ee5/persistence/webfacade.html
    See Person.java entuty example below and see there is no DAO code.
    @Entity
    public class Person implements java.io.Serializable {
        private int personId;
        private String userName;
        private String firstName;
        private String lastName;
        private String summary;
        public Person() { }
    @Id
    public int getPersonId() {
    return personId;
    public String getUserName() {
    return userName;
    public String getFirstName() {
    return firstName;
    public String getLastName() {
    return lastName;
    public String getSummary(){
    return summary;
    public void setPersonId(int personId) {
    this.personId = personId;
    public void setUserName(String userName) {
    this.userName = userName;
    public void setFirstName(String firstName) {
    this.firstName = firstName;
    public void setLastName(String lastName) {
    this.lastName = lastName;
    public void setSummary(String summary) {
    this.summary = summary;
    }

  • Help with a design, using Java Persistence

    I'm having a design issue, and I hope that someone can help.
    I have a table called Item, and it essentially acts as a header table for a group of attributes for that item.
    TABLE Item
    .....id....................long
    .....itemName.........varchar
    .....StartDate........datetime
    .....StopDate........datetime
    If I can, I'd like to design a model that will allow for a dynamic number of attributes for any given ITEM.
    I initially thought that it would be convenient to design the Attributes table like such:
    TABLE Attribute
    .....id....................long
    .....itemID.............long (references Item.id)
    .....attributeName....varchar
    .....value...............?
    .....StartDate.........datetime
    .....StopDate.........datetime
    My problem is the VALUE column. Attributes can be any given type, so this won't work if I want to enforce a data type.
    I don't know where to go from here. I can create a table to include all attributes, but each attribute needs to have a date range.
    Additionally, the history of the attributes must be retained; so, if I succeeded any given Attribute I would need to duplicate the
    entire row (thus, all the other data that didn't change).
    One thought was to create an Attribute table for each of the most common types, but that seems like a really bad idea:
    TABLE AttributeLong
    TABLE AttributeDateTime
    TABLE AttributeVarchar
    etc, etc ...
    I should note that I'm using Java Persistence.

    I agree with you 100%. Here is something I'm trying to get a grip on: there are a finite number of attributes per group, but the number of attribute groups can grow (maybe 20 sets max - but I just don't know yet).
    I would need one table (Entity) for each set of attributes.
    So, for instance, let's say I have:
    Item1 is of kind KIND1 that has an attribute set of SET1
    (ie, tables ITEM and SET1)
    Item2 is of kind KIND2 that has an attribute set of SET2
    (ie, tables ITEM and SET2)
    I'd like to have my Item entity class set up like such:
    myItem.getAttributeSet
    instead of:
    myItem.getAttributeSet1
    myItem.getAttributeSet2
    Since at given time I can extend my application (and add new entity classes to support a new table for SET3), I wanted to avoid changing Item. I can have getAttributeSet return an interface and then cast it, but that still requires changing Item to account for the new entities. Thus, I can't just drop in new "packages."
    I want a flexible and extensible system., but maybe I'm over thinking/engineering this.

  • Help needed  while exporting crystal reports to HTML file format using java

    Help needed  while exporting crystal reports to HTML file format using java api(not using crystalviewer).i want to download the
    html file of the report
    thanks

    the ReportExportFormat class does not have HTML format, it has got to be XML. Export to HTML is available from CR Designer only.
    Edited by: Aasavari Bhave on Jan 24, 2012 11:37 AM

  • Help Needed in Creating Java Class and Java Stored Procedures

    Hi,
    Can anyone tell how can i create Java Class, Java Source and Java Resource in Oracle Database.
    I have seen the Documents. But i couldn't able to understand it correctly.
    I will be helpful when i get some Examples for creating a Java Class, Java Source and Stored Procedures with Java with details.
    Is that possible to Create a Java class in the oracle Database itself ?.
    Where are the files located for the existing Java Class ?..
    Help Needed Please.
    Thanks,
    Murali.v

    Hi Murali,
    Heres a thread which discussed uploading java source file instead of runnable code on to the database, which might be helpful :
    Configure deployment to a database to upload the java file instead of class
    The files for the java class you created in JDev project is located in the myworks folder in jdev, eg, <jdev_home>\jdev\mywork\Application1\Project1\src\project1
    Hope this helps,
    Sunil..

  • Can someone pls help me with java on my macbook pro because after i download the mountain lion java has died and i need java to see streaming quotes from stock market

    can someone pls help me with java on my macbook pro because after i download the mountain lion java has died and i need java to see streaming quotes from stock market

    Java is no longer included in Mac OS X by default. If you want Java, you will have to install it.
    However, note that you should think twice before installing Java for such a trivial need as looking at stock market quotes. There are other ways to get that information that don't involve Java, and using Java in your web browser is a HUGE security risk right now. Java has been vulnerable to attack almost constantly for the last year, and has become a very popular, frequently used method for getting malware installed via "drive-by downloads." You really, truly don't want to be using it. See:
    Java is vulnerable… Again?!
    http://java-0day.com

  • HT5675 i need java 1.6 to get ,m,inecraft but it wont ever work please help?

    i need java 1.6 to get minecraft but it wont ever work someone please help me!

    Hello,
    What version of Mac OS X are you running on your iBook?
    Also check what version of java is currently installed by doing the following,
    Open Terminal, type in java -version then press Enter.  Then retrieve the current java version, in this example being 1.6.0_24

  • Need help in Java Script

    i Need some help in Java Script,
    am using the following code :
    <script type="text/javascript">
    var newwindow;
    function poptastic(url)
    newwindow=window.open(url,'name','height=300,width=400,left=100, top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
    if (window.focus) {newwindow.focus()}
    else {newwindow.close()}
    //     if (window.focus) {newwindow.focus()}
    </script>
    In HTML,
    thWorld Environment
    Day, June 5<sup>th</sup>,2005
    Am using onmouseover event, so that when my mouse in on the link, popup is opened....and when my mouse is out of the link, the new window should b closed....
    but according to the above code, the new window is opened but have to close it manually....
    Is there any other way to close the popup when my mouse is out of the link

    Prawn,
    This is not really a good way to make friends. With the cross posting and the posting in a wrong forum anyway thing you have going.
    Please kindly take your question to an appropriate JavaScript forum.
    Have a happy day.
    Cross post from http://forum.java.sun.com/thread.jspa?messageID=3797201

Maybe you are looking for

  • Error during page load in e-Recruitment

    Hi SAPiians, We are implementing SAP e-Recuitment using BSPs. We are done with the configuration part and also configured the ALE. Also, generated the URLs using RCF_GENERATE_URLS. When i copy and paste the URL in a browser, the logon page pops up. W

  • Navigational TOC doesn't show up when exported to epub, any suggestions?

    Hi All! I created a Table of Contents document in the book that I am creating but when I export it for Digital Editions the TOC page just shows completely blank. This is my first epub and I don't know if I'm setting it up right. Has anyone else had a

  • HTTP server code 400 reason Bad Request explanation Bad Request

    hello everybody, i'm working with SAP PI 7.1 I designed my interface IDOC-PI-HTTP. when i send idoc from R3 i see this message in PI monitor: HTTP server code 400 reason Bad Request explanation Bad Request i tried to configure a HTTP port in SM59 and

  • Regarding feature improvements between Primavera 7 and Primavera 8.2

    Here are couple of point I read that I need elaboration on- 1. Improved Security for Users with the Admin super-user Profile . Need to understand what new has been added to P8.2 to superadmn profile and how it helps. 2. Project Management has a new f

  • Split sales return document line items by price

    Hi,   I need to dynamically split line items in a sales return document based on certain conditions. The added line items would have the same material and details of the first line item but would be different only on return price. I tried to add line