Petals Starting Guide - day 4 (Jsr-181)

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Petals Starting Guide - day 4 (Jsr-181)

Mathieu Le Breton
Administrator
This post was updated on .
Any question about the day-4 tutorial?
Post it here!

This thread might be empty for some time. But if you are here, it's because we can help.
Please start writing now. We will be more than happy to help.

I want to receive the Petals Starting Guide (for free)
Petals Link
Reply | Threaded
Open this post in threaded view
|

Re: Petals Starting Guide - day 4 (Jsr-181) THE HELLOWORLD TEST IS NOT WORKING ...

petaleRose
Good morning,
i'm using petals 1.3.1.

Could you please help me know why after having successfully done the foolowing steps :

deploy Jsr181 HelloWorld:

Fast-Export su-jsr181-HelloWorld-provide for Petals.
Download Petals-SE-Jsr181.
Deploy Petals-SE-Jsr181 in Petals ESB.
Deploy su-jsr181-HelloWorld-provide.zip in Petals ESB.
Test HelloWorld:

Go to Webconsole > Server:0 > Test > Send.
Send a few test messages to HelloWorldPort Endpoint. Use MEP InOut for helloWorld operation


i get this error notice:

Petals service error
Message :
javax.jbi.messaging.MessagingException: DeliveryChannel is closed
Cause :
An internal error occured. Your request didn't complete.
SEE DETAILS
CONTINUE
org.ow2.opensuit.core.error.NonLocalizedError: [Petals service error] javax.jbi.messaging.MessagingException: DeliveryChannel is closed
org.ow2.petals.tools.webconsole.uibeans.RMIInjectorUIBean.send(RMIInjectorUIBean.java:492)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.ow2.opensuit.cel.impl.tree.impl.ast.AstInvocation.invoke(AstInvocation.java:146)
org.ow2.opensuit.cel.impl.tree.impl.ast.AstMethod.invoke(AstMethod.java:136)
org.ow2.opensuit.cel.impl.tree.impl.ast.AstEval.invoke(AstEval.java:59)
org.ow2.opensuit.core.expression.ExpressionUtils.invokeExpression(ExpressionUtils.java:119)
org.ow2.opensuit.xml.base.binding.Expression.invoke(Expression.java:147)
org.ow2.opensuit.xml.base.action.DoAndForward.invoke(DoAndForward.java:141)
org.ow2.opensuit.xml.base.html.form.EditForm.submit(EditForm.java:152)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.ow2.opensuit.xml.base.Application.service(Application.java:514)
org.ow2.opensuit.core.impl.j2ee.OpenSuitServlet.service(OpenSuitServlet.java:155)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
org.ow2.petals.tools.webconsole.services.PetalsServiceException: javax.jbi.messaging.MessagingException: DeliveryChannel is closed
org.ow2.petals.tools.webconsole.services.rmiinjector.RmiInjectorServiceImpl.createMessageExchange(RmiInjectorServiceImpl.java:484)
org.ow2.petals.tools.webconsole.services.rmiinjector.RmiInjectorServiceImpl.sendSynch(RmiInjectorServiceImpl.java:179)
org.ow2.petals.tools.webconsole.services.rmiinjector.RmiInjectorServiceImpl.injectMessage(RmiInjectorServiceImpl.java:156)
org.ow2.petals.tools.webconsole.business.RMIInjectorBBean.send(RMIInjectorBBean.java:110)
org.ow2.petals.tools.webconsole.uibeans.RMIInjectorUIBean.send(RMIInjectorUIBean.java:482)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.ow2.opensuit.cel.impl.tree.impl.ast.AstInvocation.invoke(AstInvocation.java:146)
org.ow2.opensuit.cel.impl.tree.impl.ast.AstMethod.invoke(AstMethod.java:136)
org.ow2.opensuit.cel.impl.tree.impl.ast.AstEval.invoke(AstEval.java:59)
org.ow2.opensuit.core.expression.ExpressionUtils.invokeExpression(ExpressionUtils.java:119)
org.ow2.opensuit.xml.base.binding.Expression.invoke(Expression.java:147)
org.ow2.opensuit.xml.base.action.DoAndForward.invoke(DoAndForward.java:141)
org.ow2.opensuit.xml.base.html.form.EditForm.submit(EditForm.java:152)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.ow2.opensuit.xml.base.Application.service(Application.java:514)
org.ow2.opensuit.core.impl.j2ee.OpenSuitServlet.service(OpenSuitServlet.java:155)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
javax.jbi.messaging.MessagingException: DeliveryChannel is closed
org.ow2.petals.jbi.messaging.exchange.DeliveryChannelImpl.checkDeliveryChannelIsOpened(DeliveryChannelImpl.java:149)
org.ow2.petals.jbi.messaging.exchange.MessageExchangeFactoryImpl.createExchange(MessageExchangeFactoryImpl.java:240)
org.ow2.petals.jbi.messaging.exchange.MessageExchangeFactoryImpl.createInOnlyExchange(MessageExchangeFactoryImpl.java:183)
org.objectweb.petals.tools.rmi.server.remote.implementations.RemoteMessageExchangeFactoryImpl.createInOnlyExchange(RemoteMessageExchangeFactoryImpl.java:161)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
sun.rmi.transport.Transport$1.run(Transport.java:177)
sun.rmi.transport.Transport$1.run(Transport.java:174)
java.security.AccessController.doPrivileged(Native Method)
sun.rmi.transport.Transport.serviceCall(Transport.java:173)
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
sun.rmi.server.UnicastRef.invoke(Unknown Source)
org.objectweb.petals.tools.rmi.server.remote.implementations.RemoteMessageExchangeFactoryImpl_Stub.createInOnlyExchange(Unknown Source)
org.ow2.petals.tools.webconsole.services.rmiinjector.RmiInjectorServiceImpl.createMessageExchange(RmiInjectorServiceImpl.java:374)
org.ow2.petals.tools.webconsole.services.rmiinjector.RmiInjectorServiceImpl.sendSynch(RmiInjectorServiceImpl.java:179)
org.ow2.petals.tools.webconsole.services.rmiinjector.RmiInjectorServiceImpl.injectMessage(RmiInjectorServiceImpl.java:156)
org.ow2.petals.tools.webconsole.business.RMIInjectorBBean.send(RMIInjectorBBean.java:110)
org.ow2.petals.tools.webconsole.uibeans.RMIInjectorUIBean.send(RMIInjectorUIBean.java:482)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.ow2.opensuit.cel.impl.tree.impl.ast.AstInvocation.invoke(AstInvocation.java:146)
org.ow2.opensuit.cel.impl.tree.impl.ast.AstMethod.invoke(AstMethod.java:136)
org.ow2.opensuit.cel.impl.tree.impl.ast.AstEval.invoke(AstEval.java:59)
org.ow2.opensuit.core.expression.ExpressionUtils.invokeExpression(ExpressionUtils.java:119)
org.ow2.opensuit.xml.base.binding.Expression.invoke(Expression.java:147)
org.ow2.opensuit.xml.base.action.DoAndForward.invoke(DoAndForward.java:141)
org.ow2.opensuit.xml.base.html.form.EditForm.submit(EditForm.java:152)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.ow2.opensuit.xml.base.Application.service(Application.java:514)
org.ow2.opensuit.core.impl.j2ee.OpenSuitServlet.service(OpenSuitServlet.java:155)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)


