null pointer exception in sherlock action bar with option menu - actionbarsherlock

I want sherlock action bar with default sherlock search widget.The search icon is displayed on sherlock action bar but onclick its force closing .My Logcat shown below
04-17 11:44:48.877: E/AndroidRuntime(530): FATAL EXCEPTION: main
04-17 11:44:48.877: E/AndroidRuntime(530): java.lang.NullPointerException
04-17 11:44:48.877: E/AndroidRuntime(530): at com.android.internal.view.menu.MenuItemImpl.toString(MenuItemImpl.java:490)
04-17 11:44:48.877: E/AndroidRuntime(530): at java.lang.StringBuilder.append(StringBuilder.java:202)
04-17 11:44:48.877: E/AndroidRuntime(530): at com.actionbarsherlock.app.SherlockFragmentActivity.onMenuItemSelected(SherlockFragmentActivity.java:201)
04-17 11:44:48.877: E/AndroidRuntime(530): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:950)
04-17 11:44:48.877: E/AndroidRuntime(530): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
04-17 11:44:48.877: E/AndroidRuntime(530): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
04-17 11:44:48.877: E/AndroidRuntime(530): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
04-17 11:44:48.877: E/AndroidRuntime(530): at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:490)
04-17 11:44:48.877: E/AndroidRuntime(530): at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:108)
04-17 11:44:48.877: E/AndroidRuntime(530): at android.view.View.performClick(View.java:3511)
04-17 11:44:48.877: E/AndroidRuntime(530): at android.view.View$PerformClick.run(View.java:14105)
04-17 11:44:48.877: E/AndroidRuntime(530): at android.os.Handler.handleCallback(Handler.java:605)
04-17 11:44:48.877: E/AndroidRuntime(530): at android.os.Handler.dispatchMessage(Handler.java:92)
04-17 11:44:48.877: E/AndroidRuntime(530): at android.os.Looper.loop(Looper.java:137)
04-17 11:44:48.877: E/AndroidRuntime(530): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-17 11:44:48.877: E/AndroidRuntime(530): at java.lang.reflect.Method.invokeNative(Native Method)
04-17 11:44:48.877: E/AndroidRuntime(530): at java.lang.reflect.Method.invoke(Method.java:511)
04-17 11:44:48.877: E/AndroidRuntime(530): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-17 11:44:48.877: E/AndroidRuntime(530): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-17 11:44:48.877: E/AndroidRuntime(530): at dalvik.system.NativeStart.main(Native Method)
The menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="#+id/menu_search"
android:actionViewClass="com.actionbarsherlock.widget.SearchView"
android:icon="#android:drawable/ic_menu_search"
android:showAsAction="always|collapseActionView"
/>
</menu>
The code in sherlock activity
#Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.tvguide_menu, menu);
}
public boolean onOptionsItemSelected(MenuItem item)
{
Log.e("", "itemselected" +item.getItemId());
switch(item.getItemId())
{
case R.id.menu_search:
Toast.makeText(TVBuddyMainActivity.this,"search selected", Toast.LENGTH_LONG).show();
Intent intent = new Intent(TVBuddyMainActivity.this,CustomSearch.class);
startActivity(intent);
break;
}
return true;
}
pls help me with this logcat....

