Error in transporting an application from development worklight to Worklight Server Consumer Edition - ibm-mobilefirst

I am using IBM Worklight environment. I have created a small application "SampleHybridProject" using Worklight Developer studio and tested it successfully.
Now when I am trying to deploy it on the Worklight Server Consumer Edition, and hitting the following URL: http://mymachine.com:9080/SampleHybridProject/console
I am getting this error in my browser:
Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /SampleHybridProject/console
I am using Worklight Edition 5.0.6. The Worklight Server is default "WAS with Liberty profile".
Here are the properties that I changed in worklight.properties file.
publicWorkLightHostname=localhost
publicWorkLightProtocol=http
publicWorkLightPort=9080
publicWorkLightContext=/SampleHybridProject
wl.db.type=MYSQL
wl.db.url=jdbc:mysql://mysqlinstalledonmypc:3306/WRKLGHT
wl.db.username=root
wl.db.password=admin
Here are the changes that I made in application-descriptor.xml:
<worklightServerRootURL>http://${local.IPAddress}:9080/SampleHybridProject</worklightServerRootURL>
Can you tell me what I am doing wrong or what I need to do?

I have found the problem and solved it. The problem is I was having this error in console.log file:
Error creating bean with name 'txManager' defined in URL [jar:file:/C:/ProgramData/IBM/Worklight/WAS85liberty-server/wlp/usr/shared/resou‌​rces/lib/worklight-jee-library.jar!/conf/core.xml]: Invocation of init method failed; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of com/ibm/ws/classloading/internal/UnifiedClassLoader) previously initiated loading for a different type with name "javax/sql/DataSource"
This was because I had a jar in the server/lib folder of my project which was causing this problem. I removed the jar from server/lib folder and redeployed the .war file. Now the console is getting loaded.

Are you getting any deployment errors in your liberty logs? A 404 on the context root generally means either the WAR was not found, or the context root defaults to something other than 'SampleHybridProject'. If the WAR appears to be loading correctly, it will output where it is listening on similar to:
[AUDIT ] CWWKT0016I: Web application available (default_host): http://[hostname]:port/SampleHybridProject/*
If it says the context root is anything other than SampleHybridProject, you can set it in the tag in liberty's server.xml:
<application id="SampleHybridProject" name="SampleHybridProject"
location="SampleHybridProject.war" type="war"
context-root="SampleHybridProject">
...
</application>

Related

"Adapter deployment failed: Could not resolve placeholder" error in IBM MobileFirst 6.3

I'm unable to read a property's value from worklight.properties file.
I added property as publicProtocol=http in wroklight.properties file and used the property in my adapter.xml as <protocol>${publicProtocol}</protocol> but I'm getting the following error:
Adapter deployment failed: Could not resolve placeholder
'publicProtocol'
This works fine for me using IBM MobileFirst Platform Studio 6.3.0.00-20150214-1702
Created a new project with a HTTP adapter.
Added to server\conf\worklight.properties the following: myCustomProperty=http
The server was automatically restarted
Changed adapters\myAdapter\myAdapter.xml as follows and re-deployed the adapter:
- <protocol>http</protocol>
+ <protocol>${myCustomProperty}</protocol>
To verify that it worked I simply:
Right-click the myAdapter folder and selected Run As > Invoke MobileFirst Procedure and click on OK to invoke the default procedure.
A browser window opened with a successful invocation.

Worklight 6.2 - java.lang.NullPointerException