please help me i would like to come forward with this tutorial.

Reply | Threaded
Open this post in threaded view
|

Re: Petals Starting Guide - day 4 (Jsr-181) THE HELLOWORLD TEST IS NOT WORKING ...

Vincent Zurczak
Hi,

Did you install the RMI SE component in Petals?
Did the FTP service invocation worked in the previous parts of the tutorial?
« Petals M.D. »
Reply | Threaded
Open this post in threaded view
|

Re: Petals Starting Guide - day 4 (Jsr-181) THE HELLOWORLD TEST IS NOT WORKING ...

petaleRose
Tank you for the fast answer.

Yes, i istall the RMI SE component in Petals. No, the FTP service invocation didn't
work in the tutorial #3. By testing the service "FTPtutorial", with ALL parameters properly set, i  got the following error:

Message :
    An internal error occured. Your request didn't complete.
java.lang.IllegalStateException: zip file closed

    java.util.zip.ZipFile.ensureOpen(ZipFile.java:415)
    java.util.zip.ZipFile.getEntry(ZipFile.java:160)
    java.util.jar.JarFile.getEntry(JarFile.java:208)
    java.util.jar.JarFile.getJarEntry(JarFile.java:191)
    sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:757)
    sun.misc.URLClassPath.getResource(URLClassPath.java:169)
    java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    org.ow2.petals.system.classloader.ComponentClassLoader.loadClass(ComponentClassLoader.java:129)
    java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    org.objectweb.petals.tools.rmi.server.remote.implementations.RemoteDeliveryChannelImpl.createExchangeFactory(RemoteDeliveryChannelImpl.java:223)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:303)
    sun.rmi.transport.Transport$1.run(Transport.java:159)
    java.security.AccessController.doPrivileged(Native Method)
    sun.rmi.transport.Transport.serviceCall(Transport.java:155)
    sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
    sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
    sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
    java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    java.lang.Thread.run(Thread.java:662)
    sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
    sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
    sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
    org.objectweb.petals.tools.rmi.server.remote.implementations.RemoteDeliveryChannelImpl_Stub.createExchangeFactory(Unknown Source)
    org.ow2.petals.tools.webconsole.services.rmiinjector.RmiInjectorServiceImpl.createMessageExchange(RmiInjectorServiceImpl.java:397)
    org.ow2.petals.tools.webconsole.services.rmiinjector.RmiInjectorServiceImpl.sendSynch(RmiInjectorServiceImpl.java:179)
    org.ow2.petals.tools.webconsole.services.rmiinjector.RmiInjectorServiceImpl.injectMessage(RmiInjectorServiceImpl.java:156)
    org.ow2.petals.tools.webconsole.business.RMIInjectorBBean.send(RMIInjectorBBean.java:110)
    org.ow2.petals.tools.webconsole.uibeans.RMIInjectorUIBean.send(RMIInjectorUIBean.java:482)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.ow2.opensuit.cel.impl.tree.impl.ast.AstInvocation.invoke(AstInvocation.java:146)
    org.ow2.opensuit.cel.impl.tree.impl.ast.AstMethod.invoke(AstMethod.java:136)
    org.ow2.opensuit.cel.impl.tree.impl.ast.AstEval.invoke(AstEval.java:59)
    org.ow2.opensuit.core.expression.ExpressionUtils.invokeExpression(ExpressionUtils.java:119)
    org.ow2.opensuit.xml.base.binding.Expression.invoke(Expression.java:147)
    org.ow2.opensuit.xml.base.action.DoAndForward.invoke(DoAndForward.java:141)
    org.ow2.opensuit.xml.base.html.form.EditForm.submit(EditForm.java:152)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.ow2.opensuit.xml.base.Application.service(Application.java:514)
    org.ow2.opensuit.core.impl.j2ee.OpenSuitServlet.service(OpenSuitServlet.java:155)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1805)
    java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    java.lang.Thread.run(Thread.java:662)