It is a bug in version 4.3.0 of ActionBarSherlock, I fixed it in this way:
--- a/actionbarsherlock/src/com/actionbarsherlock/app/SherlockFragmentActivity.java
+++ b/actionbarsherlock/src/com/actionbarsherlock/app/SherlockFragmentActivity.java
## -198,7 +198,7 ## public class SherlockFragmentActivity extends Watson implements OnActionModeStar
#Override
public final boolean onMenuItemSelected(int featureId, android.view.MenuItem item) {
- if (BuildConfig.DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);
+ // if (BuildConfig.DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeSelected) {
mIgnoreNativeSelected = true;

Related

while I test my app, I get the follow error in the Android-Studio-Consol:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.firstproject, PID: 6019
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.firstproject/com.example.firstproject.MainActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class android.webkit.WebView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.example.firstproject.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555) 
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161) 
at com.example.firstproject.MainActivity.onCreate(MainActivity.java:19) 
at android.app.Activity.performCreate(Activity.java:5990) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x2040003
at android.content.res.Resources.getText(Resources.java:299)
at android.content.res.Resources.getString(Resources.java:385)
at com.android.org.chromium.content.browser.ContentViewCore.setContainerView(ContentViewCore.java:684)
at com.android.org.chromium.content.browser.ContentViewCore.initialize(ContentViewCore.java:608)
at com.android.org.chromium.android_webview.AwContents.createAndInitializeContentViewCore(AwContents.java:631)
at com.android.org.chromium.android_webview.AwContents.setNewAwContents(AwContents.java:780)
at com.android.org.chromium.android_webview.AwContents.(AwContents.java:619)
at com.android.org.chromium.android_webview.AwContents.(AwContents.java:556)
at com.android.webview.chromium.WebViewChromium.initForReal(WebViewChromium.java:311)
at com.android.webview.chromium.WebViewChromium.access$100(WebViewChromium.java:96)
at com.android.webview.chromium.WebViewChromium$1.run(WebViewChromium.java:263)
at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.drainQueue(WebViewChromium.java:123)
at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue$1.run(WebViewChromium.java:110)
at com.android.org.chromium.base.ThreadUtils.runOnUiThread(ThreadUtils.java:144)
at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.addTask(WebViewChromium.java:107)
at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:260)
at android
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final WebView webView = (WebView) findViewById(R.id.web_view) ;
final EditText editText = (EditText) findViewById(R.id.etext) ;
webView.setWebViewClient (new WebViewClient() );
Button button = (Button)findViewById(R.id.btn_go) ;
button.setOnClickListener (new View.OnClickListener() {
#Override
public void onClick (View v){
webView.loadUrl(editText.getText().toString() ) ;
}
});
}
}
Here's XML code :
Here's Emulator :

Injecting a bean returns null [duplicate]

