[JBoss Web Services Development] - Re: Cannot find ServiceFactory implementation Problem
by marco gentile
marco gentile [https://community.jboss.org/people/marklenders] created the discussion
"Re: Cannot find ServiceFactory implementation Problem"
To view the discussion, visit: https://community.jboss.org/message/762999#762999
--------------------------------------------------------------
Hi,
thanks for your replies.
I achieved to create a java client (java project) to connect to SugarCRM, without errors.
Below, I write a snippet of code:
-------------------------------------------------
....
import javax.xml.rpc.ServiceFactory;
....
String sessionID = null;
try {
// Create a URL end point for the client
URL wsdlUrl = null;
if (END_POINT_URL.isEmpty()) {
wsdlUrl = new URL(
new SugarsoapLocator().getsugarsoapPortAddress()
+ "?wsdl");
} else {
wsdlUrl = new URL(END_POINT_URL);
}
System.out.println("URL endpoint created successfully!");
// Create Service for test configuration
*+ServiceFactory serviceFactory = ServiceFactory.newInstance();+*
Service service = serviceFactory.createService(wsdlUrl,
new SugarsoapLocator().getServiceName());
System.out.println("Service created successfully");
System.out.println("Service Name:"
+ service.getServiceName().toString());
System.out.println("Service WSDL:"
+ service.getWSDLDocumentLocation().toString());
// Trying to create a stub
SugarsoapBindingStub binding = new SugarsoapBindingStub(wsdlUrl,
service);
binding.setTimeout(TIMEOUT);
System.out.println("Stub created successfully!");
/**
* Try to login on SugarCRM
*
* 1) Prepare a MD5 hash password 2) Prepare a User Auth object 3)
* Execute login
*/
// 1. Prepare a MD5 hash password
MessageDigest messageDiget = MessageDigest.getInstance("MD5");
messageDiget.update(USER_PASSWORD.getBytes());
// 2. Prepare a User Auth object
User_auth userAuthInfo = new User_auth();
userAuthInfo.setUser_name(USER_NAME);
userAuthInfo.setPassword((new BigInteger(1, messageDiget.digest()))
.toString(16));
userAuthInfo.setVersion("0.1");
try {
// 3. Execute login
Set_entry_result loginResult = binding.login(userAuthInfo,
APPLICATION_NAME);
System.out.println("Login Successfully for " + USER_NAME);
System.out.println("Your session Id: " + loginResult.getId());
sessionID = loginResult.getId();
} catch (RemoteException ex) {
System.out.println("Login failed. Message: " + ex.getMessage());
ex.printStackTrace();
}
-------------------------------------------------
I created an eclipse web project, using JBoss 7.1.1 Final version as server.
I created a "login.xhtml" page.. submit button launches a function that belongs to "Login" class.. this function includes upper code.
When I debug my project on server, eclipse reports this error:
-------------------------------------------------
17:33:54,550 INFO [stdout] (http-localhost-127.0.0.1-8080-2) URL endpoint created successfully!
17:33:55,803 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) javax.xml.rpc.ServiceException: Failed to create factory: org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl
17:33:55,807 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.xml.rpc.ServiceFactory.newInstance(ServiceFactory.java:110)
17:33:55,811 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.brokers.sib.Login.authorization(Login.java:78)
17:33:55,814 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.brokers.sib.Login$Proxy$_$$_WeldClientProxy.authorization(Login$Proxy$_$$_WeldClientProxy.java)
17:33:55,817 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:33:55,821 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
17:33:55,824 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
.....
-------------------------------------------------
https://community.jboss.org/people/asoldano Alessio Soldano I follow your hints but nothing changes. I hope to have given you more info.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/762999#762999]
Start a new discussion in JBoss Web Services Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 6 months
[JBoss AS 7 Development] - Class Loading and Modules
by Bill Rosenberg
Bill Rosenberg [https://community.jboss.org/people/bill.rosenberg] created the discussion
"Class Loading and Modules"
To view the discussion, visit: https://community.jboss.org/message/763029#763029
--------------------------------------------------------------
here is my deployment outline for AS7:
JB7.ear
--jboss-deployment-structure.xml
--JB7EJB.jar
--JB7Web.war
--JB7Dao.jar
I have a question regarding AS7 module class loading. I am trying to use the quartz library and setup a module to
do so. I updated the jboss-deployment-structure.xml to look like this after setting up my quartz module
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<deployment>
<dependencies>
<module name="org.hibernate" slot="3" />
<module name="org.quartz" />
</dependencies>
</deployment>
</jboss-deployment-structure>
when i deploy and run the app a getthis exception:
Caused by: java.lang.NoClassDefFoundError: org/quartz/SchedulerFactory
at com.lightspeed.ejb.Session1.hello(Session1.java:22) [JB7EJB.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_13]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_13]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_13]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_13]
at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
... 37 more
When i change the jboss-deployment-structure.xml to look like this, it runs fine:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<deployment>
<dependencies>
<module name="org.hibernate" slot="3" />
</dependencies>
</deployment>
<sub-deployment name="JB7EJB.jar">
<dependencies>
<module name="org.quartz" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
I thought that if i put the dependencies under the top 'deployment' section, that all deployments will pick up the quartz module, but i have to add the
'<sub-deployment name="JB7EJB.jar">' section to have the JB7EJB deloyment pick up the quartz module.
What am i missing here?
thank you,
Bill
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/763029#763029]
Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 6 months
[JBoss AS 7 Development] - Reference managed beans in other module
by Fausto De La Torre
Fausto De La Torre [https://community.jboss.org/people/faustodelatog] created the discussion
"Reference managed beans in other module"
To view the discussion, visit: https://community.jboss.org/message/763043#763043
--------------------------------------------------------------
Hi,
I have a portal.war wich contains a few jsf pages and one (ManagedBean) Bean annotated @Named, in this war there is a file WEB-INF/beans.xml, I can reference managed bean in jsf pages throw EL, everything works fine in this application.
Now, I have a another.war which depends of portal.war, the file another.war/META-INF/MANIFEST.MF contains the dependency (Dependencies: deployment.portal.war) and contains too WEB-INF/beans.xml, in this another.war I have a few jsf pages and a few ManagedBeans (Beans annotated @Named), in jsf pages I can reference managed beans which are in another.war throw EL whitout problems, however I want to reference the portal.war managed bean in my another.war jsf pages but I can not.
|| *portal.war
* || *
* || *another.war
* || *
* ||
| WEB-INF/beans.xml | ok | WEB-INF/beans.xml | ok |
| com.test.portal
@Named public class PortalManagedBean {... | ok | META-INF/MANIFEST.MF
...
Dependencies: deployment.portal.war
... | ok |
|
|
| com.test.another
@Named public class AnotherManagedBean {... | ok |
| portalHome.xhtml
...
<h:outputText value=#{portalManagedBean.text} />
... | ok | anotherHome.xhtml
...
<h:outputText value=#{anotherManagedBean.text} />
... | ok |
|
|
| *anotherHome.xhtml*
* ...*
* <h:outputText value=#{portalManagedBean.text} />*
* ...* | *FAIL* |
Two files portal.war and other.war are deployed in jboss 7.
I have read cdi documentation, I understand that a library or module wich contains a beans.xml is a "bean archive" and beans which are packaged in a bean archive are available for injection, lookup an EL resolution to classes ans jsf pages packaged in some other bean archive. According to what the documentation says textuallyin the chapter of Modularity
+" Beans and their clients may be deployed in modules in a module architecture such as the Java EE environment. In a mod-+
+ule architecture, certain modules are considered bean archives. In the Java EE module architecture, any Java EE module or+
+library is a module. The Java EE module or library is a bean archive if it contains a beans.xml file, as defined in Sec-+
+tion 12.1, “Bean archives”.+
*+A bean packaged in a certain module is available for injection, lookup and EL resolution to classes and JSP/JSF pages+*
*+packaged in some other module if and only if the bean class of the bean is required to be accessible to the other module by+*
*+the class accessibility requirements of the module architecture. In the Java EE module architecture, a bean class is access-+*
*+ible in a module if and only if it is required to be accessible according to the class loading requirements defined by the+*
*+Java EE platform specification.+*
+Note that, in some Java EE implementations, a bean class might be accessible to some other class even when this is not re-+
+quired by the Java EE platform specification. For the purposes of this specification, a class is not considered accessible to+
+another class unless accessibility is explicitly required by the Java EE platform specification.+
+An alternative is not available for injection, lookup or EL resolution to classes or JSP/JSF pages in a module unless the+
+module is a bean archive and the alternative is explicitly selected in that bean archive. An alternative is never available for+
+injection, lookup or EL resolution in a module that is not a bean archive.++"+
I have found a "solution" for this but I do not believe that is the best way, is for that I want to ask you What I can do for this purpose.
My "solution" is create an empty class com.test.portal.PortalManagedBean in another.war, thus jsf pages can resolve *#{portalManagedBean.text},* But i repeat I do not think is the correct way.
PD: My english is not the best, I hope you undestand me
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/763043#763043]
Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 6 months