The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20120329

WELD-000075 Normal scoped managed bean implementation class has a public field: public@ViewScoped @Named class



i was having the hardest time trying to figure out why i was getting these errors when i started my jboss 7, richfaces 4, seam 3, jsf 2 app:

Caused by: org.jboss.weld.exceptions.DefinitionException: WELD-000075 Normal scoped managed bean implementation class has a public field:  public@ViewScoped @Named class com.myApp.richfacesweb.test.Test
at org.jboss.weld.bean.ManagedBean.checkBeanImplementation(ManagedBean.java:438)
at org.jboss.weld.bean.AbstractClassBean.initialize(AbstractClassBean.java:197)
at org.jboss.weld.bean.ManagedBean.initialize(ManagedBean.java:322)
at org.jboss.weld.bootstrap.AbstractBeanDeployer.deploy(AbstractBeanDeployer.java:115)
at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:204)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:344)
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82)
at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
15:25:34,408 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"myApp.ear\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myApp.ear\".WeldService: org.jboss.weld.exceptions.DefinitionException: WELD-000075 Normal scoped managed bean implementation class has a public field:  public@ViewScoped @Named class com.myApp.richfacesweb.test.Test"}}}}

then i figured that the problem was that i declared a variable public instead of private!

my bean looked like this:
package com.myApp.richfacesweb.test;
import java.io.Serializable;
import javax.faces.bean.ViewScoped;
import javax.inject.Named;
@ViewScoped
@Named(value="myTestBean")
public class Test implements Serializable {
public String submit(String param) {
   System.out.println("Submit using value " + param);
   System.out.println("myobject " + myobject);
   return null;
}
public String myobject;
public String getMyobject() {
return myobject;
}
public void setMyobject(String _myobject) {
myobject = _myobject;
System.out.println("myobject " + myobject);
}
}
 the error was this line:
public String myobject;
it should have been this:
private String myobject;

facepalm! 

it was Jan Groth's comment which led me to the solution (thanks Jan):
The motivation of WELD-000075 is technical. Access to a public field cannot be proxied. So a bean is required to be either pseudo scoped (@dependent, @singleton) or to guarantee access through public methods (which shouldn't be hard to achieve).

how to download/check out the seam 3 examples for javaee-booking

get the source code:

svn co http://anonsvn.jboss.org/repos/seam/examples/trunk/

then build it:
cd trunk/javaee-booking
mvn package

20120320

how to quickly create an eclipse project from an existing source folder of files

let's say you have this folder of files you want to create as a project in eclipse:
/home/me/myfolder

copy the folder into your workspace, e.g.:
/home/me/myEclipseWorkspace/myfolder

in eclipse:
* new > project > next
* for project name type myfolder
* finish

the reason i wanted to do this was so that i could compare jboss 7.1.1 files with jboss 7.1.0 so i could see the changes using compare with > each other

20120319

WARNING: -logmodule is deprecated. Please use the system property 'java.util.logging.manager' or the 'java.util.logging.LogManager' service loader

when i start up jboss 7.1 i get this warning as the first line on the console:
WARNING: -logmodule is deprecated. Please use the system property 'java.util.logging.manager' or the 'java.util.logging.LogManager' service loader.
this is set in the server launch configuration in eclipse.
click on the servers tab in eclipse.
double click on the server you're using, e.g. jboss 7.1.
click on the open launch configuration link.
in the arguments tab, set the correct value for the -logmodule flag, as instructed on the console output, e.g.:
-mp "/home/me/workspaceIndigo/myJBoss7Project/jboss-as-7.1.0.Final/modules" -logmodule java.util.logging.manager -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone
i was getting the warning because the logmodule value was previously set to org.jboss.logmanager (which was "wrong")

20120315

ROTD - copying a url in the beginning of a line and pasting it into the href tag of a second a-tag (html anchor) later on in the same line

here's my regex of the day--a real, live example of how i fixed the bottom half of my music links:
http://nickleus.com/music/


i want to convert this string:
<li><a href="../media/audio/MiksenMaetsj/01_80sDancePopClarinet.mp3">mp3</a> | <a href="#">01. 80sDancePopClarinet</a></li>

into this string:
<li><a href="../media/audio/MiksenMaetsj/01_80sDancePopClarinet.mp3">mp3</a> | <a href="../media/audio/MiksenMaetsj/01_80sDancePopClarinet.mp3">01. 80sDancePopClarinet</a></li>

if you paste the first line, e.g. into geany, then simply use the following regex to convert it:

find:
^(.*)(\.\./media.*)(">mp3<.*href=")#(.*)$

replace with:
\1\2\3\2\4