Weblogic10, BlazeDS, FlashBuilder4, Error setup remoting-service bind - blazeds

i am really not sure what else to try, any help will be appreciated. Thank you
1) I am using weblogic 10, flashbuilder4 eclipse plugin, everything is running off windows xp.
2) I deployed the blazeds tomcat samples on weblogic 10 and was able to successfully bind its remote-service to a new project DataGrid in fb4, everything works fine.
3) I then modified the samples to use my own java class. On the last step of the Data provider binding in fb4, when I select the destination and click on finish button it says:
"com.hello.test.ProductSearch is not available in the specified location. Try importing by unselecting the destniation productsearch"
I verified the class files are deployed properly on weblogic and http://localhost:7001/hello/messagebroker/amf doesnt show an error.
Also when i deploy the same file location to tomcat, it works fine. So to summarize:
1) BlazeDS sample works fine in both weblogic10 and tomcat
2) My com.hello.test.ProductSearch works fine in tomcat but gives above error in weblogic10.
So looks like issue is with weblogic 10 deployment, I am just using default standard weblogic10 deployment. Not sure what the problem is, been at it for days now.
------------------------------
remoting-config.xml
<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
<destination id="productsearch">
<properties>
<source>com.hello.test.ProductSearch</source>
</properties>
</destination>
services-config.xml
<services>
<service-include file-path="remoting-config.xml" />
<default-channels>
<channel ref="my-amf"/>
</default-channels>
</services>
<channels>
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
</channels>
<logging>
<!-- You may also use flex.messaging.log.ServletLogTarget -->
<target class="flex.messaging.log.ConsoleTarget" level="Error">
<properties>
<prefix>[BlazeDS] </prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>true</includeLevel>
<includeCategory>false</includeCategory>
</properties>
<filters>
<pattern>Endpoint.*</pattern>
<pattern>Service.*</pattern>
<pattern>Configuration</pattern>
</filters>
</target>
</logging>
<system>
<redeploy>
<enabled>true</enabled>
<watch-interval>20</watch-interval>
<watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-fi le>
<watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-fi le>
<touch-file>{context.root}/WEB-INF/web.xml</touch-file>
</redeploy>
</system>
ProductSearch.java
package com.hello.test;
import java.util.ArrayList;
import java.util.List;
public class ProductSearch
{
public AttributeVO[] search()
{
List<AttributeVO> retList = new ArrayList<AttributeVO>();
retList.add(new AttributeVO("one","two", "three","four"));
retList.add(new AttributeVO("five","six", "seven","eight"));
return retList.toArray(new AttributeVO[retList.size()]);
}
}
AttributeVO.java
package com.hello.test;
import java.io.Serializable;
public class AttributeVO implements Serializable
{
static final long serialVersionUID = 1L;
private String val1;
private String val2;
private String val3;
private String val4;
public AttributeVO()
{}
etc... all get getter/setters
}

SOLVED. I compiled the server side java using jdk 1.6, apparently the latest version of blazeDS isnt compatible with 1.6 (of course it doesnt just tell you, that would be too easy).
Once i recompiled using jdk 1.5 everything worked.
Talk about frustration..

Related

set contextpath for EJB3 webservice on Weblogic 11g