What can be the reason to that?


Thankk you.
Reply | Threaded
Open this post in threaded view
|

Re: Petals Starting Guide - day 4 (Jsr-181) THE HELLOWORLD TEST IS NOT WORKING ...

petaleRose
In fact, the problem lied on the rights on the device where my petals folders and the rest are saved! I had to change them to "full access" for the webconsole to be able to access my *.zip file and now it works!!!


Have a GOOD day!
Reply | Threaded
Open this post in threaded view
|

Re: Petals Starting Guide - day 4 (Jsr-181) THE HELLOWORLD TEST IS NOT WORKING ...

petaleRose
In reply to this post by Vincent Zurczak
It is working now!! See my last post. Just a problem with the access rights on the petals folder.

 
Reply | Threaded
Open this post in threaded view
|

Petals Starting Guide - day 4 (Jsr-181): Java to WSDL -> NOT WORKING

petaleRose
In reply to this post by Mathieu Le Breton
Dear Sir, i have written few methods retrieving and writing some data in mysql database and i got one error: "1 error occured during the generation process. Check the log for more details".

But There is NOTHING like an error in the Log and generating the wsdl file out of the java class is not working at all.

Here is my program with the methods...

Id_booker.java
******************

// variable for the connection
                private  Connection conn = null;
                private  Statement  statement = null;
                private  ResultSet result = null;
                private  int id;
                private  String msg;

                /**
                 *
                 */
       
            @WebMethod( operationName="getConnection" )
            @WebResult( name="returngetConnection" )
            public  Connection getConnection() throws Exception {
                 
                        try{
                                String driver = "com.mysql.jdbc.Driver";
                            String url = "jdbc:mysql://localhost:3306/id_manager";
                            String username = "root";
                            String password = "petals";
                            Class.forName(driver);
                            Connection conn = DriverManager.getConnection(url, username, password);    
                               
                        }catch(Exception e) // has to be checked properly!
                        {
                                e.printStackTrace();
                                System.out.println("Http 500: Server error due to a database access error or to the fact that this method is called on a closed connection");
                                //throw e;
                        }
                       
                   
                    return conn;
            }
           
           
            @WebMethod( operationName="ChekIdDatabase" )
            @WebResult( name="returnChekIdDatabase" )
            public boolean ChekIdDatabase(int id) throws Exception
                {
                        boolean res = false;
                       
                        try
                        {
                                String query = "";
                                conn = getConnection();
                                statement = conn.createStatement();
                                query = "SELECT * FROM `msg_storage` where id = "+id;
                                result = statement.executeQuery(query);
                                result.last(); //pointing the cursor on the last row only then the number of rows/match can be read!
                               
                                if(result.getRow()!=0){
                                        res = true;
                                }
                               
                        } catch (Exception e)
                        {
                                 e.printStackTrace();
                                 throw e;
                        }
                        finally
                        {
                                close();
                        }
                       
                        return res;
                }
           
           
            /**
                 * stores the id in the DB
                 *
                 * @param id is the id to be stored
                 * @param msg is the matching message to be stored
                 * @return in String "http 200" if successful or "http 500" if an error
                 * occured while writing in the DB
                 */
            @WebMethod( operationName="WriteIdDatabase" )
            @WebResult( name="returnWriteIdDatabase" )
                public String WriteIdDatabase(int id, String msg) throws Exception
                {
                        String res = "http 200 The id '"+id+"' has been stored sucessfully!"; // successful
                        try
                        {
                                if(ChekIdDatabase(id)== false)
                                {
                                        System.out.println("\n Id has NEVER been booked in the DB !");
                                        String query = "";
                                        conn = getConnection();
                                        statement = conn.createStatement();
                                        query = "INSERT INTO `id_manager`.`msg_storage` (`id`, `msg`) VALUES ('"+id+"', 'message-"+id+"');";
                                        int var = statement.executeUpdate(query);
                                        System.out.println("\n"+var +" row affected");
                                }else
                                {
                                        res = "The id '"+id+"' is already stored in the DB. It can not be done twice! ";
                                }
                               
                        } catch (Exception e) {
                                 e.printStackTrace();
                               
                                 throw e;
                        } finally {
                                close();
                        }
                        return res;
                }
               
               
           
            /**
                 * close all the opened connections to the DB
                 */
            @WebMethod( operationName="close" )
            @Oneway
                public void close()
                {
                        try {
                                if (result != null) {
                                        result.close();
                                }

                                if (statement != null) {
                                        statement.close();
                                }

                                if (conn != null) {
                                        conn.close();
                                }
                        } catch (Exception e) {

                        }
                       
                }

Can somebody please help me find out why generating a wsdl file out of this java class is not working? Have i forgotten some driver for mysql... or something like this... because, i got NO ERROR inserting "import java.sql.*".

Please i would really like to uderstand.

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Petals Starting Guide - day 4 (Jsr-181): Java to WSDL -> NOT WORKING

Vincent Zurczak
Hi,

First, this is not really a question about the tutorial, but rather about the JSR-181. The tutorial does not try to insert anything in a database.
And second, only posting the class code will not help a lot.

Could you create another topic for this?
And could you indicate what was logged in the studio about the WSDL's generation? If required, enable the traces in the preferences (Window > Preferences > Petals, JAXWS options).
« Petals M.D. »