This question already has answers here:
Accessing injected dependency in managed bean constructor causes NullPointerException
(1 answer)
#Inject field is always null [duplicate]
(1 answer)
Closed 6 years ago.
I have two webpages with a bean backing each as well as multiple DAOs running on a Glassfish 4.0 server. The first page is a loginpage - everything works fine here and I can access the injected objects.
On the second page however, every time I try to access one of the injected objects I get a nullpointer-exception.
This is my (working) loginpage:
#ViewScoped
#Named
public class indexController implements Serializable {
private static final Logger log = Logger.getLogger(indexController.class.getName());
private String passwort, growlMsg;
#Inject
Manager manager;
#Inject
PersonalDAO personalDAO;
public indexController() {
}
public String login() {
System.out.println("------------------LOGIN-----------------------\n"
+ "Werk: " + getWerk() + "\n"
+ "Mandant: " + getMandant() + "\n"
+ "Personalnr:" + getPersnr() + "\n"
+ "Passwort: " + passwort + "\n"
+ "----------------------------------------------");
if (isValidUser()) {
manager.setUserVerified(true);
return "main";
} else {
FacesContext ctx = FacesContext.getCurrentInstance();
ctx.addMessage(null, new FacesMessage("Login failed.", "Please verify your login credentials."));
return "index";
}
}
//TODO: Implement hashing and salting
private boolean isValidUser() {
List<Personal> pers = personalDAO.find(getPersnr());
if (pers.isEmpty()) {
return false;
}
Personal personal = pers.get(0);
if (personal.getWerk().getId() != getWerk()) {
return false;
}
if (personal.getMandant().getId() != getMandant()) {
return false;
}
if (!personal.getPasswort().equals(passwort)) {
return false;
}
return true;
}
private boolean isInteger(String n) {
try {
Integer.parseInt(n);
} catch (NumberFormatException ex) {
return false;
}
return true;
}
public int getMandant() {
return manager.getMandant();
}
public void setMandant(int mandant) {
manager.setMandant(mandant);
}
public int getWerk() {
return manager.getWerk();
}
public void setWerk(int werk) {
manager.setWerk(werk);
}
public int getPersnr() {
return manager.getPersnr();
}
public void setPersnr(int persnr) {
manager.setPersnr(persnr);
}
public String getPasswort() {
return passwort;
}
public void setPasswort(String passwort) {
this.passwort = passwort;
}
public String getGrowlMsg() {
return growlMsg;
}
public void setGrowlMsg(String growlMsg) {
this.growlMsg = growlMsg;
}
}
This is the bean I am having issues with:
#RequestScoped
#Named
public class mainController implements Serializable {
private List<Abwesenheit> abwesenheit;
private List<Personal> personal;
#Inject
Manager manager;
#Inject
PersonalDAO personalDAO;
#Inject
AbwesenheitDAO abwesenheitDAO;
public mainController() {
System.out.println("-----MAINCONTROLLER CALLED-----");
System.out.println(manager.isUserVerified());
System.out.println("-----------------------------------");
}
public List<Abwesenheit> getAbwesenheit() {
return abwesenheit;
}
public void setAbwesenheit(List<Abwesenheit> abwesenheit) {
this.abwesenheit = abwesenheit;
}
public List<Personal> getPersonal() {
return personal;
}
public String getVerified() {
return manager.isUserVerified()?"Verified":"Not Verified";
}
}
Manager class:
#SessionScoped
public class Manager implements Serializable {
//TODO: Use an enum for access-levels instead of just access/no access
private boolean userVerified = false;
int werk, mandant, persnr;
public Manager() {
}
public boolean isUserVerified() {
return userVerified;
}
public void setUserVerified(boolean userVerified) {
this.userVerified = userVerified;
}
public int getWerk() {
return werk;
}
public void setWerk(int werk) {
this.werk = werk;
}
public int getMandant() {
return mandant;
}
public void setMandant(int mandant) {
this.mandant = mandant;
}
public int getPersnr() {
return persnr;
}
public void setPersnr(int persnr) {
this.persnr = persnr;
}
}
personalDAO class:
#Stateless
public class PersonalDAO implements Serializable {
#PersistenceContext(unitName="GFOS_AwardPU")
private EntityManager entityManager;
public List<Personal> getPersonal() {
return entityManager.createNamedQuery("Personal.findAll", Personal.class).getResultList();
}
public List<Personal> find(String personalNr) {
Query query = entityManager.createNamedQuery("Personal.findByPersonalnr");
query.setParameter("personalnr", personalNr);
return query.getResultList();
}
public List<Personal> find(int personalNr) {
Query query = entityManager.createNamedQuery("Personal.findByPersonalnr");
query.setParameter("personalnr", personalNr);
return query.getResultList();
}
public List<Personal> find(String personalNr, String name, String vorname, String mandant, String werk) {
String query = "SELECT * FROM Personal WHERE 1=1";
if(personalNr != null && !personalNr.isEmpty()) {
query += " AND Personalnr="+personalNr;
}
if(name != null && !name.isEmpty()) {
query += " AND name='"+name+"'";
}
if(vorname != null && !vorname.isEmpty()) {
query += " AND vorname='"+vorname+"'";
}
if(mandant != null && !mandant.isEmpty()) {
query += " AND mandant="+mandant;
}
if(werk != null && !werk.isEmpty()) {
query += " AND werk="+werk;
}
return entityManager.createNativeQuery(query, Personal.class).getResultList();
}
}
This is the Glassfish server log extract, there are no exceptions prior:
[2016-03-10T19:43:21.303+0100] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=22 _ThreadName=Thread-3] [timeMillis: 1457635401303] [levelValue: 800] [[
-----MAINCONTROLLER CALLED-----]]
[2016-03-10T19:43:21.304+0100] [glassfish 4.0] [SEVERE] [] [javax.enterprise.resource.webcontainer.jsf.application] [tid: _ThreadID=22 _ThreadName=http-listener-1(5)] [timeMillis: 1457635401304] [levelValue: 1000] [[
Error Rendering View[/main.xhtml]
java.lang.NullPointerException
at controller.mainController.<init>(mainController.java:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:79)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:63)
at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:29)
at org.jboss.weld.injection.producer.DefaultInstantiator.newInstance(DefaultInstantiator.java:90)
at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:86)
at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:172)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:157)
at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:69)
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:716)
at org.jboss.weld.el.AbstractWeldELResolver.lookup(AbstractWeldELResolver.java:133)
at org.jboss.weld.el.AbstractWeldELResolver.getValue(AbstractWeldELResolver.java:96)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:188)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116)
at com.sun.el.parser.AstValue.getBase(AstValue.java:151)
at com.sun.el.parser.AstValue.getValue(AstValue.java:200)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIOutput.getValue(UIOutput.java:174)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
at com.sun.faces.renderkit.html_basic.LabelRenderer.encodeBegin(LabelRenderer.java:120)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:869)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
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(Unknown Source)
]]
[2016-03-10T19:43:21.358+0100] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=22 _ThreadName=Thread-3] [timeMillis: 1457635401358] [levelValue: 800] [[
-----MAINCONTROLLER CALLED-----]]
[2016-03-10T19:43:21.375+0100] [glassfish 4.0] [FATAL] [jsf.context.exception.handler.log] [javax.enterprise.resource.webcontainer.jsf.context] [tid: _ThreadID=22 _ThreadName=http-listener-1(5)] [timeMillis: 1457635401375] [levelValue: 1100] [[
JSF1073: java.lang.NullPointerException erfasst w?hrend Verarbeitung von RENDER_RESPONSE 6 : UIComponent-ClientId=, Message=null]]
[2016-03-10T19:43:21.376+0100] [glassfish 4.0] [FATAL] [] [javax.enterprise.resource.webcontainer.jsf.context] [tid: _ThreadID=22 _ThreadName=http-listener-1(5)] [timeMillis: 1457635401376] [levelValue: 1100] [[
java.lang.NullPointerException
at controller.mainController.<init>(mainController.java:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:79)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:63)
at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:29)
at org.jboss.weld.injection.producer.DefaultInstantiator.newInstance(DefaultInstantiator.java:90)
at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:86)
at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:172)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:157)
at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:69)
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:716)
at org.jboss.weld.el.AbstractWeldELResolver.lookup(AbstractWeldELResolver.java:133)
at org.jboss.weld.el.AbstractWeldELResolver.getValue(AbstractWeldELResolver.java:96)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:188)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116)
at com.sun.el.parser.AstValue.getBase(AstValue.java:151)
at com.sun.el.parser.AstValue.getValue(AstValue.java:200)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIOutput.getValue(UIOutput.java:174)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
at com.sun.faces.renderkit.html_basic.LabelRenderer.encodeBegin(LabelRenderer.java:120)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:869)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
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(Unknown Source)
]]
Why doesn't it work in the mainController class? I've tried changing the scopes of both classes but that did not help. Netbeans does not show any errors. I have also tried starting Glassfish trough both Netbeans or manual. The last thing I tried is changing the imports from
import javax.faces.bean.RequestScoped
(and the SessionScoped of the manager-class) to
import javax.enterprise.context.RequestScoped
yet none of it fixed my problem.
Instead of constructor
public mainController() {
System.out.println("-----MAINCONTROLLER CALLED-----");
System.out.println(manager.isUserVerified());
System.out.println("-----------------------------------");
}
use method with annotation #PostConstruct.
#PostConstruct
private void init() {
System.out.println("-----MAINCONTROLLER INITIALIZED-----");
System.out.println(manager.isUserVerified());
System.out.println("-----------------------------------");
}
Dependencies are not yet injected in constructor, they can be accessed after object is created.

