Jdeveloper war deployment to tomcat - tomcat6

I am a newbie.
I am trying to publish procedures which return refcursor as webservice.
As webservices do not support ref cursor return type so I chnaged the return type to pl/sql table.
I created the jax rpc in Jdeveloper studio 11.1.2.4.0 and tested it. This runs ok. I need to deploy it on tomcat server and am failing completely.
I copied the war file generated by Jdeveloper to the webapps directory in Tomcat and started Tomcat but this didn't work, as the following exception was thrown:
java.lang.ClassCastException: omsdevconn.MyWebServicetomcatUser cannot be cast to javax.servlet.Servlet
If someone has done it then can I get the steps for the process to deploy it on Tomcat 6.0.37?
Thanks in advance

Download jaxws-rt-2.0-SNAPSHOT.jar and jaxws-2_0.jar
Copy into $CATALINA_HOME/lib folder
Add the following in web.xml under web-app
<web-app>
**<listener>
<listener-class>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>**
............<!--your other servlet definations-->
</web-app>
create sun-jaxws.xml under your applications web-inf folder and configure endpoints.You can have a look at jdeveloper generated xml file to get all the information
sample sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"version="2.0">
<endpoint name="fromwsdl"
interface="com.foo.yourserviceInterface"
implementation="com.foo.yourserviceClass"
wsdl="WEB-INF/wsdl/youservice.wsdl"
service="YourService"
port="YourServicePort"
url-pattern="/serviceAccessUrl" />
</endpoints>
create war for your application and deploy you application under tomcat/webapps
start tomcat
After starting tomcat you can access the service as
http:/host:port/yourservicename/methodInService
As you are calling oracle plsql code and IF you are using any oracle specific calls like OracleCallabelStatement then on run time you will get class cast exceptions from tomcat datasource when trying to cast callabelstatement to oraclecallabelstatement for that you need to configure oracledatasource in tomcat
http://www.oracle.com/technetwork/articles/oem/ucp-jdbc-tomcat-355431.html
More information on Java API for XML Web Services (JAX-WS)
https://jax-ws.java.net/nonav/2.2.1/docs/UsersGuide.html#1.0_Introduction

Another way to deploy service generated by Jdeveloper when exposing a plsql procedure as webservice
I am not allowed to post more that 2 links so please add and extra "/" after http: to correct the links
This solution uses Apache Axis which allows you to call your web service(which is not exposed as restful) directly from browser by creating a SOAP request behind the scenes and involke the service method giving it soap message.
1)Generate a webservice in Jdeveloper .It will create java files and corresponding ".class" file , "wsdl file" in web-inf and some other xml files. Make a note of LOCATION of .class file and wsdl file.
2)Download eclipse and extract it on your hard drive (It needs java to run So you must have java installed on system .You can download eclipse from
http:/www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/junosr1
3)Download Axis plugin for eclipse from here :
http:/www.apache.org/dyn/mirrors/mirrors.cgi/axis/axis2/java/core/1.6.2/axis2-eclipse-service-plugin-1.6.2.zip
and install it in eclipse. Installation Instructions :
http:/axis.apache.org/axis2/java/core/tools/eclipse/plugin-installation.html
4)Generate the aar file via eclipse axis plugin. Instructions :
http:/axis.apache.org/axis2/java/core/tools/eclipse/servicearchiver-plugin.html#Operation
5)Make following changes in tomcat-user.xml file
<role rolename="tomcat"/>
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<role rolename="manager-jmx"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat,manager-gui,admin-gui,manager-jmx"/>
6)IF YOU ARE USING ORACLE SPECIFIC CLASSES IN CODE (Which most probably Jdeveloper will produce) : Configure a oracle data source in tomcat (server.xml or context.xml). Instructions :
http:/www.oracle.com/technetwork/articles/oem/ucp-jdbc-tomcat-355431.html
Make sure you have ojdbc6.jar and ucp.jar in Tomcat/lib folder.
7)Download axis war file to deploy in tomcat from here :
http:/www.apache.org/dyn/mirrors/mirrors.cgi/axis/axis2/java/core/1.6.2/axis2-eclipse-service-plugin-1.6.2.zip
Unzip the zip , it will have a axis2.war file in it. Put this war file under “\Tomcat\webapps” directory
8)Start tomcat. On tomcat console see if there are any errors in deploying axis. If everything is fine you should be able to see axis page on http:/yourhost:yourport/axis2/
9)Click on Administration link . Enter user id “admin” and password “Axis2” and login
10)Click upload and browse to the location of aar file you generate in step 4 and upload. After it shows you success click on Available service. It takes a bit of time but you should be able to see you service.Click on service to see wsdl to verify
11)Call your service method from browser and cross your fingers and toes.
Note that the link to hit will be something Like
http:/yourhost:yourport/axis2/services/YourServiceName/serviceMethod?arg1=blah&
Make sure your got the arg names right.you should be able to see the correct names from wsdl

