Forum Stats

  • 3,838,875 Users
  • 2,262,407 Discussions
  • 7,900,776 Comments

Discussions

How to deploy a RESTful web service on glassfish 4 server which is developed on jdeveloper 12.2.1 ?

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,587 Red Diamond
    edited Jul 14, 2017 5:16AM

    And what is the problem?

    Can you please be more specific with your question?

    Timo

  • Vikas Kukreti
    Vikas Kukreti Member Posts: 73
    edited Jul 18, 2017 8:21AM

    Hi Timo ,

    I have created RESTful service on Jdeveloper 12.2.1 by using this link  : https://blogs.oracle.com/imc/building-simple-java-ee-rest-service-using-oracle-jdeveloper-12c

    When I tried to deploy this EJB jar  on glassfish 4.0 server i am facing the error related to dataSource  :

    [2017-07-18T17:23:08.568+0530] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=164 _ThreadName=admin-listener(10)] [timeMillis: 1500378788568] [levelValue: 1000] [[

      Exception while preparing the app : Invalid resource : java:/app/jdbc/jdbc/fusionAppsDS__pm

    com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : java:/app/jdbc/jdbc/fusionAppsDS__pm

    at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:81)

    at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:62)

    at org.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:136)

    at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:589)

    at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)

    at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)

    at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)

    at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108)

    at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142)

    at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107)

    at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)

    at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)

    at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)

    at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)

    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:922)

    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:431)

    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)

    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)

    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)

    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)

    at java.security.AccessController.doPrivileged(Native Method)

    at javax.security.auth.Subject.doAs(Subject.java:360)

    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)

    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)

    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)

    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)

    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)

    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)

    at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:235)

    at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:257)

    at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:134)

    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.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)

    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)

    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)

    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)

    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)

    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)

    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)

    at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:224)

    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)

    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)

    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)

    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)

    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)

    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)

    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198)

    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946)

    at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:331)

    at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:318)

    at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:181)

    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)

    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)

    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)

    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)

    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)

    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)

    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)

    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)

    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)

    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)

    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)

    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)

    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)

    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)

    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)

    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)

    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)

    at java.lang.Thread.run(Thread.java:745)

    ]]

    Database Connection name I used in Jdeveloper is fusionApps

    My persistence.xml file is

    <?xml version="1.0" encoding="windows-1252" ?>

    <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                 xsichemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"

                 version="2.0">

      <persistence-unit name="EJBModel">

        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

        <jta-data-source>java:/app/jdbc/jdbc/fusionAppsDS</jta-data-source>

        <class>hrrestapplication.entities.Mdmg702</class>

        <properties>

          <property name="eclipselink.target-server" value="WebLogic_10"/>

          <property name="javax.persistence.jtaDataSource" value="java:/app/jdbc/jdbc/fusionAppsDS"/>

        </properties>

      </persistence-unit>

    </persistence>

    And On glassfish  I configured datasource for my EJB jar in domain.xml  as

    <jdbc-connection-pool non-transactional-connections="true" ping="true" datasource-classname="oracle.jdbc.xa.client.OracleXADataSource" name="fusionApps" res-type="javax.sql.XADataSource">

          <property name="User" description="MSDB" value="INFOSS"></property>

          <property name="MaxStatements" value="0"></property>

          <property name="DatabaseName" value="orcl"></property>

          <property name="NativeXA" value="false"></property>

          <property name="ImplicitCachingEnabled" value="false"></property>

          <property name="NetworkProtocol" value="tcp"></property>

          <property name="DataSourceName" value="OracleXADataSource"></property>

          <property name="LoginTimeout" value="0"></property>

          <property name="ServerName" value="103.206.131.187"></property>

          <property name="DriverType" value="thin"></property>

          <property name="PortNumber" value="1521"></property>

          <property name="ExplicitCachingEnabled" value="false"></property>

          <property name="Password" description="MSDB" value="INFOSS"></property>

        </jdbc-connection-pool>

        <jdbc-resource pool-name="fusionApps" description="bns" jndi-name="fusionAppsDS_pm"></jdbc-resource>

      </resources>

This discussion has been closed.