App unfortunately closing

I am receiving "App has unfortunately stopped" error. I am using parse so I am assuming the issue lies somewhere within that.
This is the java file that I causes the error when loading
public class NewTipActivity extends Activity {
private Tip tip;
#Override
protected void onCreate(Bundle savedInstanceState) {
tip = new Tip();
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
//New Tip Fragment
setContentView(R.layout.activity_new_tip);
FragmentManager manager = getFragmentManager();
Fragment fragment = manager.findFragmentById(R.id.fragmentContainer);
if (fragment == null) {
fragment = new NewTipFragment();
manager.beginTransaction().add(R.id.fragmentContainer, fragment)
.commit();
}
}
public Tip getCurrentTip() {
return tip;
}
}
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.holyapp.danshinn.wingman_etiquette/com.holyapp.danshinn.wingman_etiquette.NewTipActivity}:
java.lang.IllegalArgumentException: cannot setReadAccess for a user
with null id
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: cannot setReadAccess for a user with null id
at com.parse.ParseACL.setReadAccess(ParseACL.java:308)
at com.parse.ParseACL.getDefaultACL(ParseACL.java:61)
at com.parse.ParseObject.setDefaultValues(ParseObject.java:3385)
at com.parse.ParseObject.(ParseObject.java:181)
at com.parse.ParseObject.(ParseObject.java:127)
at com.holyapp.danshinn.wingman_etiquette.Tip.(Tip.java:17)
at com.holyapp.danshinn.wingman_etiquette.NewTipActivity.onCreate(NewTipActivity.java:20)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