I build a web service with ejb3 and maven (EAR File),code First, JAXWS, Without WSDL and without WAR, only ejb, with Eclipse, the service works in JBOSS but now i need put the service in Weblogic 11g.
With JBOSS i have the annotation
#WebContext(contextRoot="/wsManCa7", urlPattern="/manCA7WS")
But on Weblogic not, I found this link http://erikwramner.wordpress.com/2012/03/26/ejb3-web-service-context-path-in-weblogic-11g/ to create weblogic-webservices.xml and webservices.xml I put the files inside the META-INF of the jar (And JAr inside EAR) but web logic throws this error
Servlet: "WSEE_SERVLET" failed to preload on startup in Web application:
"/ManCA7". com.sun.xml.ws.server.ServerRtException: Port namespace
http://someserver.com/ManCA7 doesnt match Service namespace {1} at
com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:160) at
com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:496) at
com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:539) at
weblogic.wsee.jaxws.JAXWSDeployedServlet.getEndpoint(JAXWSDeployedServlet.java:183) at
weblogic.wsee.jaxws.JAXWSServlet.registerEndpoint(JAXWSServlet.java:138) at
weblogic.wsee.jaxws.JAXWSServlet.init(JAXWSServlet.java:67) at ....
I understand the problem is this tag
<wsdl-port xmlns:ws="http://someserver.com/ManCA7">ws:ManCA7Port</wsdl-port>
But which is the required Service namespace???
I don't know what put inside the tag :(
my webservices.xml is
<?xml version="1.0" encoding="UTF-8"?>
<webservices xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2">
<webservice-description>
<webservice-description-name>ManCA7</webservice-description-name>
<port-component>
<port-component-name>ManCA7Port</port-component-name>
<wsdl-port xmlns:ws="http://someserver.com/ManCA7">ws:ManCA7Port</wsdl-port>
<service-endpoint-interface>my.company.manCA7.sei.ManCa7SEI</service-endpoint-interface>
<service-impl-bean>
<ejb-link>ManCa7EndPoint</ejb-link>
</service-impl-bean>
</port-component>
</webservice-description>
</webservices>
And my weblogic-webservices.xml is
<?xml version = '1.0' encoding = 'UTF-8'?>
<weblogic-webservices xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-webservices
http://www.bea.com/ns/weblogic/weblogic-webservices/1.0/weblogic-webservices.xsd"
xmlns="http://www.bea.com/ns/weblogic/weblogic-webservices">
<webservice-description>
<webservice-description-name>ManCA7</webservice-description-name>
<webservice-type>JAXWS</webservice-type>
<port-component>
<port-component-name>ManCA7Port</port-component-name>
<service-endpoint-address>
<webservice-contextpath>/ManCA7</webservice-contextpath>
<webservice-serviceuri>/Mant</webservice-serviceuri>
</service-endpoint-address>
<wsdl>
<exposed>true</exposed>
</wsdl>
</port-component>
</webservice-description>
</weblogic-webservices>
And my EJB expose the service with this
#WebService(endpointInterface = "my.company.manCA7.sei.ManCa7SEI")
#TransactionManagement(TransactionManagementType.CONTAINER)
#Stateless
public class ManCa7EndPoint implements ManCa7SEI{
private final Logger logger = LoggerFactory.getLogger(ManCa7EndPoint.class);
.
.
.
I Found the Solution...
In the annotation webservice I put the same namespace of webservices.xml and worked !!
Inside webservices.xml
<wsdl-port xmlns:ws="http://someserver.com/ManCA7">ws:ManCA7Port</wsdl-port>
Inside EJB
#WebService(endpointInterface = "my.company.manCA7.sei.ManCa7SEI",targetNamespace = "http://someserver.com/ManCA7")
#TransactionManagement(TransactionManagementType.CONTAINER)
#Stateless
public class ManCa7EndPoint implements ManCa7SEI{
The solution was targetNamespace = "http://someserver.com/ManCA7"

Setting disableCNCheck using Grails Cxf Client Plugin

I'm trying to set disableCNCheck to true for my web service. I'm using Grails 2.2.0 with the Cxf Client plugin.
I found this question:
wsdl2java CXF command line error about disableCNCheck option
with this piece of code:
protected void disableCNCheck(Object port) {
Client client = ClientProxy.getClient(port)
TLSClientParameters params = new TLSClientParameters()
params.setDisableCNCheck(true)
HTTPConduit httpConduit = (HTTPConduit) client?.getConduit()
httpConduit?.setTlsClientParameters(params)
}
In which class would this code belong and where would the method be called? Is there a configuration parameter for the Cxf Client plugin that I could set instead?
Instead of the code you can achieve the disableCNCheck by adding the below xml config to grails-app/conf/spring/resources.xml [ Grails 2.2.3 , cxf-client plugin 1.6.1
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
">
<http:conduit name="*.http-conduit">
<http:tlsClientParameters disableCNCheck="true" />
</http:conduit>
</beans>

How to disable scanning #WebService annotations in JBoss AS 7?

I have web services developed using Spring+ApacheCXF and I need tod eploy them on JBoss AS7.
They are being deployed by CXFServlet properly.
But JBoss AS7 also deploying them by scanning #WebService annotations(as expected without Spring Injection).
How to disable scanning #WebService annotations in JBoss AS 7?
PS: I am deploying as a .war file.
PS PS:
My current cxf webservices are being deployed properly. But JBoss AS7 also trying to scan #WebService classes and deploying them also(without dependencies injected).I am looking for a way to turn of JBossAS7's scanning for #WebService classes.
This applies for Jboss 6 as well. I tried it on my Jboss 6.2.2.
Comment the following in standalone.xml
<!-- <extension module="org.jboss.as.webservices"/> -->
Then comment the below snippet in the same standalone.xml. Note if you are using different profile name or in domain mode you will have to do it at similar places.
<!--
<subsystem xmlns="urn:jboss:domain:webservices:1.2">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
<client-config name="Standard-Client-Config"/>
</subsystem>
-->
I believe you will want to remove this from your standalone.xml
<extension module="org.jboss.as.webservices"/>
and
<subsystem xmlns="urn:jboss:domain:webservices:1.1">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
</subsystem>
This is what I did to remove the jboss webservices so I could use something else. I'm still in the middle of testing this but it is no longer deploying the services. I assume I will just be able to use spring to deploy. Hope this helps.
I am using exclude-filter in my application context XML file to exclude web service components from Spring component scan.
<context:component-scan base-package="your.application.base.package">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
<context:exclude-filter type="annotation" expression="javax.jws.WebService" />
</context:component-scan>
At the same time I include them in component scan in CXF context XML.
I'm using JBoss EAP 6.1 and i solved the same problem excluding the subsystems jaxrs and webservices.
jboss-deployment-structure.xml
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
<subsystem name="webservices" />
</exclude-subsystems>
<exclusions>
<module name="javaee.api" />
<module name="org.apache.log4j" />
</exclusions>
<dependencies>
<module meta-inf="export" name="com.liferay.portal">
<imports>
<include path="META-INF" />
</imports>
</module>
<module name="javax.mail.api" />
<module name="org.jboss.modules" />
</dependencies>
</deployment>
</jboss-deployment-structure>

javaee 5 bookstore sample to run with jboss 4.0 and hibernate

when i am trying to deploy bookstore1 web application from Netbeans ( JavaEE5 sample ) , i have changed the persistence.xml file to use hibernate :
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="book" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jdbc/BookDB</jta-data-source>
<class>com.sun.bookstore.database.Book</class>
</persistence-unit>
</persistence>
and my mysql-ds.xml file is :
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/BookDB</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/bookdb</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>1234</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
I am getting below error:
[STDOUT] Couldn't create bookstore database bean: null
19:16:53,846 INFO [[/bookstore1]] Marking servlet ShowCartServlet as unavailable
19:16:53,846 ERROR [[ShowCartServlet]] Allocate exception for servlet ShowCartServlet
javax.servlet.UnavailableException: Couldn't get database.
at com.sun.bookstore1.servlets.ShowCartServlet.init(ShowCartServlet.java:39)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
19:17:17,534 INFO [[ShowCartServlet]] Servlet ShowCartServlet is currently unavailable
Can you please let me know where i am making wrong...
JBoss 4.0.x is not a JavaEE5 appserver, it's much too old - it only supports J2EE 1.4
This may not be the problem (it's impossible to tell from the info you've given us), but there's no point continuing with the JavaEE5 sample and JBoss 4.0.x, it just won't work.
You either need to use the J2EE 1.4 sample app, or upgrade your JBoss (to version 5 or 6).

Build a WS with Spring

I need to create a WS with Spring 3.0.4.RELEASE to run in a Tomcat with Axis2. I'm following this doc: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html#remoting-web-services-jaxws-export-ri (if that paragraph can be called "doc")
Ok, here are the details:
The java class:
package foo;
#WebService(serviceName="MyService")
public class MyService{
#WebMethod
public String getString(){
return "Hello StackOverflow";
}
}
The WEB-INF/spring-ws.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://jax-ws.dev.java.net/spring/core https://jax-ws.dev.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet https://jax-ws.dev.java.net/spring/servlet.xsd">
<wss:binding url="/myService" service="#myService" />
<ws:service id="myService"
impl="foo.MyService" />
</beans>
The WEB-INF/web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="myService" 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">
<display-name>my Service</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-ws.xml</param-value>
</context-param>
<!-- this is for Spring -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- these are for JAX-WS -->
<servlet>
<servlet-name>jaxws-servlet</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>jaxws-servlet</servlet-name>
<url-pattern>/myService</url-pattern>
</servlet-mapping>
And last, but not less important, the error when I start tomcat 6.0.29:
Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://jax-ws.dev.java.net/spring/servlet]
Offending resource: ServletContext resource [/WEB-INF/spring-ws.xml]
Someone has any clue of what is happening? Is all the configuration correct? Does anyone have a simple (working) WS to show how to deploy a WS using Spring?
Thanks in advance
I also experience this issue a while back and figured out the problem is with the "https://". Change it back to http:// and you should be good to go. But when you use http:// you get a schema validation error in eclipse because eclipse can't automatically redirect schema url from http:// to https://. And apparently netbeans is capable of it.
One more thing. You'll have to have the xbeans-spring as well. I honestly think that's a pretty stupid dependency.