In Worklight 6.2, there is new method to deploy the Worklight Project, which is using IBM Worklight Server Configuration Tool
refer here :
http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.deploy.doc/deploy/c_using_server_config_tool.html
After setup Worklight admin, and deploy Worklight Project WAR through that. From my understanding, the worklight project will be called runtime
I found errors on the Websphere Logs as below:
[10/3/14 0:37:55:758 MYT] 0000007e FfdcProvider W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on /apps/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/ffdc/server1_6adbbbb2_14.10.03_00.37.55.7436943857084851194341.txt com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters -RE 1123
[10/3/14 0:37:55:758 MYT] 0000007e LocalTranCoor E WLTC0017E: Resources rolled back due to setRollbackOnly() being called.
[10/3/14 0:37:55:769 MYT] 0000007e webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[ServletNameNotFound]: java.lang.NullPointerException
in the http://localhost:9080/worklightconsole/index.html#
Got display as below:
Below is the proof that runtime/worklight project is deployed successfully:
​Next action is to troubleshoot why the runtime/worklight project is not working.
How I can rectify this problem? Thanks.
The exception is in a web container class of WebSphere. You must look at the content of the ffdc file
/apps/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/ffdc/server1_6adbbbb2_14.10.03_00.37.55.7436943857084851194341.txt to see if there are more details in particular the servlet that cannot be found.
But it seems that something is wrong in the Worklight configuration under WAS (viewing the "Servlet not found" error).
The Worklight servlets are in the jar "worklight-jee-library.jar" that is configured as a shared library in WAS.
Without all the WAS logs it is not possible to find the real cause. So you can review the WAS configuration after the deployment by following :
http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.installconfig.doc/admin/t_configuring_websphere_application_server_for_wladmin_manually.html,
http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.installconfig.doc/admin/t_configuring_websphere_application_server_for_oracle_manually_for_wladmin.html,
http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.deploy.doc/admin/t_configuring_websphere_application_server_for_oracle_manually.html,
http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.deploy.doc/admin/t_configuring_websphere_application_server_manually.html
The other reason could be that your Worklight project is not a 6.2 project. How do you build you war file ?

IBM Worklight 6.2: JMX configuration error. Unable to obtain MBeans

I have IBM Worklight 6.2 development environment with the following setup.
Oracle Java 1.7
Eclipse 4.3
IBM Worklight 6.2 Developer Edition
A sample Hybrid project had been created and deployed in the Worklight development server and app works fine in the Mobile Browser Simulator.
I am getting the following error in Worklight Server console in Eclipse:
[ERROR ] Failed to obtain JMX connection to access an MBean.
There might be a JMX configuration error: Read timed out
[ERROR ] FWLSE3000E: A server error was detected.
FWLSE3012E: JMX configuration error. Unable to obtain MBeans. Reason: "Read timed out".
And also I am getting the following error in Worklight Console[Web Console].
FWLSE3012E: JMX configuration error. Unable to obtain MBeans. Reason: "Read timed out".
Note:
I have read the following questions but no luck.
IBM Worklight - Can't run an app on WebSphere Application Server
How to solve management service not starting up in Worklight 6.2
Additional Info:
I used to get the following error whenever the Worklight development server is started from eclipse.
*[WARNING ] CWNEN0070W: The javax.ws.rs.QueryParam annotation class will not be recognized because it was loaded from the null location rather than from a product class loader.
[WARNING ] CWNEN0070W: The javax.ws.rs.PathParam annotation class will not be recognized because it was loaded from the null location rather than from a product class loader.
[WARNING ] CWNEN0070W: The javax.ws.rs.HeaderParam annotation class will not be recognized because it was loaded from the null location rather than from a product class loader.
[WARNING ] CWNEN0070W: The javax.ws.rs.CookieParam annotation class will not be recognized because it was loaded from the null location rather than from a product class loader.
[WARNING ] CWNEN0070W: The javax.ws.rs.core.Context annotation class will not be recognized because it was loaded from the null location rather than from a product class loader.
[WARNING ] CWNEN0070W: The javax.ws.rs.MatrixParam annotation class will not be recognized because it was loaded from the null location rather than from a product class loader.*
I hope necessary information's I have provided. Let me know if u still need.
The JMX timeout error in Worklight 6.2 is a known issue.
Typically when this error occurs to me, a way to resolve it is to either 'wait' a while and then to stop & restart the Worklight Server (in Eclipse > Servers view > 'play' button). Another option is to restart Eclipse.
You can also try the suggestions from the comments:
Try to edit the file
WorklightServerConfig/servers/worklight/jvm.options in your Eclipse
workspace, adding the line
"-Dcom.ibm.ws.jmx.connector.client.rest.readTimeout=180000". Then stop and restart the Worklight Development Server.
and
Try to edit the file
WorklightServerConfig/servers/worklight/server.xml and add in the
section the following line, then restart and try again:
<executor name="LargeThreadPool" id="default" coreThreads="40"
maxThreads="80" keepAlive="60s" stealPolicy="STRICT"
rejectedWorkPolicy="CALLER_RUNS" />
Best is to open a PMR (support ticket) and request an iFix as this is due to be fixed.

