Deployment issue with JAX_WS Service

This topic contains 16 replies, has 3 voices, and was last updated by  Brian Fernandes 1 week, 6 days ago.

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #632278 Reply

    Mork
    Participant

    I am trying to deploy a JAX_WS service to Tomcat using Run As..My Eclipse Server Application.

    I have the JAX_WS 2.1 libraries added to the project, but when I deploy, about mid-deploy, I get the error stack below.

    See attached screenshot for project setup libraries.

    I can get the web service browser to work, but I believe because of the problem below, I get 404 errors when trying to use the exposed service methods.

    Would appreciate your input.

    Thanks,

    ——–

    SEVERE: Error configuring application listener of class [com.sun.xml.ws.transport.http.servlet.WSServletContextListener]
    java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1292)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1121)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:540)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:521)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4524)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5066)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:742)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1141)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1053)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:428)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1585)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:966)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
    Nov 22, 2019 8:06:10 AM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Skipped installing application listeners due to previous error(s)
    Nov 22, 2019 8:06:10 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
    Nov 22, 2019 8:06:10 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/JAX_WS_2020_ZIP] startup failed due to previous errors

    Attachments:
    You must be logged in to view attached files.
    #632320 Reply

    support-swapna
    Moderator

    Mork,

    Sorry that you are seeing this issue.

    Can you please recheck if the JAX-WS libraries are selected in the Build Path as shown in the attached screenshot?
    Double click on the JAX-WS entry in the Build Path page and check the ‘JAX-WS Implementation’ to include those jars as well and redeploy the project.

    Hope this helps. Please let us know how you get on with it.

    –Swapna
    Genuitec Support

    Attachments:
    You must be logged in to view attached files.
    #632322 Reply

    Mork
    Participant

    That’s strange. My build path files are different, though I’m on a Mac, not Windows.

    See attached. I do not have those files to check off as they seem to be part of some other library now.

    What do I need to do?

    Thanks,

    Attachments:
    You must be logged in to view attached files.
    #632385 Reply

    Mork
    Participant

    Have not received a reply to my reply above. Was wondering why I do not see the libraries to include on the Mac as you showed on the Windows version of MyE.

    I am currently still not able to deploy the service due to this issue.

    Hope to hear back soon.

    Thanks,

    #632623 Reply

    support-swapna
    Moderator

    Mork,

    Thank you for the screenshot.
    The entries you are seeing are part of Core libraries. Can you please double click on the ‘JAX-WS 2.1 Libraries’ entry, and in the opened window, select ‘JAX-WS Implementation’ to add those jars to the build path?

    Please see this gif to get a visual: https://gyazo.com/6f030dad4179f92b2ebfa113cc25c58f
    We assisted you with similar query in Jan.

    Hope this helps. Please let us know if you still see any issues.

    –Swapna
    Genuitec Support

    #632640 Reply

    Mork
    Participant

    Hello,

    Thanks for the help with the libs.

    I’m now having another issue.

    Specifically, although I specified the database driver in both persistence.xml (below) and in build properties (screen shot below) when I try to use either of the two methods in the web
    services explorer, I get this error stack:

    SEVERE: find by property name failed
    javax.persistence.PersistenceException: Exception [EclipseLink-4003] (Eclipse Persistence Services – 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException

    Exception Description: Configuration error. Class [com.mysql.cj.jdbc.Driver] not found.
    at org.eclipse.persistence.exceptions.DatabaseException.configurationErrorClassNotFound(DatabaseException.java:89)
    at org.eclipse.persistence.sessions.DefaultConnector.loadDriverClass(DefaultConnector.java:267)
    at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:85)
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:204)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:741)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:239)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:685)
    … 53 more

    I tried to move the JDBC driver manually to the lib folder in Tomcat since MyEclipse did not put it there but got the same error

    Here is my persistence.xml:

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <persistence version=”2.1″ xmlns=”http://xmlns.jcp.org/xml/ns/persistence” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd“>
    <persistence-unit name=”JAX_WS_2020_ZIP”
    transaction-type=”RESOURCE_LOCAL”>
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>ht.jpa.Zipcodes</class><properties>
    <property name=”javax.persistence.jdbc.driver” value=”com.mysql.cj.jdbc.Driver”/>
    <property name=”javax.persistence.jdbc.url” value=”jdbc:mysql://localhost:3306/ZipCodeLookup?autoReconnect=true&useSSL=false&serverTimezone=America/New_York”/>
    <property name=”javax.persistence.jdbc.user” value=”zipcodeuser”/>
    <property name=”javax.persistence.jdbc.password” value=”zipzip”/>
    </properties>
    </persistence-unit>
    </persistence>

    —-

    Attached are two screenshots:

    1. Build properties with database driver in build path
    2. WS Explorer (If I click the WSDL screenshot I get a blank screen)
    3. An odd error with no human-readable message

    Can you help me figure out what’s wrong?

    Thanks,

    Attachments:
    You must be logged in to view attached files.
    #632649 Reply

    Mork
    Participant

    I fixed the database error by copying the JAR file to the Tomcat bin folder. Is that step really necessary?

    I’m still having an issue where I’m trying to pass an Integer, but it’s not being accepted, but it’s mostly working now…

    The (minor) issue is that when I reverse engineer the entity class, the zipcode is an “Integer”. But when I create the web service project from the WSDL, the zipcode is a string so I’m not able to call this method.

    What’s the recommended way around this data disagreement problem?

    Thanks,

    • This reply was modified 2 weeks, 3 days ago by  Mork.
    #632653 Reply

    support-swapna
    Moderator

    Mork,

    Glad that you are all set.

    You can recheck if the added jar is set up for deployment in the Project’s Deployment Assembly page.
    Right click on the project > Properties > Deployment > Deployment Assembly. If the said jar is not listed here, you can click on ‘Add’ and if the jar is already on the Build Path, then select ‘Java Build Path Entries’ and add the jar to the list. Once you apply the changes, the jar should also be deployed as part of your project deployment.

    –Swapna
    Genuitec Support

    #632655 Reply

    Mork
    Participant

    I’ve attached what I see in the deployment tab. It’s not clear if this is correct.

    —–

    The (minor) issue I still have is that when I reverse engineer the entity class, the zipcode is an “Integer”. But when I create the web service project from the WSDL, the zipcode is a string so I’m not able to call this method without data type errors.

    What’s the recommended way around this data disagreement problem?

    • This reply was modified 2 weeks, 3 days ago by  Mork.
    • This reply was modified 2 weeks, 3 days ago by  Mork.
    Attachments:
    You must be logged in to view attached files.
    #632798 Reply

    support-swapna
    Moderator

    Mork,

    I tested it at my end and see no data disagreement problem when I created a Web Service using the WSDL for ZipCodes.
    Can you please share the sample project or the wsdl file to help us investigate further?

    –Swapna
    Genuitec Support

    #632813 Reply

    Mork
    Participant

    WSDL attached.

    When MYE reverse engineers the ZipCode class it creates: “private Integer zipcode;”

    When I create the web service client using the attached WSDL (created during service creation), it creates:

    {

    protected String theZip;

    /**
    * Gets the value of the theZip property.
    *
    * @return possible object is {@link String }
    *
    */
    public String getTheZip()
    {
    return theZip;
    }

    /**
    * Sets the value of the theZip property.
    *
    * @param value allowed object is {@link String }
    *
    */
    public void setTheZip(String value)
    {
    this.theZip = value;
    }

    }

    So, when I try to run this code in the test class in the client:

    `ZipCodeInfoService service = new ZipCodeInfoService();
    ZipCodeInfoDelegate delegate = service.getZipCodeInfoPort();
    System.out.println(delegate.getCitiesForZip(90210));`

    I get this error:

    Exception in thread “main” java.lang.Error: Unresolved compilation problem:
    The method getCitiesForZip(String) in the type ZipCodeInfoDelegate is not applicable for the arguments (int)

    at ht.ws.client.ClientTest.main(ClientTest.java:16)

    I’m baffled how you got yours to work since I’m just doing the generic steps.

    Is your ZipCode field an “int” in MySQL as mine is?

    Still not sure why I am seeing this error.

    Does this give you enough information to go on now?

    Thanks much in advance,

    Attachments:
    You must be logged in to view attached files.
    #632986 Reply

    Mork
    Participant

    Hello,

    It’s been about 24 hours since my last posting and I don’t see a reply yet. Perhaps you’ve been able to reproduce the problem I reported above and you are now conferring with the MyE developers?

    If that’s not the case, would you please explain what I need to change so I can finally get this service working? There is no real code I’ve written I’m asking you about. This is all MyEclipse and how it works and configures things though I could be making a mistake, of course.

    I gave you the requested information above.

    I created the web service using reverse DAO engineering.

    I ran it using Run as MyEclipse Application.

    I created the WS client using your tutorial online (using WSDL).

    One of the service methods does not work due to a data type mismatch. See my last posting above.

    Is deployment data type issue another bug in MyEclipse? I don’t recall having this problem in the past so hopefully there’s a simple solution.

    (Note: the reverse engineering from the MyEclipse perspective still does not work. Nothing happens when I click “OK” to reverse engineer DAOs. I’m stuck using the database perspective. I’ve tested on two macs with two different OSes).

    Hope to hear back shortly.

    Thanks,

    • This reply was modified 2 weeks, 1 day ago by  Mork.
    • This reply was modified 2 weeks, 1 day ago by  Mork.
    • This reply was modified 2 weeks, 1 day ago by  Mork.
    #633110 Reply

    Brian Fernandes
    Moderator

    Mork,

    I’m not really sure where to start – this isn’t “us all” doing exactly the same thing.

    1) Not sure if you’ve modified the database to include the PK (which you did say you did in the last thread), or reverted that change. Your DB structure changes what DAOs and classes will be produced.
    2) “I created a web service using reverse DAO engineering” – it’s not clear what you did here, we have several WS generation wizards, and then your input class (I’m presuming you meant the DAO) is possibly different from ours. My DAO is called ZipCodesDAO, I believe we already have a difference here where you’re getting ZipCodeInfoDAO – this is either a simple other name or a significantly different class.
    3) The next stage is generating a client from the WSDL (the WSDL I got is about 1000 lines from my DAO), can you be clear on which wizard and what options you chose?

    Like our reverse engineering code, this code has also been untouched for several years, and it is generating now what it did before. Perhaps you used it on a different class or specified different parameters.

    From your last thread you said you still have the source code that works online, but no longer in the current workspace. I would urge you to try and get that working again, figuring out what has changed there. I have recommended this as a step weeks ago, reiterating the fact that our wizards will not be generating new code for you, so regenerating everything, from the Persistece layer, to the Web Service and the Client desn’t seem to be a good use of your time – they would produce the same code, but in projects that have more recent libraries at most. You could just copy older code into the newer projects, skipping the generation steps. I’m not saying it generation shouldn’t work – I’m quite sure it does, but its ability to generate the code you’re expecting depends on a multitude of choices at your end.

    I extended our help to a web call as there’s just so much going on here, but given the fact that this isn’t allowed, not sure what else we can do. If you can provide a working project from which you are generating the WSDL, along with detailed screenshots (and project snapshots) at each step of the process all the way down to the client generation, we may be able to help.

    #633119 Reply

    Mork
    Participant

    Hi Brian,

    I emailed you a link to a video showing each step and the failure at the end. Of course I could be doing something wrong, I just don’t see what it is. I re-generated both the DAO code and the client service code multiple times. Same result. During one of the regeneration attempts, the string for “90210” was accepted in the ClientTest, but it still crashed with a runtime error saying it was expecting an Integer.

    In that email, I also included both the client and service code generated. (The zip is only 2.2 MB)

    In that email, I also included the SQL that generates the ZipCodes table.

    I think you now have everything I do.

    Does this help?

    Thanks in advance,

    – M

    • This reply was modified 2 weeks ago by  Mork.
    • This reply was modified 2 weeks ago by  Mork.
    #633161 Reply

    Brian Fernandes
    Moderator

    Mork,

    A key step missing from the video is how you generated the WSDL, and the ZipCodeInfo and ZipCodeInfoDelegate class. However, from what I can see, it looks like you’ve created the ZipCodeInfo class yourself, and generated the WSDL using Bottom up generation from ZipCodeInfo – is this correct?

    What seems like an obvious problem is that your getCitiesForZip method is taking a String argument for theZip:
    public String getCitiesForZip(String theZip). If you generated the WSDL from this, it would similarly code it to expect a String.

    You should change the parameter type to Integer in the above method, then regenerate the WSDL and the delegate (using bottom up). Keep the old WSDL around so you can see how it compares to the newer one. Now deploy the service with the freshly generated WSDL, and then generate the client from the WSDL.

Viewing 15 posts - 1 through 15 (of 17 total)
Reply To: Deployment issue with JAX_WS Service

You must be logged in to post in the forum log in