ClassCastException with CDI producer method and groovy class from script

I am learning about Groovy Language and possibilities to integrate it with CDI.
In java class path, a have a interface called Product. I created a CDI Producer Method that returns a Product type.
At another class, I performs a injection of a Product, that comes from the CDI Producer Method.
Out of classpath, I wrote a groovy script, with a simple groovy class, that implements the Product interface.
Inside CDI Producer Method, I use GroovyScriptEngine to retrieve the Class object from script, to create a CDI Bean.
I am using
Weld version 2.2.8.Final as CDI implementation.
Groovy at version 2.3.9.
The Tomcat server 7.
Using JSF 2.2.8 as well.
(thinking that problem is related only to Weld Implementation of CDI eh Groovy)
All works fine at first time. It is possible using the created bean inside JSF pages, clicking in button and performs actions at the server side, and refresh the page on browser. All declared methods and fields on groovy script class can be accessd and used with JSF pages. The CDI container performs the calling of #PostConstruct as well. The CDI Producer Method is can be called many time, and all works.
As said, all works fine at the first time. But when the groovy script changes, a ClassCastException is thrown.
Someone can help me to about this? Is this a Weld/Groovy issue, or simply not possible?
The Product interface:
package test;
/**
*
* #author Welyab
*/
#ProductMethodIntercetor
public interface Product {
public void a();
public void b();
}
The groovy script that implements the Product interface:
package test
class ProductImplWithGroovy implements test.Product {
#javax.annotation.PostConstruct
def void init(){
println "call init()"
}
def void a(){
println "call a()";
}
def void b(){
println "call b()";
}
def void c(){
println "call c()";
}
}
The producer class/method:
package test;
import groovy.util.GroovyScriptEngine;
import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.net.URL;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Default;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.CDI;
import javax.enterprise.inject.spi.InjectionTarget;
import javax.enterprise.util.AnnotationLiteral;
/**
*
* #author Welyab
*/
public class ProductsTest {
private static GroovyScriptEngine se;
static {
try {
se = new GroovyScriptEngine(new URL[]{
new File("c:/users/welyab/desktop").toURI().toURL()
});
}
catch (IOException ex) {
ex.printStackTrace();
}
}
#Produces
#ProductProducer
public Product criarProduto() {
BeanManager bm = CDI.current().getBeanManager();
final Class klazz;
try {
klazz = se.loadScriptByName("script_test.groovy");
}
catch (Exception ex) {
throw new RuntimeException(ex);
}
Class finalKlazz = klazz;
AnnotatedType annotatedType = bm.createAnnotatedType(finalKlazz);
InjectionTarget injectionTarget = bm.createInjectionTarget(annotatedType);
Bean bean = new Bean() {
#Override
public Class getBeanClass() {
return finalKlazz;
}
#Override
public Set getInjectionPoints() {
return injectionTarget.getInjectionPoints();
}
#Override
public boolean isNullable() {
return false;
}
#Override
public Object create(CreationalContext creationalContext) {
Object instance = injectionTarget.produce(creationalContext);
injectionTarget.inject(instance, creationalContext);
injectionTarget.postConstruct(instance);
return instance;
}
#Override
public void destroy(Object instance, CreationalContext creationalContext) {
injectionTarget.preDestroy(instance);
injectionTarget.dispose(instance);
creationalContext.release();
}
#Override
public Set<?> getTypes() {
Set<Type> types = new HashSet<>();
types.add(finalKlazz);
types.add(Product.class);
types.add(Object.class);
return types;
}
#Override
public Set getQualifiers() {
Set<Annotation> qualifiers = new HashSet<Annotation>();
qualifiers.add(new AnnotationLiteral<Default>() {
});
qualifiers.add(new AnnotationLiteral<Any>() {
});
return qualifiers;
}
#Override
public Class getScope() {
return ApplicationScoped.class;
}
#Override
public String getName() {
return "product";
}
#Override
public Set getStereotypes() {
return Collections.emptySet();
}
#Override
public boolean isAlternative() {
return false;
}
};
CreationalContext ctx = bm.createCreationalContext(bean);
Product produto = (Product) bm.getReference(bean, finalKlazz, ctx);
return produto;
}
}
The bean to JSF page:
package test;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
/**
*
* #author Welyab
*/
#Named
#RequestScoped
public class TestBean {
#Inject
#ProductProducer
private Product product;
public Product getProduct() {
return product;
}
}
A simple fraggmento of JSF page that uses the bean.
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
template="/install/ayszu-template.xhtml"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<ui:define name="body">
<form jsf:id="form" >
<h:commandButton value="a" action="#{testBean.product.a}" />
<h:commandButton value="b" action="#{testBean.product.b}" />
<h:commandButton value="c" action="#{testBean.product.c}" />
</form>
</ui:define>
</ui:composition>
The stacktrace with the error [all exception looks like caused by the class casting exception]
30-Dec-2014 18:59:37.944 WARNING [http-nio-8082-exec-24] com.sun.faces.lifecycle.InvokeApplicationPhase.execute #{testBean.product.c}: java.lang.ClassCastException: test.ProductImplWithGroovy cannot be cast to test.ProductImplWithGroovy
javax.faces.FacesException: #{testBean.product.c}: java.lang.ClassCastException: test.ProductImplWithGroovy cannot be cast to test.ProductImplWithGroovy
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
call init()
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:301)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.welyab.ayszu.core.MainFilter.doFilter(MainFilter.java:72)
at com.welyab.ayszu.core.MainFilter.doFilter(MainFilter.java:67)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1015)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:652)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1575)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1533)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: test.ProductImplWithGroovy cannot be cast to test.ProductImplWithGroovy
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
... 35 more
Caused by: java.lang.ClassCastException: test.ProductImplWithGroovy cannot be cast to test.ProductImplWithGroovy
at test.ProductImplWithGroovy$Proxy$_$$_WeldClientProxy.c(Unknown Source)
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:483)
at com.sun.el.parser.AstValue.invoke(AstValue.java:275)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
... 36 more
30-Dec-2014 18:59:38.182 FATAL [http-nio-8082-exec-24] com.sun.faces.context.ExceptionHandlerImpl.log JSF1073: javax.faces.FacesException obtido durante o processamento de INVOKE_APPLICATION 5: UIComponent-ClientId=, Message=#{testBean.product.c}: java.lang.ClassCastException: test.ProductImplWithGroovy cannot be cast to test.ProductImplWithGroovy
30-Dec-2014 18:59:38.191 FATAL [http-nio-8082-exec-24] com.sun.faces.context.ExceptionHandlerImpl.log #{testBean.product.c}: java.lang.ClassCastException: test.ProductImplWithGroovy cannot be cast to test.ProductImplWithGroovy
javax.faces.FacesException: #{testBean.product.c}: java.lang.ClassCastException: test.ProductImplWithGroovy cannot be cast to test.ProductImplWithGroovy
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:89)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:301)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.welyab.ayszu.core.MainFilter.doFilter(MainFilter.java:72)
at com.welyab.ayszu.core.MainFilter.doFilter(MainFilter.java:67)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1015)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:652)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1575)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1533)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.faces.FacesException: #{testBean.product.c}: java.lang.ClassCastException: test.ProductImplWithGroovy cannot be cast to test.ProductImplWithGroovy
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
... 31 more
Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: test.ProductImplWithGroovy cannot be cast to test.ProductImplWithGroovy
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
... 35 more
Caused by: java.lang.ClassCastException: test.ProductImplWithGroovy cannot be cast to test.ProductImplWithGroovy
at test.ProductImplWithGroovy$Proxy$_$$_WeldClientProxy.c(Unknown Source)
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:483)
at com.sun.el.parser.AstValue.invoke(AstValue.java:275)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
... 36 more

LibGDX Desktop launch error

I have a game in Libgdx. It will now not run on the desktop version, or on android. When I run Main.java as desktop application, it sends these errors.. I will also post my code. Thanks.
Errors:
Exception in thread "main" java.lang.NoClassDefFoundError: com/badlogic/gdx/graphics/GLCommon
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:64)
at com.ahewdev.spacepace.Main.main(Main.java:17)
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.graphics.GLCommon
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
Desktop - Main.java code
package com.ahewdev.spacepace;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.ahewdev.spacepace.SpacePace;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.setup.resources.desktop.*;
public class Main {
public static void main(String[] args) {
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "spacepace";
cfg.width = 480;
cfg.height = 320;
cfg.useGL20 = false;
new LwjglApplication(new SpacePace(), cfg);
}
}
EDIT:

Resources