Failed Glassfish deploy - "Referencing error: this bundle has no bean of name [ClientBean]"

I'm trying to run the example from this page : GlassFish-to-GlassFish Remote EJB Invocation
But I get this error when I try to deploy the client on glassfish ("asadmin> deploy client-ejb.jar"):
"Exception while deploying the app [client-ejb] : Referencing error: This bundle has no bean of name [ClientBean]"
I need help, thanks.
I encountered a a similar problem when trying to deploy my application (Exception while deploying the app [my-app] : Referencing error : This bundle has no bean of name [myBeanFacade] ) .Rather weird but all that was needed to solve this was to go to the properties of [my-app] under the build category tree, choose compile and tick the compile on save option. Redeployed my application and viola !!
NB [my-app] contains 2 ejb jars and a web application, one of the ejbs is a library in the web app.
This problem occurred because the guy forgot to add the ServiceIF.class reference in client-ejb.jar.
Execute the command:
jar cvf client-ejb.jar test/ServiceIF.class test/ClientIF.class test/ClientBean.class META-INF/glassfish-ejb-jar.xml
get the new .jar and it will work.
In case you are using a deployment descriptor, then the EJB name should be the same in both the descriptor file.
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Hello</ejb-name>
<home>com.ejb.test.HelloHome</home>
<remote>com.ejb.test.HelloObject</remote>
<ejb-class>com.ejb.test.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
**<ejb-name>Hello</ejb-name>**
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
<glassfish-ejb-jar>
<enterprise-beans>
<ejb>
**<ejb-name>Hello</ejb-name>**
<jndi-name>jndi/Hello</jndi-name>
</ejb>
</enterprise-beans>
</glassfish-ejb-jar>

cannot find EJB reference while deploying ADF Fusion Webapp into oracle weblogic server

I created a Fusion Webapplication project with Oracle jdeveloper 11g (11.1.5 but the same problem occours with the 11.2.1 version). Then I created a jsf page and I deployed the project to an external weblogic server (WL 10.3) with the ADF runtime support and evrithing where working.
Then I created the POJOs object (to the model project, because I have 2 proj: Model and ViewController for the web pages and backing beans) from the DB tables and a session bean who provides queries methods. After that (and so far everything it's ok) I added an ADF Data Control bound to the session bean and then I bound (via editor) one of these methods into the jsf page using an ADF table.
If I run the project using the run button everything work, but if I deploy it into both the external deployment WL server and in the internal one I get the following error
[05:30:04 PM] [Deployer:149193]Operation 'deploy' on application 'Prova_application1' has failed on 'AdminServer'
[05:30:04 PM] [Deployer:149034]An exception occurred for task [Deployer:149026]deploy application Prova_application1 on AdminServer.: Could not setup environment.
[05:30:04 PM] Weblogic Server Exception: weblogic.application.ModuleException: Could not setup environment
[05:30:04 PM] Caused by: weblogic.deployment.EnvironmentException: [J2EE:160167]The module Prova-ViewController-context-root in application Prova_application1 uses ejb-links but no EJB modules were found for this application.
[05:30:04 PM] See server logs or server console for more details.
[05:30:04 PM] weblogic.application.ModuleException: Could not setup environment
[05:30:04 PM] #### Deployment incomplete. ####
[05:30:04 PM] Remote deployment failed
but there is such refernce into the web.xml and I bound the Model project into the deployment descriptor. I red every post in the web but I still can't face the problem.
The web.xml in the ViewController project contains the EJB reference (automatically created from jdeveloper) and I bound everithing the Model project but it still doesn't work.
In JDeveloper IDE
you need to set ejb-jar.xml path.
- Right click on your project
- Choose Project Properties
- Go to EJB Module
- Set EJB Version (For example: "2.1")
- Set ejb-jar.xml path (For example: "..\src\META-INF\ejb-jar.xml")
I hope it works..