Related

Changing version of cxf on Service Mix

I want to change the version of cxf on Service Mix 7.0.1 where cxf version is 3.1.9 . Because of using Brave tracing that is implemented in 3.1.12 version of cxf.
So Is there a way to change the version of the CXF on Service Mix.
I have deleted manually everything in the system/apache/cxf folder that has 3.1.9 version and add a file with 3.2.5 version. But it is still not working. When I write feature:list all of the cxf dependencies are with 3.1.9 version...
Deleting files from the system folder won't work. It does not scan the system folder for files, but rather uses it as a cache to go looking for specific versions. You don't need to add new versions to system either because it will download them from the central maven repo it they arn't in system.
If it starts up without a data folder, it will install features & versions listed in org.apache.karaf.features.cfg
One would expect to be able to delete the data folder, change the version in org.apache.karaf.features.cfg & start it up, but I tried that and Camel was broken. Unsure why.
I find it easier to deal with it using the management console.
Install the management console by dropping the following xml file into the deploy folder:
<features name="features-murray" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.2.0">
<repository>mvn:io.hawt/hawtio-karaf/1.5.7/xml/features</repository>
<feature name="murray" version="1" install="auto">
<feature>hawtio-offline</feature>
</feature>
</features>
Then point your browser at http://localhost:8181/hawtio and login with SMX/SMX.
From OSGI/Features add the your new feature version with the plus button:
mvn:org.apache.cxf.karaf/apache-cxf/3.1.12/xml/features
It may take some time to install, because it downloads it from the net. I found it bounced me out of the management console also, but after logging back in I could uninstall the old cxf 3.1.9. It again logged me out of the management console, but after logging back in I had Camel active and CXF on 3.1.12.
No testing though - goodness knows what else is broken.

How to configure p6spy for mssql server with hibernate?

In our web application we are using spring, hibernate & sql server 2016 as db. We are using jndi to connect to the database. To record all the queries executed by hibernate I am trying to implement the p6spy.
Here are the changes I have made.
Changed the resource information from
<Resource name="jdbc/eportalcore" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;databaseName=eportal-core;"
username="eportaldbadmin"
password="P#ssw0rd"
maxTotal="100"
maxIdle="20"
minIdle="5"
maxWaitMillis="10000" />
to
<Resource name="jdbc/eportalcore" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.p6spy.engine.spy.P6SpyDriver"
url="jdbc:p6spy:sqlserver://localhost:1433/eportal-core"
username="eportaldbadmin"
password="P#ssw0rd"
maxTotal="100"
maxIdle="20"
minIdle="5"
maxWaitMillis="10000" />
and added the spy.properties file under lib folder of tomcat directory. Also I have placed the p6spy-3.0.0.jar too inside the lib folder.
But after this my application is not getting connected to the DB. What mistake I am doing here? If I remove this changes then it is working fine.
Any suggestions?
I had the same question and here is what I did to make it work. Note my Database connection properties are in a property file (shouldn't be an issue) and that I use tomcat as an Application Server. You can also add P6Spy as a Maven dependency in your project.
Before :
db.properties
db.driver=net.sourceforge.jtds.jdbc.Driver
db.url=jdbc:jtds:sqlserver://${db.server}/${db.name};useNTLMv2=true;domain=XX
After :
Download(latest version when writing this response) the project. Put the p6spy-3.7.0.jar and spy.properties in the tomcat/lib folder. Change the spy.properties and application properties as noted under. Restart application and you should find a spy.log where your logs are printed normally.
db.properties
db.driver=com.p6spy.engine.spy.P6SpyDriver
db.url=jdbc:p6spy:jtds:sqlserver://${db.server}/${db.name};useNTLMv2=true;domain=XX
spy.properties
driverlist=net.sourceforge.jtds.jdbc.Driver

Jenkins global configuration using REST API

I need to automate the jenkins installation and plugin configuration in order to configure 'jenkins global settings'. So i tried to configure the same from the remote machine through REST API. but it doesn't work for me.
My efforts:
http://:8080/config.xml
<?xml version='1.0' encoding='UTF-8'?>
<hudson>
<disabledAdministrativeMonitors/>
<version>1.653</version>
<numExecutors>2</numExecutors>
<mode>NORMAL</mode>
<useSecurity>true</useSecurity>
.................
.................
Default installation of Jenkins provides remote API only for:
retrieve information from Jenkins for programmatic consumption.
trigger a new build
create/copy jobs

Grails MS SQLServer 2008 jdbc driver causes problems in tomcat

What is the official way to use the microsoft jdbc driver for mssql in a grails application?
The general opinion that I found through googling is that I only have to drop the jar in the lib directory of the grails app. This works if I do a grails clean and grails compile --refresh-dependencies. But when I deploy on a real server I have two problems.
When redeploying there is this a warning in the logs.
24.05.2013 16:03:03 com.microsoft.sqlserver.jdbc.AuthenticationJNI
WARNUNG: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
I'm not sure if its something to care about since its a warning. But I would like to have my logs clean and I have the dll in the lib directory of the application just as google is saying. Additionally on redeployment there are several messages like this that might relate to the first one:
24.05.2013 16:03:02 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SCHWERWIEGEND: A web application created a ThreadLocal with key of type [org.codehaus.groovy.runtime.GroovyCategorySupport.MyThreadLocal] (value [org.codehaus.groovy.runtime.GroovyCategorySupport$MyThreadLocal#76fe8d1b]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
And the last thing is that my coworker said, that she thinks the driver should not be installed on a per application basis but directly into tomcat. I actually don't know how to do this, but if I did it, this would cause a problem on the development machine since I don't know how to get grails run-app going without the driver in the applications lib directory.
You can still place the library in the lib folder of your project and just exclude this from the war generation.
You don't need to exclude the jar everytime you build your project, just follow this post tip.
In your Tomcat server the jar will be placed in the shared lib folder instead of each web application.
If after that you still get the warning about sqljdbc_auth.dll you will need to locate this file and add the folder in the Tomcat classpath (or copy to Tomcat lib folder).

Unable to deploy app to App engine

I have a GWT based web application that I have previously uploaded to Appspot.
However now, I am getting this error:
Unable to update:
com.google.appengine.tools.admin.JspCompilationException: Failed to compile jsp files.
at com.google.appengine.tools.admin.Application.compileJsps(Application.java:583)
at com.google.appengine.tools.admin.Application.createStagingDirectory(Application.java:434)
at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:327)
at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:52)
at com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:400)
at com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:148)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
The application used JDK (not JRE)
There's a JSP file (dummy) on the war file
The application works in hosted mode
Do a clean build first. Alt+P, N in eclipse. If this fails, delete /war/WEB-INF/classes and try again. If this also fails, right click your war folder and select validate; this will tell you if there are any actual errors in your jsp files.
If this fails, your appengine jars may be corrupted. Try unzipping a fresh SDK and using it to deploy.
Also, have you changed java versions recently? Compiling JSPs requires JAVA_HOME points to a JDK, not a JRE. What is the result of echo $JAVA_HOME?
this thread will solve your problem
Cannot get the System Java Compiler. Please use a JDK, not a JRE
Other wise, you need to set your JAVA_HOME to point to your jdk folder and add javaw.exe path in your eclipse.ini

Resources